简体   繁体   中英

Google Cloud Container Builder share data between steps?

I need the short git commit sha (git rev-parse --short HEAD) for one of my build steps. I do not see any other way than to actually use the git builder, and then use the output in the docker build step. The below outputs what I need, and I would like to store that value in COMMIT_SHA_SHORT and use it in next build step. Is this possible somehow?

steps:
- name: 'gcr.io/cloud-builders/git'
  args: ['rev-parse', '--short', 'HEAD']

You can use Container Builder Custom Build [1].

A custom build step is a container image that the Container Builder worker VM pulls and runs with your source volume-mounted to /workspace. Your custom build step can execute any script or binary inside the container; as such, it can do anything a container can do.

[1] https://cloud.google.com/container-builder/docs/create-custom-build-steps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM