gitlabgitlab-ci

Use variable in manual_confirmation for Gitlab Job


I am trying to use a pipeline varibale in the manual_confirmation for a manual Gitlab job. But the dialog is only showing the name of the variable, not it's value.

Am I missing something?

Here the important parts of my Gitlab CI file:

variables:
  MY_VARIABLE: bar

create_release_candidate:
  stage: release
  rules: 
    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ $FINAL_RELEASE_COMMIT_REGEX
    when: manual
  manual_confirmation: '$MY_VARIABLE'
  script:
    - foo ...

This is the result:

enter image description here

The Gitlab docs page shows that it should be possible to use a variable there. https://docs.gitlab.com/ee/ci/yaml/#manual_confirmation.

But even if I use one of Gitlabs predefined variables (such as $CI_COMMIT_MESSAGE) it does not work.

We are on Gitlab 17.5.1


Solution

  • I had the same problem. It looks like the feature has been reverted and is waiting for a new implementation (as of november 2024):

    Relevant issue: https://gitlab.com/gitlab-org/gitlab/-/issues/468971

    Merge revert: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/167059