I have a pipeline for a nodejs and I need to pick up the version and add it as a tag to my newly built docker. To do this, I have a script something like this:
- step: &build-docker-and-push
name: Build docker image and repo upload
services:
- docker
caches:
- node
- docker
script:
- IMAGE="333333333333.dkr.ecr.af-xxxxxxx-1.amazonaws.com/node-js-repo"
- VERSION="$( cat package.json | grep version | head -1 | aws -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]' )"
- TAG="${VERSION}-${BITBUCKET_COMMIT}"
The error I receive when I want to start the pipeline is something like this:
There is a YAML syntax error in your bitbucket-pipelines.yml at [line 44, column 94]. To be precise: expected a comment or a line break, but found s(115)
and the line 45 is the `VERSION=...` - column may differ as this is a cleanned line. However, no matter how I format it, how I am trying to build the line, it always complains at my column (`-F:` sequence). I tried to build the line with `` and is the same.
If I randomly put a ":" sign in - let's say - next line, or whatever other similar line, is fine.
Not sure what I am doing wrong here. I tried to escape it, the ":" is inside the quota so it should not be considered as part of key ...
Can someone please point me where I should look at?
Thanks.