GitLab Release CLI tool (deprecated)
This feature was deprecated in GitLab 18.0 and is planned for removal in 20.0. Use the GitLab CLI instead.
This change is a breaking change.
Migrate from release-cli to glab CLI
To migrate from release-cli to glab CLI, update one of the following based on your job’s configuration:
If your job uses the
releasekeyword, update to use thecli:latestimage:release_job: stage: release image: registry.gitlab.com/gitlab-org/cli:latest rules: - if: $CI_COMMIT_TAG script: - echo "Running the release job." release: tag_name: $CI_COMMIT_TAG name: 'Release $CI_COMMIT_TAG' description: 'Release created using the CLI.'For more information, see
release.If your job uses
release-clicommands inscriptblocks, update to useglab release createand configure authentication for the Releases API.
Authenticate with the CI/CD job token
To authenticate with CI_JOB_TOKEN, set GLAB_ENABLE_CI_AUTOLOGIN to true.
The glab CLI sends CI_JOB_TOKEN in the JOB-TOKEN header, which the Releases API accepts.
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/cli:latest
rules:
- if: $CI_COMMIT_TAG
variables:
GLAB_ENABLE_CI_AUTOLOGIN: "true"
script:
- |
glab release create "$CI_COMMIT_TAG" \
--name "Release $CI_COMMIT_TAG" \
--notes "Release created with glab."Authenticate with an access token
To authenticate with a personal,
project, or
group access token,
set GITLAB_TOKEN to your access token.
The token must have the api scope.
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/cli:latest
rules:
- if: $CI_COMMIT_TAG
variables:
GITLAB_TOKEN: $RELEASE_ACCESS_TOKEN
script:
- |
glab release create "$CI_COMMIT_TAG" \
--name "Release $CI_COMMIT_TAG" \
--notes "Release created with glab."Do not set GITLAB_TOKEN to $CI_JOB_TOKEN.
The glab CLI sends GITLAB_TOKEN in the PRIVATE-TOKEN header, but the Releases API only accepts a job token in the JOB-TOKEN header.
This combination returns 404 Not Found.
To authenticate with the CI/CD job token, set GLAB_ENABLE_CI_AUTOLOGIN to true instead.
For a full list of options, see the
glab release create command reference.
Fall back to release-cli
CI/CD jobs that use the release keyword use a script that falls back to using release-cli
if the required glab version is not available on the runner. The fallback logic
is a safe-guard to ensure that projects that have not yet migrated to use glab CLI
can continue working.
This fallback is scheduled to be removed
in GitLab 20.0 with the removal of release-cli.