Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12201

How to check either of variable exist in the gitlab rules?

$
0
0

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

Viewing all articles
Browse latest Browse all 12201

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>