Bug with quotes in quotes and scripts
Hi,
I have the following in my gitlab-ci.yml (I removed what I think are unimportant lines):
variables:
MVN: "mvn --errors -B -U -Dmaven.repo.local=m2cache"
MVN_BUILD: "$MVN -Pjacoco -DaltDeploymentRepository='staging::default::file:staging'"
...
build-test-backend:
<<: *mvn-java-8
stage: build
script:
- "apk update && apk add git"
- "git clone --depth 1 https://github.com/victornoel/jersey-pac4j"
- "echo MVN_BUILD=$MVN_BUILD"
- "$MVN_BUILD clean deploy"
- "$MVN_BUILD -f jersey-pac4j clean deploy"
- "$MVN_BUILD -f backend clean deploy"
- "ls"
artifacts:
paths:
- staging
And when I look at the logs, I see the following:
$ echo MVN_BUILD=$MVN_BUILD
MVN_BUILD=mvn --errors -B -U -Dmaven.repo.local=m2cache -Pjacoco -DaltDeploymentRepository='staging::default::file:staging'
...
[INFO] Using alternate deployment repository 'staging::default::file:staging'
And the thing is that there should be written: Using alternate deployment repository staging::default::file:staging
without the quotes (that's what actually happens locally on my machine if I execute the same command.
In this particular case, it is unfortunate because it creates a directory named staging'
instead of staging
(that's how I realised there was something fishy :).
I guess I can mitigate this problem by not using quotes (I don't really need to in this specific case), but I guess there is other cases where it could be problematic.