I have a gitlab rule condition like below.
'$ACTION && $REGION && $ROLE_ARN && $PACKAGEURL && $ACTION == "new" && $CLOUD_PLATFORM == "aws" && $ROLE_ARN != "" && $PACKAGEURL != "" && $REGION != ""'
Want to modify it a bit so that, it should check either the existence of PACKAGEURL or BUILDRPMREQUIRED above.
Tried keeping as below but getting run even if the PACKAGEURL or BUILDRPMREQUIRED not provided.
'$ACTION && $REGION && $ROLE_ARN && ($PACKAGEURL || $BUILDRPMREQUIRED) && $ACTION == "new" && $CLOUD_PLATFORM == "aws" && $ROLE_ARN != "" && ($PACKAGEURL != "" || $BUILDRPMREQUIRED != "") && $REGION != ""'
I kept in rule as below.
.ifawsfulldeploy:
rules:
- if: '$ADMIN_SERVER_IP && $ADMIN_SERVER_IP != ""'
when: never
- if: '$ACTION && $REGION && $ROLE_ARN && ($PACKAGE_URL || $BUILDRPMREQUIRED) && $ACTION == "new" && $CLOUD_PLATFORM == "aws" && $ROLE_ARN != "" && ($PACKAGE_URL != "" || $BUILDRPMREQUIRED != "") && $REGION != ""'
when: always
Other rules should be there, with only variables I am getting syntax error.
.ifawsfulldeploy:
rules:
- if: '$ADMIN_SERVER_IP && $ADMIN_SERVER_IP != ""'
when: never
- if: '$ACTION && $REGION && $ROLE_ARN && ( $PACKAGE_URL || $BUILDRPMREQUIRED ) && $ACTION == "new" && $CLOUD_PLATFORM == "aws" && $ROLE_ARN != "" && ( $PACKAGE_URL != "" || $BUILDRPMREQUIRED != "" ) && $REGION != ""'
when: always
And in my job.
only:
variables:
- $PACKAGE_URL
- $BUILDRPMREQUIRED
extends:
- .ifawsfulldeploy