CI - different deploy jobs in same project get different runner variables from GitLab

Hey.

I have a GitLab project structure as follows:

[Organization] > [Sub-Project] > [Backend, Frontend]

Organization has runner variables for deployment to Rancher.
Sub-Project also runner variables with the same name but different values.

My deployment script has a deploy stage which is split into two:

deploy_dev (development)
deploy_stg (staging)

When running the pipeline, I’m running into a blocking issue. “deploy_dev” gets its runner variables from [Organization] while “deploy_stg” gets its variables from [Sub-Project] but I can’t figure out why.

Is this a bug? Am I doing something wrong?

Fixed it. I was using protected variables wrong - I finally read the documentation of protected variables and figured out what was going on.

I had flagged the variables in [Sub-Project] protected.

Deploy to staging succeeded cause it was using a protected branch (master) and had access to protected variables. Deploy to develop failed because the develop branch was not protected.

1 Like