Written a below gitlab pipeline using python image and if condition works perfectly fine.
.chk-bracket:
image: "python:3.7"
before_script:
- apt update
- apt install jq -y
- pip install awscli
script:
- echo $CI_COMMIT_MESSAGE
- |
if [[ $CI_COMMIT_MESSAGE = *"_test"* ]]; then
echo "testing"
fi
rules:
- if: $CI_COMMIT_BRANCH =~ /^develop/ && $CI_COMMIT_MESSAGE =~ /.*build_test.*/
Later we refactored to use docker image instead of python image and the if condition started failing, it's not printing testing. Of course I simplified with the simple if condition in the original complex gitlab pipeline code
.chk-bracket:
image: "docker:stable"
before_script:
- apk update
- apk add py-pip jq bash
- pip install awscli
script:
- echo $CI_COMMIT_MESSAGE
- |
if [[ $CI_COMMIT_MESSAGE = *"_test"* ]]; then
echo "testing"
fi
rules:
- if: $CI_COMMIT_BRANCH =~ /^develop/ && $CI_COMMIT_MESSAGE =~ /.*build_test.*/
Any clues to why this condition is not working in docker image?