- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 docs 的末尾关于测试云功能,有一个关于 CI/CD 的部分。然而,他们给出的唯一示例是针对节点的。我一直在尝试用 python 3.7 做一些事情,但没有成功。
每次推送到 Google Source Cloud 存储库时,我都会设置一个触发器。这是一个多功能项目
├── actions
│ ├── action.json
│ └── main.py
├── cloudbuild.yaml
├── Dockerfile
├── graph
│ ├── main.py
│ └── requirements.txt
└── testing
├── test_actions.py
└── test_graph.py
我已经尝试过 example进行定制构建。
这是我的cloudbuild.yml
:
steps:
- name: 'gcr.io/momentum-360/pytest'
这是我的Dockerfile
:
FROM python:3.7
COPY . /
WORKDIR /
RUN pip install -r graph/requirements.txt
RUN pip install pytest
ENTRYPOINT ["pytest"]
当我在云构建环境(而不是本地)中运行它时,出现以下错误:
"Missing or insufficient permissions.","grpc_status":7}"
E >
The above exception was the direct cause of the following exception:
testing/test_graph.py:7: in <module>
from graph import main
这意味着我没有足够的权限来读取自己的文件?我不确定我这样做是否正确。
最佳答案
我相信问题出在您的 cloudbuild.yaml
上。您需要对其进行配置以从 Dockerfile 构建镜像。 Check the official Google Cloud Build了解如何创建构建配置文件。
我一直在尝试这个简单的设置,它对我有用:
├── project
├── cloudbuild.yaml
└── Dockerfile
└── test_sample.py
test_sample.py的内容:
def inc(x):
return x + 1
def test_answer():
assert inc(3) == 4
这是cloudbuild.yaml
:
steps:
- name: 'gcr.io/cloud-builders/docker'
args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/pytest-image', '.' ]
images:
- 'gcr.io/$PROJECT_ID/pytest-image'
Dockerfile
,将项目复制到其自己的目录中以运行 pytest 非常重要。
FROM python:3.7
COPY . /project
WORKDIR /project
RUN pip install pytest
ENTRYPOINT ["pytest"]
现在,在项目目录中我们构建图像:
gcloud 构建提交 --config cloudbuild.yaml 。
我们拉它:
docker pull gcr.io/$PROJECT_ID/pytest-image:latest
并运行它:
docker run gcr.io/$PROJECT_ID/pytest-image:latest
结果:
============================= test session starts ==============================
platform linux -- Python 3.7.2, pytest-4.2.0, py-1.7.0, pluggy-0.8.1
rootdir: /src, inifile:
collected 1 item
test_sample.py . [100%]
=========================== 1 passed in 0.03 seconds ===========================
关于python - Google 云函数 : CI/CD for Python 3. 7 运行时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54601826/
我尝试按照这些说明返回到前一个目录,但结果是“-bash CD:OLDPWD未设置”。。。我怎么能做我想做的事呢?。谢谢。
我认为在 IPython 中使用 ! 前缀的 shell 命令会使系统 shell 实际执行该命令,但似乎并非如此。考虑以下情况,我从 /home/Documents/Rx 开始,启动 IPython
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想改善这个问题吗?更新问题,以便将其作为on-topic
有些 Live CD 可以启动操作系统并允许您无需安装即可使用它。 我想知道是否有一种简单的方法来自定义 Live CD,以便它只加载运行一个应用程序所需的内容,然后运行该应用程序。 最佳答案 对于
当我从 Live CD 启动 Linux Mint 时,我能够将文件保存到“文件系统”。但这些文件保存在哪里呢?不可能是光盘,因为它是 CDR。我不认为它存储在 RAM 中,因为它只能保存这么多数据,
创建了以下类,暂时没有接口(interface)/抽象类: 测试 - 用于创建测试数据 音乐 - 应存储所有 CD CD - 应存储艺术家和 CD 标题 + 所有歌曲 艺术家 - 仅包含字符串名称 歌
在 Git 提交和推送之后,Go 管道有时需要一段时间才能启动。即使在手动按下开始按钮后,也可能需要很长时间。有没有一种设置或方法可以让它更快地获取更改并更快地启动?我不介意它是否在服务器上使用更多资
这可能吗? 我的第一个猜测是: C:> Get-WmiObject Win32_CDROMDrive 但是当我尝试这个时,它只告诉我 Caption , Drive , Manufacturer ,
我正在运行 gitlab 作业,在作业中我试图取消设置在 CI/CD 设置中的某些变量。 例如,我有SOME_VARIABLE设置为 然后,在工作定义中,我正在尝试 variables: SOM
我遇到的问题是 cd不在窗口节点中工作: node("Window-node") { stage('unstash'){ echo
我尝试关注these instructions返回到上一个目录,但这会导致“-bash cd: OLDPWD not set”。 我怎样才能做我想做的事? 谢谢。 最佳答案 我也遇到了同样的问题。为
我在postgresql有点情况 我有两个表 t1 和 t2,并且都有一个列具有相同类型的数据“col_data”,col_data 可能只有以下数据 ('ab', 'cd', 'ab,cd', 'c
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我如何在 PowerShell 中编写函数或别名命令,以便 cd 可以做两件事: cd 给定的目录 ls 目录内容 编辑: 我需要的是这个: function ccd { param($pat
我有一个表格,其中填充了某些值,例如 | CODE | NAME | NB: THIS IS A VERY BASIC EXAMPLE | zygnc | oscar alpha |
所以表结构是这样的 CD id | Artist id 我想返回在此表中多次出现的艺术家,例如不止一张 CD。 我使用的是 Mysql,那么执行此操
This question already has answers here: Reference - What does this regex mean?
如果我们使用 cd bin,我们应该能够导航到 bin 文件夹。 那么bin目录前使用$的目的是什么?“cd $bin_dir” 请解释一下 最佳答案 $bin_dir 是环境变量(请阅读此处了解更多
我正在使用express generator 。运行生成器后,它输出以下内容: install dependencies: $ cd . && npm install cd .有什么意
我有一个旧程序可以从磁盘读取/翻录 CD/音乐数据。它是一个自定义程序,可以读取轨道数据并将其转换为 wma/wpa/wav 格式。然后用户输入如何获得许可,程序将数据和音乐文件提取到我们的 LAN。
我是一名优秀的程序员,十分优秀!