4

Why is this line in my gitlab CI configuration invalid? did not find expected alphabetic or numeric character while scanning an anchor

script:
  - [ ! -z $(docker images -q $IMAGE1) ] && docker tag $IMAGE1 $IMAGE2

How should I modify this line?

I need to check if the image exists before creating a tag for that image. If it doesn't exists, this line should be skipped, but the CI should go on...

1 Answer 1

5

You need to quote the command:

script:
  - "[ ! -z $(docker images -q $IMAGE1) ] && docker tag $IMAGE1 $IMAGE2"
1
  • Why (or when) do I have to quote? Commented Mar 29, 2018 at 10:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.