Google Cloud Build:移动文件
Google Cloud Build: Moving files
我想将文件 index.js
从项目的根目录移动到 dist/project_name
。这是 cloudbuild.yaml
:
的步骤
- name: 'gcr.io/cloud-builders/docker'
entrypoint: /bin/bash
args: ['-c', 'mv', 'index.js', 'dist/project_name']
但是该步骤失败并出现下一个错误:
Already have image (with digest): gcr.io/cloud-builders/docker
mv: missing file operand
Try 'mv --help' for more information.
我该如何解决这个问题?
因为您正在使用 bash -c
,我认为您需要将整个“脚本”封装在一个字符串中:
args: ['-c', 'mv index.js dist/project_name']
我个人的偏好(仅此而已)是不在 YAML 中嵌入 JSON ([...]
)。这使得本例中的结果更清晰,并且更容易嵌入多行脚本:
args:
- bash
- -c
- |
mv index js dist/project_name
NOTE tools like YAMLlint will do this for you too.
我想将文件 index.js
从项目的根目录移动到 dist/project_name
。这是 cloudbuild.yaml
:
- name: 'gcr.io/cloud-builders/docker'
entrypoint: /bin/bash
args: ['-c', 'mv', 'index.js', 'dist/project_name']
但是该步骤失败并出现下一个错误:
Already have image (with digest): gcr.io/cloud-builders/docker
mv: missing file operand
Try 'mv --help' for more information.
我该如何解决这个问题?
因为您正在使用 bash -c
,我认为您需要将整个“脚本”封装在一个字符串中:
args: ['-c', 'mv index.js dist/project_name']
我个人的偏好(仅此而已)是不在 YAML 中嵌入 JSON ([...]
)。这使得本例中的结果更清晰,并且更容易嵌入多行脚本:
args:
- bash
- -c
- |
mv index js dist/project_name
NOTE tools like YAMLlint will do this for you too.