I’m facing this problem that sounded simple but cannot find my way around it:
I have project A with branches A1 and A2, project B with branches B1 and B2
I’m adding a trigger job in Project A that will execute one of B’s Job before carrying on
But I need Project B to run on branch B1 if pipeline is running on branch A1 and B2 if A2. So I need a piece of logic (script) to change the “branch” value of the “trigger” keyword.
However there is no kind of “script” keyword on Trigger jobs, I can use variables but I cannot find a way to edit that variable prior to this trigger job being run.
I could do with an API Call but then I’m unable to use “strategy:depend”
So far all I have is:
- PROJECT_B_BRANCH: $CI_COMMIT_REF_NAME
The simple script logic would be
if [ "$CI_COMMIT_REF_NAME" == "A1" ]; then PROJECT_B_BRANCH == "B1"; else; PROJECT_B_BRANCH == "B2"; fi
Where/how could I inject that script conditional logic to transform $PROJECT_B_BRANCH value from “A1” to “B1”?
I’ve been through the documentation multiple times for ideas but could not find it
This could seem easy but I keep failing at finding a rather simple solution
Thank you very much for any kind of suggestion or advice!