0

I need to pass the output of file to docker command as an argument. I know that $TAG_NAME is already avaliable, i have my value in a file which is dynamic. Is there a way we can access the file and pass it in docker run step.

cat /workspace/tagvalue.txt

My steps:

- name: 'gcr.io/cloud-builders/docker'
    args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/${_IMAGE_NAME}:${TAG}', '-f' ,'${_DOCKER_FILE}', '.' ]

Somehow need to output the cat to TAG variable

kavya
  • 75
  • 1
  • 10

1 Answers1

0

You can obtain the value from file like this

echo $(<tag.txt) | tr -d '\n'

Here echo will print the value with additional new line. We need to run tr command on the output to remove trailing newline.

madhu
  • 51
  • 4