Google Cloud Build - 结果不会跨步骤保存

Google Cloud Build - Results doesn't save across steps

我使用 Remote builder 社区图像从内部 GC ComputeEngine 实例下载一些受保护的依赖项。

cloudbuild.yaml 中的这一步看起来像:

steps:
- name: gcr.io/{PROJECT_NAME}/remote-builder
  env:
  - COMMAND=sudo bash workspace/build.bash
  - ZONE=us-east1-b
  - INSTANCE_NAME=remote-cloud-build
  - INSTANCE_ARGS=--image-project centos-cloud --image-family centos-7

build.bash:

easy_install pip
pip install --upgrade pip
pip install --upgrade setuptools
pip wheel  -r workspace/requirements.txt -w workspace/requirements --no-binary :all:

所以我将我的库复制到 workspace/requirements 文件夹。
但是在接下来的构建步骤中,此文件夹中没有文件。
我尝试在文件夹中创建空文件以进行测试,例如:touch workspace/requirements/file,但文件夹仍然是空的。
你能帮我解决一下吗? 提前致谢!

https://cloud.google.com/cloud-build/docs/create-custom-build-steps说明每一步都挂载了/workspace目录

我认为你在/workspace目录下,执行build.bash时,所以可能是你在workspace目录中生成了一个workspace目录: /workspace/workspace.

可以试试在workspace前面加一个/吗?

steps:
- name: gcr.io/{PROJECT_NAME}/remote-builder
  env:
  - COMMAND=sudo bash /workspace/build.bash
  - ZONE=us-east1-b
  - INSTANCE_NAME=remote-cloud-build
  - INSTANCE_ARGS=--image-project centos-cloud --image-family centos-7

easy_install pip
pip install --upgrade pip
pip install --upgrade setuptools
pip wheel  -r /workspace/requirements.txt -w /workspace/requirements --no-binary :all: