My yq is kinda throwing a tantrum in my gitlab-ci.yaml. The version of yq within the shell of my gitlab server is 4.16.2 and my local version where I test it is 4.35.2.
According to Official yq docs I am indeed using the correct syntax. I mean it works locally, it just doesnt work on my gitlab server for some reason eventho both have yq version 4.x.x
My gitlab-ci code where this happens looks as follows:
$ if [ $AUTH_ENABLED = true ];
then yq eval -i '.data.auth = "'$SECRET'" ' secret.yaml;
else yq -i 'del(.data)' secret.yaml; fi
And then it throws: Error: unknown command "del(.data)" for "yq"
I'm not sure if I'm missing something here but I just can't figure out what the issue here is.
With mikefarah's yq version v4.18.1 "eval is now the default command, you can leave it out". With versions prior to it, including 4.16.2, you have to provide the eval
(or e
) command. So, change
else yq -i 'del(.data)' secret.yaml
to
else yq -i eval 'del(.data)' secret.yaml
or
else yq -i e 'del(.data)' secret.yaml
Just like you did with the command in the then
branch.