0

I have a GCP Cloub build configuration, where a bash script is needed to be executed.

The below configuration works just fine.

steps:
  - name: 'gcr.io/cloud-builders/gcloud'
    entrypoint: 'bash'
    args: ['./my_script.sh']

But, I want to be able to pass the Build_ID as an argument to the bash script. e.g.:

steps:
  - name: 'gcr.io/cloud-builders/gcloud'
    entrypoint: 'bash'
    args: ['./my_script.sh ${BUILD_ID}']

This doesn't work, unfortunately.

I get an error such as: bash: ./my_script.sh 204792d1-6336-489b-ba20-fbce7401a40b: No such file or directory

Any help on this is highly appreciated.

1 Answer 1

3
Answer recommended by Google Cloud Collective

Try to parametrize arguments, with:

steps:
  - name: 'gcr.io/cloud-builders/gcloud'
    entrypoint: 'bash'
    args: ['./my_script.sh', '${BUILD_ID}']
Sign up to request clarification or add additional context in comments.

1 Comment

Amazing!! This works. Thank you very much, it's a life saver!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.