I am tyring to set rule for deployment stage in gitlab-ci.yml file where if the git commit message is having a particular [STRING] in this format then it should deploy to that particular environment where this rule is written.
# Deploy to QAT environment
deploy-qat:
stage: deploy
extends: .helm_deploy
environment:
name: qat
tags:
- exe-prd
rules:
- if: $CI_COMMIT_MESSAGE =~ "/[QAT]$/|/[qat]$/" #&& $CI_COMMIT_REF_NAME == "example/qat"
when: always
I have wrote above rule however it is not working. I have tried below combinations of regular expressions however none of them are working.
"/\[QAT\]/|/\[qat\]/"
"/[QAT]/|/[qat]/"
"*\[QAT\]*|*\[qat\]*"
"\[\(QAT\|qat\)\]"
"\[\(QAT\|qat\)]"
"/\[(qat|QAT)\]/"
I tried following website for regular expression here which validates my requirement but it is not working inside gitlab-ci.yml file.