【发布时间】:2019-10-14 23:31:33
【问题描述】:
我正在使用带有 git 工具构建器的 Google Cloud Build,并尝试将 git-diff 的输出保存到文件中。然后在后面的步骤中,我想cat 文件。但是,该文件始终为空,我怀疑 git-diff 没有输出任何结果。
- name: 'gcr.io/cloud-builders/git'
entrypoint: /bin/bash
args:
- -c
- |
git diff-tree --name-only --no-commit-id -r $SHORT_SHA > /workspace/files.txt
- name: 'gcr.io/cloud-builders/git'
entrypoint: /bin/bash
args:
- -c
- |
echo "File contents " $(cat /workspace/files.txt)
另外,我尝试在不使用 bash shell 的情况下运行该步骤,但在 Cloud Build 日志中仍然看不到任何输出
- name: 'gcr.io/cloud-builders/git'
args: ['diff-tree', '--name-only', '--no-commit-id', '-r', '$SHORT_SHA']
有什么想法吗?
【问题讨论】: