태그 API

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

프로젝트 저장소 태그 목록

History
  • version value for the order_by attribute introduced in GitLab 15.4.

프로젝트에서 저장소 태그 목록을 가져와서 업데이트된 날짜 및 시간 순으로 내림차순으로 정렬된 목록을 얻습니다.

참고: 저장소가 공개적으로 접근 가능한 경우, 인증(--header "PRIVATE-TOKEN: <your_access_token>")이 필요하지 않습니다.

GET /projects/:id/repository/tags

매개변수:

속성 유형 필수 여부 설명
id 정수 또는 문자열 인증된 사용자가 소유한 프로젝트의 ID 또는 URL 인코딩 된 경로.
order_by 문자열 아니오 이름, 업데이트된 또는 버전으로 태그를 정렬하여 반환합니다. 기본값은 업데이트된입니다.
sort 문자열 아니오 태그를 오름차순 또는 내림차순으로 정렬하여 반환합니다. 기본값은 내림차순입니다.
search 문자열 아니오 검색 기준과 일치하는 태그 목록을 반환합니다. ^termterm$을 사용하여 각각 term으로 시작하고 끝나는 태그를 찾을 수 있습니다. 다른 정규 표현식은 지원되지 않습니다.
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": "놀라운 릴리즈. 와우"
    },
    "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
}

새 태그 생성

공급된 ref를 가리키는 새 태그를 저장소에 생성합니다.

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"
}