We have a Jenkinsfile that kicks off a docker-compose command. Jenkinsfile bit looks like this
sh("""docker-compose build \
--no-cache \
--build-arg DATE=${sh([returnStdout: true, script: "date -u +%Y%m%dT%H%M%SZ | tr -d '\n'"])} \
--build-arg VERSION=${sh([returnStdout: true, script: "git describe --tags --always"])} \
--build-arg SHA=${sh([returnStdout: true, script: "git rev-parse HEAD"])}""")
But when I run the build in Jenkins I see it logging out the command as
docker-compose build --no-cache --build-arg DATE=20190411T142851Z --build-arg VERSION=470a670
These are being passed in to set LABEL items in a Dockerfile. I've tried using Docker and setting the labels manually, but it also truncates afte rthe second label.
It will use the first two or three, regardless of what they are. Anything after those labels (or build-args for docker-compose) is chopped off and not used.
For example, the docker command used was this
sh("""docker build \
--no-cache \
--label com.<company>.name="Some stuff" \
--label com.<company>.build-date=${sh([returnStdout: true, script: "date -u +%Y%m%dT%H%M%SZ | tr -d '\n'"])} \
--label com.<company>.version=${sh([returnStdout: true, script: "git describe --tags --always"])} \
--label com.<company>.repo-sha=${sh([returnStdout: true, script: "git rev-parse HEAD"])} \
--tag ${folderName} \
.""")
and that led to this error
docker build --no-cache --label com.<company>.name='Some stuff' --label com.<company>.build-date=20190410T192516Z --label com.<company>.version=9bfbd1b
"docker build" requires exactly 1 argument.
It cut off the tag and the period for the directory.