The variable in the rules is not being substituted to "Debug" when the job is run.
The pipeline job is following...
variables:
OBJECTS_DIRECTORY: obj
NUGET_PACKAGES_DIRECTORY: ".nuget"
SOURCE_PATH: src/
build:
image: mcr.microsoft.com/dotnet/sdk:6.0
tags:
- fms
variables:
DEPLOY_CONFIGURATION: "Release"
script:
- echo "Branch => $CI_COMMIT_REF_NAME"
- echo "building with configuration => $DEPLOY_CONFIGURATION"
- |
for project in $(find . -type f -name "*.csproj"); do
echo "Running build for $project"
dotnet build --configuration $DEPLOY_CONFIGURATION
done
extends: ".dotnet-build"
cache:
key:
files:
- "$SOURCE_PATH$OBJECTS_DIRECTORY/project-assets.json"
- "$SOURCE_PATH$OBJECTS_DIRECTORY/*.csproj.nuget.*"
prefix: "$CI_COMMIT_REF_SLUG"
paths:
- "$SOURCE_PATH$OBJECTS_DIRECTORY/project-assets.json"
- "$SOURCE_PATH$OBJECTS_DIRECTORY/*.csproj.nuget.*"
- "$NUGET_PACKAGES_DIRECTORY"
policy: pull-push
unprotect: false
untracked: false
stage: build
before_script:
- dotnet restore --packages $NUGET_PACKAGES_DIRECTORY
rules:
- if: "$CI_COMMIT_REF_NAME =~ /^develop$|^feature\\/[0-9A-Za-z_-\\+\\.]+$/"
variables:
DEPLOY_CONFIGURATION: "Debug"
The branch is feature/pipeline and the jobs with "Release" not matter what. The Gitlab documentation says otherwise.
I am using GitLab Enterprise Edition 15.11.6-ee.
Here is the output when the job starts...
$ echo "Branch => $CI_COMMIT_REF_NAME"
Branch => feature/pipeline
$ echo "building with configuration => $DEPLOY_CONFIGURATION"
building with configuration => Release
I am testing locally with a Gitlab-runner
Runtime platform arch=amd64 os=darwin pid=85068 revision=85586bd1 version=16.0.2