Skip to content

Expose `:release` yaml as steps via API

Problem to solve

The :release yaml needs to be converted a command line that the releaser-cli understands.

The Runner will pass the command line to the releaser-cli via the REST API in a new format for steps.

Feature flag

This is all currently behind the :ci_release_generation feature flag.

Intended users

Proposal

  • Convert the :release yaml to a releaser-cli command line
  • Expose Release steps via the API

Convert the :release yaml to a releaser-cli command line

In it's current form, the releaser-cli understands yaml in this form (under the :release node):

release_job: {
  stage: 'release',
  only: 'tags',
  script: ['make changelog | tee release_changelog.txt'],
  release: {
     name: 'Release $CI_COMMIT_SHA',
     description: 'Created using the release-cli $EXTRA_DESCRIPTION',
     tag_name: 'release-$CI_COMMIT_SHA',
     ref: '$CI_COMMIT_SHA'
  }

This produces the following command line:

release-cli create --name "Release $CI_COMMIT_SHA" --description "Created using the release-cli $EXTRA_DESCRIPTION" --tag-name "release-$CI_COMMIT_SHA" --ref "$CI_COMMIT_SHA"

This issue does not cover the extended yaml for binary assets (not currently supported by the releaser-cli).

Expose Release steps via the API

Currently the API exposes only the script and after_script steps, i.e. it is possible to called the releaser-cli like this:

{
    "steps": [
        {
            "name": "script",
            "script": [
                "job script",
                "release-cli create --name \"Release $CI_COMMIT_SHA\" --description \"Created using the release-cli $EXTRA_DESCRIPTION\" --tag-name \"release-$CI_COMMIT_SHA\" --ref \"$CI_COMMIT_SHA\""
            ] 
        }
    ]
}

Going forward we can name the steps, in this the step would be named release:

{
    "steps": [
        {
            "name": "script",
            "script": [...] 
        },
        {
            "name": "release",
            "script": [
                "release-cli create --name \"Release $CI_COMMIT_SHA\" --description \"Created using the release-cli $EXTRA_DESCRIPTION\" --tag-name \"release-$CI_COMMIT_SHA\" --ref \"$CI_COMMIT_SHA\""
            ]
        }
    ]
}

Permissions and Security

Existing permissions apply - access is via $CI_JOB_TOKEN

Edited by Jaime Martinez