0

I have below code:

build:
  stage: build
  rules: 
    - if: '$CI_COMMIT_TAG =~ /RELEASE/ && $CI_COMMIT_TAG =~ $CI_JOB_NAME'
      when: always  
  tags:
    - test_ios_msb
  script: 
    - echo $CI_COMMIT_REF_NAME
    - echo $CI_COMMIT_BRANCH
    - echo $CI_COMMIT_TAG
    - echo $CI_JOB_NAME 
    - echo $CI_PIPELINE_SOURCE
    - echo $CI_BUILD_TAG
    - echo "ok"

in this case the condition does not work if you specify this condition: - if: '$CI_COMMIT_TAG =~ /RELEASE/' or like this: - if: '$CI_COMMIT_TAG =~ $CI_JOB_NAME' then the condition works

Tell me how to solve the problem?

1 Answers1

0

I wonder about the RELEASE you have there. Why don't you try with /.*RELEASE.*/ instead?

Also, try removing the single quotes. Expansion does not occurs inside single quotes. See here.

RicHincapie
  • 3,275
  • 1
  • 18
  • 30
  • I have multiple builds for different stands, in order to run a specific build type, I pass a string in the Build_RELEASE-xxx tag, where Build is the stand that is being built for and RELEASE-xxx is the build type and build version if I put just the condition is if: ```'$CI_COMMIT_TAG =~ /RELEASE/'``` then it works without problems. I tried the option you suggested and it didn't work. – Матвей Васильев Jan 19 '22 at 07:20