On Sat, Mar 27, 2021 at 9:37 AM Niels Möller nisse@lysator.liu.se wrote:
Maamoun TK maamoun.tk@googlemail.com writes:
only: variables: - $S390X_SSH_IP_ADDRESS - $S390X_SSH_PRIVATE_KEY - $S390X_SSH_CI_DIRECTORY
What does this mean? Ah, it excludes the job if these variables aren't set?
Yes, this is what it does according to gitlab ci docs https://docs.gitlab.com/ee/ci/yaml/#onlyexcept-basic. otherwise, fresh forks will have always-unsuccessful job.
Hmm, docs aren't quite clear, but it doesn't seem to work as is. I accidentally set the new S390X_ACCOUNT varable to "protected", and then the job was started but with $S390X_ACCOUNT expanding to the empty string, and failing.. Perhaps it needs to be written as
- $FOO != ""
instead?
This doc https://docs.gitlab.com/ee/ci/variables/#syntax-of-cicd-variable-expressions looks more clear, according to this doc we check variable presence correctly, it checks if the variable is defined and non-empty. I think it's some sort of bug. However, you can try $S390X_ACCOUNT != null which just checks if the variable is defined.
regards, Mamone