2

I'm trying to create annotated tag with POST /tags/

The tag appears without it, even with hardcode param (snippet below).

script:
    - git tag ${TAG} || true
    - git push origin ${TAG}
    - '#curl -X POST --header "PRIVATE-TOKEN: ${CI_TAG_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/tags?tag_name=${TAG}&ref=master&message=testtag" '

I suppose that the problem may happens cause I do not specify the message in the git tag -m, but if I try to do this, an error occurs:

Cannot autodetect email

Which is probably reasonable for the runner command.

How can I fix it?

Beso
  • 1,176
  • 5
  • 12
  • 26
akse
  • 21
  • 2

1 Answers1

0

That should be easier to go with GitLab 15.1 (June 2022)

Create annotated tags with the Releases API

Previously, you were only able to create lightweight tags when using the Releases API to create a release.

With this update, you can now add an optional tag_message parameter to create an annotated tag when creating a release.
This enables you to include relevant information along with the new tag, so downstream users and applications can have additional context.

See Documentation and Issue.

That is confirmed with GitLab 15.3 (August 2022):

Create annotated tags using the Release CLI

Previously, you were only able to create lightweight tags when using the GitLab Release CLI to create a release.

With this update, you can now add an optional tag-message parameter to create an annotated tag when creating a release.
This enables you to include relevant information along with the new tag so downstream users and application can have additional context.

See Documentation and Issue.

release-cli --server-url https://gitlab.com --job-token=SOME_JOB_TOKEN --project-id 12345 create help

Other approach, with GitLab 15.3 (August 2022):

Create annotated tags by using release:tag_message keyword

Create annotated tags by using release:tag_message keyword

You can now create an annotated tag when you create a release.
In the .gitlab-ci.yaml file, use the release keyword to include an optional tag_message subkey and specify a message.
This enables you to include relevant information along with the new tag, so downstream users and applications can have additional context.

See Documentation and Issue.


With GitLab 15.5 (October 2022):

Create annotated tags in the Releases page

You can now create annotated tags and add them to your releases in the Releases page. You can use annotated tags to provide downstream users and applications with additional information about a release.

https://about.gitlab.com/images/15_5/release-create-annotated-tag.png -- Create annotated tags in the Releases page

See Documentation and Issue.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250