Hello Gitlab’ers.
I am currently working on a project that does the following:
-
When a model in one repo is updated it will:
a. Kick off an automation tool to build and update the model in our infra when a new commit has happened.
b. The project is another separate project, though in our same account/hierarchy of our Gitlab account.
c. The environment variable I am passing is the CI_PROJECT_NAME -
The automation tool repo should then take in that trigger and run the stage/build/deploy based on the name of the repo (i.e. CI_PROJECT_NAME)
My project A (model repo) has the following CI config:
stages: # List of stages for jobs, and their order of execution
#- build
#- test ## Should add a test step on the model in the future to ensure it is working before it is built and deployed
- deploy
trigger_model_update_pipeline:
stage: deploy
script:
- 'curl -X POST --fail -F token=$AUTOMATION_TOOLS_TRIGGER_TOKEN -F "ref=main" -F "variables[CI_PROJECT_NAME]=true" "https://gitlab.com/api/v4/projects/36457098/trigger/pipeline"'
#Run pipline merge test
My Project B trigger pipeline confiiguration
stages: # List of stages for jobs, and their order of execution
# - build
- test
# - deploy
unit-test-job:
stage: test
variables:
PROJECT_NAME: $CI_PROJECT_NAME
script:
- echo "Verify I get the project name from the model"
- echo "$PROJECT_NAME"
Right now I am just trying to verify I actually have the environment variable to work with with the trigger. I have also tried just echo $CI_PROJECT_NAME
They both run but I don’t see any ENV outputting when the trigger on Project B is run. What am I doing wrong here?