Open PigeonF opened 3 weeks ago
These works.
mjn@mjn-laptop:~/workspace/gitlab-com-ci-debugging$ GCL_TIMESTAMPS=false gitlab-ci-local
parsing and downloads finished in 57 ms
json schema validated in 177 ms
test starting shell (test)
test $ echo hello
test > hello
test finished in 48 ms
PASS test
pipeline finished in 361 ms
mjn@mjn-laptop:~/workspace/gitlab-com-ci-debugging$ GCL_TIMESTAMPS=true gitlab-ci-local
parsing and downloads finished in 55 ms
json schema validated in 183 ms
[07:03:44 2 ms] test starting shell (test)
[07:03:44 13 ms] test $ echo hello
[07:03:44 15 ms] test > hello
[07:03:44 16 ms] test finished in 16 ms
PASS [ 16 ms] test
pipeline finished in 325 ms
But .gitlab-ci-local-env parsing is definently broken
mjn@mjn-laptop:~/workspace/gitlab-com-ci-debugging$ echo "TIMESTAMPS=false" > .gitlab-ci-local-env && gitlab-ci-local
parsing and downloads finished in 57 ms
json schema validated in 175 ms
[07:04:17 1.76 ms] test starting shell (test)
[07:04:17 12 ms] test $ echo hello
[07:04:17 12 ms] test > hello
[07:04:17 14 ms] test finished in 14 ms
PASS [ 14 ms] test
pipeline finished in 313 ms
Minimal .gitlab-ci.yml illustrating the issue
(Note that I use
TIMESTAMPS
here because it is much easier to show thanUMASK
, which is what I actually wanted to set 😅 )I'm pretty sure the issue is that
injectDotenv
sets string values onlyhttps://github.com/firecow/gitlab-ci-local/blob/428ca66c8300f3bc64c89cf864e5052e44c58c37/src/argv.ts#L64-L69
which means that when boolean properties are read, the returned value is not a boolean, but a string (i.e. not
false
, but"false"
), which evaluates totrue
, as it is a non-empty string.https://github.com/firecow/gitlab-ci-local/blob/428ca66c8300f3bc64c89cf864e5052e44c58c37/src/argv.ts#L229-L231
The easiest solution is probably to check if the map value is a bool or a string, and if it is a string compare against "true" (
yargs
environment overrides seem to only work withtrue
, not variations likeTRUE
or1
).