Strange behaviour of the variables in the pipeline

Hello,
one of my pipeline depends on the variables that are passed from the scheduler.

With the develop branch everything works fine, however if I move to RC suddenly the variable that is empty cases job to run.

The sample yaml code:

When I run for default branch - it works as expected:

But when I do not run for the default brach it is weird - it includes the variable as it would be set somehow:

Can anyone explain what is going here?

Thanks in advance!

Hi @kamil.kliczbor

I’m not really sure how sophisticated the CI lint is, but I’m not completely sure that it’s as accurate as you’re hoping here. What behaviour are you seeing in “real” pipelines?

@snim2 as already mentioned, it seems that variable SMOKE_TESTS used in the rules section of the job smoke-tests-job allows to run the run-smokes job even though it is called with the SMOKE_TESTS variable set to empty. I would expect that smoke-tests-job due to rules statement blocks the job run-smokes from being run. Unfortunately it is not.

OK, but that variable can also be set in a number of other ways. Either in a scheduled pipeline via the UI, or in the CI/CD variables in the settings of the project or potentially in the environment of the runner.

The pipeline is run by the rule of the workflow. The rule is set to run the pipeline for develop or RC, but it does not set the variable anyway.
The variable is only set by the scheduler but in this case it is not triggered by it.

Hmm! I’d be inclined to do two things here. Firstly, I’d put echo $SMOKE_TESTS somewhere in your jobs, just to check what that variable holds.

Also, I’d make your rules more explicit, as I’d expect on_success to be the default rule:

.smoke-tests-job-template: &smoke-tests-job
    rules:
        - if: $SMOKE_TESTS
          when: on_success
        - when: never

Hi,
I could finally put these lines into the project build definition. It seems that this helped. Thank you!

kind regards,
Kamil

1 Like