Protected Variables not available in manual jobs
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
Protected variables are not available when running a manual pipeline job on a protected branch.
Steps to reproduce
- Create a variable and mark it as protected
- Have a protected branch
- Create CI/CD script like the one below
- Run the pipeline
What is the current bug behavior?
The if statement in below snippet will always be false. When the job is not marked as manual, it will always succeed.
What is the expected correct behavior?
The job should be able to access the environment variable when the job is manual.
Results of GitLab environment info
GitLab Community Edition 14.7.3
Example CI/CD file
stages:
- testing
variable-test:
stage: testing
when: manual
script:
- echo "STARTING"
- if [ -n $PROTECTED_VAR ]; echo "printing var $PROTECTED_VAR"; fi;
- echo "ENDING"
Edited by 🤖 GitLab Bot 🤖