1

In my gitlab ci/cd script , we are using rules

workflow:
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH == "developer" || $CI_COMMIT_BRANCH == "stage"|| ($CI_COMMIT_BRANCH =~ (/^([A-Z]([0-9][-_])?)?SPRINT(([-_][A-Z][0-9])?)+/i))
      when: always
    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH != "developer" || $CI_COMMIT_BRANCH != "stage"|| ($CI_COMMIT_BRANCH !~ (/^([A-Z]([0-9][-_])?)?SPRINT(([-_][A-Z][0-9])?)+/i))
      when: never 

for specific job , we are using only

only:
  - developer
  - stage

FINE. but I want the scenerio like

only:
  - developer
  - stage
  - (/^([A-Z]([0-9][-_])?)?SPRINT(([-_][A-Z][0-9])?)+/i))

the sprint which I used is not working . If I use "rules" , its working , but I want "only" to be used in my script . Please help me to sort it out this.

torek
  • 448,244
  • 59
  • 642
  • 775
Cyril I
  • 273
  • 3
  • 16

1 Answers1

1

An only: directove does support regular expressions that match against branch names.

But the syntax is like /^feature-.*/, so check if the outer () are in the way.

Plus, there seems to be an imbalance in the 5 ( vs. 6 ).

So either:

 (/^([A-Z]([0-9][-_])?)?SPRINT(([-_][A-Z][0-9])?)+/i)

Or

 /^([A-Z]([0-9][-_])?)?SPRINT(([-_][A-Z][0-9])?)+/i
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • https://stackoverflow.com/questions/72216766/how-do-i-use-docker-environment-variable-in-entrypoint-array-issue-facing-in-ku?noredirect=1#comment127596994_72216766 please help me to sort this out – Cyril I May 13 '22 at 07:29
  • @CyrilI Didn't sytech's comment already answered the question? – VonC May 13 '22 at 07:45
  • @sytech just ask me , this is related to this problem or not! .Please look in to that issue. If you have an idea, Please help me to sort it out this – Cyril I May 13 '22 at 08:05