태그 API

Tier: Free, Premium, Ultimate Offering: GitLab.com, Self-managed, GitLab Dedicated

프로젝트 리포지터리 태그 디렉터리

  • version 값은 GitLab 15.4에서 도입되었습니다.

프로젝트에서 리포지터리 태그 디렉터리을 가져와 최신 날짜 및 시간순으로 내림차순으로 정렬합니다.

note
리포지터리가 공개적으로 접근 가능하면 인증(--header "PRIVATE-TOKEN: <your_access_token>")이 필요하지 않습니다.
GET /projects/:id/repository/tags

매개변수:

속성 유형 필수 여부 설명
id 정수 또는 문자열 인증된 사용자가 소유한 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
order_by 문자열 아니오 태그를 name, updated, 또는 version으로 정렬하여 반환합니다. 기본값은 updated입니다.
sort 문자열 아니오 태그를 asc 또는 desc 순서로 반환합니다. 기본값은 desc입니다.
search 문자열 아니오 검색 기준과 일치하는 태그 디렉터리을 반환합니다. ^termterm$을 사용하여 각각 단어로 시작하고 끝나는 태그를 찾을 수 있습니다. 다른 정규 표현식은 지원되지 않습니다.
curl --header "PRIVATE-TOKEN: <your_access_token>" \
    --url "https://gitlab.example.com/api/v4/projects/5/repository/tags"

예시 응답:

[
  {
    "commit": {
      "id": "2695effb5807a22ff3d138d593fd856244e155e7",
      "short_id": "2695effb",
      "title": "Initial commit",
      "created_at": "2017-07-26T11:08:53.000+02:00",
      "parent_ids": [
        "2a4b78934375d7f53875269ffd4f45fd83a84ebe"
      ],
      "message": "Initial commit",
      "author_name": "John Smith",
      "author_email": "john@example.com",
      "authored_date": "2012-05-28T04:42:42-07:00",
      "committer_name": "Jack Smith",
      "committer_email": "jack@example.com",
      "committed_date": "2012-05-28T04:42:42-07:00"
    },
    "release": {
      "tag_name": "1.0.0",
      "description": "Amazing release. Wow"
    },
    "name": "v1.0.0",
    "target": "2695effb5807a22ff3d138d593fd856244e155e7",
    "message": null,
    "protected": true
  }
]

단일 리포지터리 태그 가져오기

이름으로 결정된 특정 리포지터리 태그를 가져옵니다. 이 엔드포인트는 리포지터리가 공개적으로 접근 가능한 경우 인증없이 액세스할 수 있습니다.

GET /projects/:id/repository/tags/:tag_name

매개변수:

속성 유형 필수 여부 설명
id 정수 또는 문자열 인증된 사용자가 소유한 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
tag_name 문자열 태그의 이름입니다.
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/repository/tags/v1.0.0"

예시 응답:

{
  "name": "v5.0.0",
  "message": null,
  "target": "60a8ff033665e1207714d6670fcd7b65304ec02f",
  "commit": {
    "id": "60a8ff033665e1207714d6670fcd7b65304ec02f",
    "short_id": "60a8ff03",
    "title": "Initial commit",
    "created_at": "2017-07-26T11:08:53.000+02:00",
    "parent_ids": [
      "f61c062ff8bcbdb00e0a1b3317a91aed6ceee06b"
    ],
    "message": "v5.0.0\n",
    "author_name": "Arthur Verschaeve",
    "author_email": "contact@arthurverschaeve.be",
    "authored_date": "2015-02-01T21:56:31.000+01:00",
    "committer_name": "Arthur Verschaeve",
    "committer_email": "contact@arthurverschaeve.be",
    "committed_date": "2015-02-01T21:56:31.000+01:00"
  },
  "release": null,
  "protected": false
}

새 태그 만들기

제공된 참조를 가리키는 리포지터리에 새 태그를 만듭니다.

POST /projects/:id/repository/tags

매개변수:

속성 유형 필수 여부 설명
id 정수 또는 문자열 인증된 사용자가 소유한 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
tag_name 문자열 태그의 이름입니다.
ref 문자열 커밋 SHA, 다른 태그 이름 또는 브랜치 이름에서 태그를 만듭니다.
message 문자열 아니오 주석이 달린 태그를 만듭니다.
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/repository/tags?tag_name=test&ref=main"

예시 응답:

{
  "commit": {
    "id": "2695effb5807a22ff3d138d593fd856244e155e7",
    "short_id": "2695effb",
    "title": "Initial commit",
    "created_at": "2017-07-26T11:08:53.000+02:00",
    "parent_ids": [
      "2a4b78934375d7f53875269ffd4f45fd83a84ebe"
    ],
    "message": "Initial commit",
    "author_name": "John Smith",
    "author_email": "john@example.com",
    "authored_date": "2012-05-28T04:42:42-07:00",
    "committer_name": "Jack Smith",
    "committer_email": "jack@example.com",
    "committed_date": "2012-05-28T04:42:42-07:00"
  },
  "release": null,
  "name": "v1.0.0",
  "target": "2695effb5807a22ff3d138d593fd856244e155e7",
  "message": null,
  "protected": false
}

생성된 태그의 유형에 따라 targetmessage의 내용이 결정됩니다:

  • 주석이 달린 태그의 경우 message에 주석이 포함되고 target에 태그 객체의 ID가 포함됩니다.
  • 가벼운 태그의 경우, message는 null이고 target에 커밋 ID가 포함됩니다.

오류는 설명적인 오류 메시지와 함께 상태 코드 405를 반환합니다.

태그 삭제

지정된 이름의 리포지터리 태그를 삭제합니다.

DELETE /projects/:id/repository/tags/:tag_name

매개변수:

속성 유형 필수 설명
id 정수 또는 문자열 인증된 사용자가 소유한 프로젝트의 ID 또는 URL-인코딩된 경로.
tag_name 문자열 태그의 이름입니다.

X.509 서명된 태그 가져오기

X.509 서명된 태그의 서명을 가져옵니다. 서명되지 않은 태그는 404 Not Found 응답을 반환합니다.

GET /projects/:id/repository/tags/:tag_name/signature

매개변수:

속성 유형 필수 설명
id 정수 또는 문자열 인증된 사용자가 소유한 프로젝트의 ID 또는 URL-인코딩된 경로.
tag_name 문자열 태그의 이름입니다.
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/repository/tags/v1.1.1/signature"

태그가 X.509로 서명된 경우 예시 응답:

{
  "signature_type": "X509",
  "verification_status": "unverified",
  "x509_certificate": {
    "id": 1,
    "subject": "CN=gitlab@example.org,OU=Example,O=World",
    "subject_key_identifier": "BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC",
    "email": "gitlab@example.org",
    "serial_number": 278969561018901340486471282831158785578,
    "certificate_status": "good",
    "x509_issuer": {
      "id": 1,
      "subject": "CN=PKI,OU=Example,O=World",
      "subject_key_identifier": "AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB",
      "crl_url": "http://example.com/pki.crl"
    }
  }
}

태그가 서명되지 않은 경우 예시 응답:

{
  "message": "404 GPG Signature Not Found"
}