Environment Variable being ignored when set in `rules:changes`
Summary
When setting an environment variable as a path and using that variable in rules:changes, the variable is ignored.
Steps to reproduce
-
Create a env variable named
HELM_DIR
and set it to 'helm' in the UI. -
Create a project that contains
helm/test.txt
-
Add the below
gitlab-ci.yml
script to the project:
test0:
script:
- echo "This is test0 and will complete"
- echo $CI_COMMIT_BRANCH
- echo $CI_PROJECT_DIR
test1:
script:
- echo $CI_COMMIT_BRANCH
- echo $CI_PROJECT_DIR
- echo $HELM_DIR
- echo "This is working"
- ls
rules:
- if: $CI_COMMIT_BRANCH
changes:
- $HELM_DIR/**/*
when: on_success
- Make a change to the
helm/test.txt
file or any file in that folder.
The below works when explicitly setting the file path:
test0:
script:
- echo "This is test0 and will complete"
- echo $CI_COMMIT_BRANCH
- echo $CI_PROJECT_DIR
test1:
script:
- echo $CI_COMMIT_BRANCH
- echo $CI_PROJECT_DIR
- echo "This is working"
- ls
rules:
- if: $CI_COMMIT_BRANCH
changes:
- helm/**/*
when: on_success
Example Project
https://gitlab.com/ehenley/rules_changes (Private project)
Was able to recreate this on self-managed and on .com.
What is the current bug behavior?
When setting a path as an env variable, and using the env in rules:changes
, the path is never evaluated.
What is the expected correct behavior?
The env variable should act the same as explicitly setting the path in the ci.
Edited by Eldridge Henley