Please help fill in this template with all the details to help others help you more efficiently. Use formatting blocks for code, config, logs and ensure to remove sensitive data.
Problem to solve
In our CI/CD configuration we use a release-job with the release keyword. We are currently migrating our configuration from a Windows CMD shell to Windows Powershell, but the powershell commands generated by the release-job fail with RuntimeExceptions:
Translation for the german error messages:
- It is not possible to index into a NULL-array
- “1.53.0” could not be compared to “version”. Error: "The value “System.Version” of type “System.RuntimeType” cannot be converted into type “System.Version”
It appears there is a problem with the regex-pattern which tries to match the GitLab CLI version. In the screenshot it is given as 'd+.d+.d+' when it should be '\d+\.\d+\.\d+', it is missing the backslash characters used by powershell regex’s for some special groups/characters (as can be seen here on line 67). Is this an issue within GitLab or is it the result of how we have configured GitLab and our runner? Our self-hosted/local runner is configured with a “shell” executor and “powershell” as the shell. We have the GitLab CLI glab (version 1.55.0) installed to get access to the release keyword in our pipelines.
Configuration
Add the CI/CD configuration from .gitlab-ci.yml and other configuration if relevant (e.g. docker-compose.yml). Alternatively, create a public GitLab.com example project that provides all necessary files to reproduce the question.
.release_rules:
rules:
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v(\d+\.)?(\d+\.)?(\d+)$/'
when: on_success
variables:
SW_VERSION: $CI_COMMIT_TAG
variables:
REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}"
# other jobs are omitted
release-job:
stage: release
needs: [upload-job]
rules:
- !reference [.release_rules, rules]
script:
- echo "running release job for $CI_COMMIT_TAG"
release:
tag_name: $CI_COMMIT_TAG
description: 'Created using the glab cli'
ref: $CI_COMMIT_SHORT_SHA
assets:
links:
- name: 'fw_$CI_COMMIT_TAG-$CI_COMMIT_SHORT_SHA.hex'
url: '$REGISTRY_URL/$CI_COMMIT_TAG/fw_$CI_COMMIT_TAG-$CI_COMMIT_SHORT_SHA.hex'
- name: 'release_artifacts_$CI_COMMIT_TAG-$CI_COMMIT_SHORT_SHA.zip'
url: '$REGISTRY_URL/$CI_COMMIT_TAG/release_artifacts_$CI_COMMIT_TAG-$CI_COMMIT_SHORT_SHA.zip'
Versions
Please select whether options apply, and add the version information.
- Self-managed
-
GitLab.comSaaS - Dedicated
- Self-hosted Runners
Versions
- GitLab Enterprise Edition 18.0.0-pre 7bc690727ee
- GitLab Runner 17.10.1 (ef334dcc)
