I am creating a pipeline with two request parameters.
Sample script as given below
stages: # List of stages for jobs, and their order of execution
- download
- execute
variables:
# Input variables
BRANCH_REFERENCE:
value: ""
description: "This variable will hold value for Branch Reference"
RELEASE_TYPE:
value: ""
description: "Release Type"
RUNNER_TAG: "wave"
TEST_VAR: "TEST"
workflow:
rules:
- if: $BRANCH_REFERENCE == "dev"
variables:
RUNNER_TAG: "wave-dev"
when: always
- if: $BRANCH_REFERENCE == "prd"
variables:
RUNNER_TAG: "wave-prd"
- if: $RELEASE_TYPE == "pplus"
variables:
TEST_VAR: "product_plus.tar.gz"
when: always
- if: $RELEASE_TYPE == "pmod"
variables:
TEST_VAR: "product.tar.gz"
when: always
- when: always
download-job:
stage: download
script:
- echo "Download Stage Starts"
- echo ${TEST_VAR}
- echo ${RUNNER_TAG}
- echo "Download Stage Ends"
tags:
- $RUNNER_TAG
execute-job:
stage: execute
script:
- echo "Execute Stage Starts"
- echo ${TEST_VAR}
- echo ${RUNNER_TAG}
- echo "Execute Stage Ends"
tags:
- $RUNNER_TAG
Based on the input parameters I have to set some variable values. For that I have tried to use workflow rules but it is not working as per my requirement.
e.g. Below are the input parameters
BRANCH_REFERENCE = dev
RELEASE_TYPE= pplus
so for this case the value of the RUNNER_TAG should set to “wave-dev” and TEST_VAR to “product_plus.tar.gz”.
But it is working as, if first condition satisfied then rest of the if conditions get failed.
So, is it possible to use Workflow rules for such scenarios ? If no, then is there any another way to achieve this ?
Thanks.