InfoGrab DocsInfoGrab Docs

배포 API

요약

이 API를 사용하여 GitLab 환경으로의 코드 배포를 관리합니다. finished_before 또는 finished_after를 사용할 때는 order_by를 finished_at으로, status를 success로 지정해야 합니다.

이 API를 사용하여 GitLab 환경으로의 코드 배포를 관리합니다.

모든 프로젝트 배포 목록#

프로젝트의 모든 배포를 나열합니다.

GET /projects/:id/deployments
속성 유형 필수 설명
id integer 또는 string 예 프로젝트의 ID 또는 URL 인코딩된 경로.
order_by string 아니오 id, iid, created_at, updated_at, finished_at 또는 ref 필드 중 하나로 정렬된 배포를 반환합니다. 기본값은 id.
sort string 아니오 asc 또는 desc 순서로 정렬된 배포를 반환합니다. 기본값은 asc.
updated_after datetime 아니오 지정된 날짜 이후에 업데이트된 배포를 반환합니다. ISO 8601 형식 예상(2019-03-15T08:00:00Z).
updated_before datetime 아니오 지정된 날짜 이전에 업데이트된 배포를 반환합니다. ISO 8601 형식 예상(2019-03-15T08:00:00Z).
finished_after datetime 아니오 지정된 날짜 이후에 완료된 배포를 반환합니다. ISO 8601 형식 예상(2019-03-15T08:00:00Z).
finished_before datetime 아니오 지정된 날짜 이전에 완료된 배포를 반환합니다. ISO 8601 형식 예상(2019-03-15T08:00:00Z).
environment string 아니오 배포를 필터링할 환경의 이름.
status string 아니오 배포를 필터링할 상태. created, running, success, failed, canceled 또는 blocked 중 하나.
curl --request "GET" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/deployments"
Note

finished_before 또는 finished_after를 사용할 때는 order_by를 finished_at으로, status를 success로 지정해야 합니다.

응답 예시:

[
  {
    "created_at": "2016-08-11T07:36:40.222Z",
    "updated_at": "2016-08-11T07:38:12.414Z",
    "status": "created",
    "deployable": {
      "commit": {
        "author_email": "admin@example.com",
        "author_name": "Administrator",
        "created_at": "2016-08-11T09:36:01.000+02:00",
        "id": "99d03678b90d914dbb1b109132516d71a4a03ea8",
        "message": "Merge branch 'new-title' into 'main'\r\n\r\nUpdate README\r\n\r\n\r\n\r\nSee merge request !1",
        "short_id": "99d03678",
        "title": "Merge branch 'new-title' into 'main'\r"
      },
      "coverage": null,
      "created_at": "2016-08-11T07:36:27.357Z",
      "finished_at": "2016-08-11T07:36:39.851Z",
      "id": 657,
      "name": "deploy",
      "ref": "main",
      "runner": null,
      "stage": "deploy",
      "started_at": null,
      "status": "success",
      "tag": false,
      "project": {
        "ci_job_token_scope_enabled": false
      },
      "user": {
        "id": 1,
        "name": "Administrator",
        "username": "root",
        "state": "active",
        "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
        "web_url": "http://gitlab.dev/root",
        "created_at": "2015-12-21T13:14:24.077Z",
        "bio": null,
        "location": null,
        "public_email": "",
        "linkedin": "",
        "twitter": "",
        "website_url": "",
        "organization": ""
      },
      "pipeline": {
        "created_at": "2016-08-11T02:12:10.222Z",
        "id": 36,
        "ref": "main",
        "sha": "99d03678b90d914dbb1b109132516d71a4a03ea8",
        "status": "success",
        "updated_at": "2016-08-11T02:12:10.222Z",
        "web_url": "http://gitlab.dev/root/project/pipelines/12"
      }
    },
    "environment": {
      "external_url": "https://about.gitlab.com",
      "id": 9,
      "name": "production"
    },
    "id": 41,
    "iid": 1,
    "ref": "main",
    "sha": "99d03678b90d914dbb1b109132516d71a4a03ea8",
    "user": {
      "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
      "id": 1,
      "name": "Administrator",
      "state": "active",
      "username": "root",
      "web_url": "http://localhost:3000/root"
    }
  }
]

배포 조회#

단일 배포를 조회합니다.

GET /projects/:id/deployments/:deployment_id
속성 유형 필수 설명
id integer 또는 string 예 프로젝트의 ID 또는 URL 인코딩된 경로
deployment_id integer 예 배포의 ID
curl --request "GET" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/deployments/1"

응답 예시:

{
  "id": 42,
  "iid": 2,
  "ref": "main",
  "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
  "created_at": "2016-08-11T11:32:35.444Z",
  "updated_at": "2016-08-11T11:34:01.123Z",
  "status": "success",
  "user": {
    "name": "Administrator",
    "username": "root",
    "id": 1,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
    "web_url": "http://localhost:3000/root"
  },
  "environment": {
    "id": 9,
    "name": "production",
    "external_url": "https://about.gitlab.com"
  },
  "deployable": {
    "id": 664,
    "status": "success",
    "stage": "deploy",
    "name": "deploy",
    "ref": "main",
    "tag": false,
    "coverage": null,
    "created_at": "2016-08-11T11:32:24.456Z",
    "started_at": null,
    "finished_at": "2016-08-11T11:32:35.145Z",
    "project": {
      "ci_job_token_scope_enabled": false
    },
    "user": {
      "id": 1,
      "name": "Administrator",
      "username": "root",
      "state": "active",
      "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
      "web_url": "http://gitlab.dev/root",
      "created_at": "2015-12-21T13:14:24.077Z",
      "bio": null,
      "location": null,
      "linkedin": "",
      "twitter": "",
      "website_url": "",
      "organization": ""
    },
    "commit": {
      "id": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
      "short_id": "a91957a8",
      "title": "Merge branch 'rename-readme' into 'main'\r",
      "author_name": "Administrator",
      "author_email": "admin@example.com",
      "created_at": "2016-08-11T13:28:26.000+02:00",
      "message": "Merge branch 'rename-readme' into 'main'\r\n\r\nRename README\r\n\r\n\r\n\r\nSee merge request !2"
    },
    "pipeline": {
      "created_at": "2016-08-11T07:43:52.143Z",
      "id": 42,
      "ref": "main",
      "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
      "status": "success",
      "updated_at": "2016-08-11T07:43:52.143Z",
      "web_url": "http://gitlab.dev/root/project/pipelines/5"
    },
    "runner": null
  }
}

다중 승인 규칙이 구성된 경우, GitLab Premium 또는 Ultimate 사용자가 생성한 배포에는 approval_summary 속성이 포함됩니다:

{
  "approval_summary": {
    "rules": [
      {
        "user_id": null,
        "group_id": 134,
        "access_level": null,
        "access_level_description": "qa-group",
        "required_approvals": 1,
        "deployment_approvals": []
      },
      {
        "user_id": null,
        "group_id": 135,
        "access_level": null,
        "access_level_description": "security-group",
        "required_approvals": 2,
        "deployment_approvals": [
          {
            "user": {
              "id": 100,
              "username": "security-user-1",
              "name": "security user-1",
              "state": "active",
              "avatar_url": "https://www.gravatar.com/avatar/e130fcd3a1681f41a3de69d10841afa9?s=80&d=identicon",
              "web_url": "http://localhost:3000/security-user-1"
            },
            "status": "approved",
            "created_at": "2022-04-11T03:37:03.058Z",
            "comment": null
          }
        ]
      }
    ]
  }
  ...
}

배포 생성#

배포를 생성합니다.

POST /projects/:id/deployments
속성 유형 필수 설명
id integer 또는 string 예 프로젝트의 ID 또는 URL 인코딩된 경로.
environment string 예 배포를 생성할 환경의 이름.
sha string 예 배포되는 커밋의 SHA.
ref string 예 배포되는 브랜치 또는 태그의 이름.
tag boolean 예 배포된 ref가 태그(true)인지 아닌지(false)를 나타내는 boolean.
status string 예 생성되는 배포의 상태. running, success, failed 또는 canceled 중 하나.
curl --request "POST" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --data "environment=production&sha=a91957a858320c0e17f3a0eca7cfacbff50ea29a&ref=main&tag=false&status=success" \
  --url "https://gitlab.example.com/api/v4/projects/1/deployments"

응답 예시:

{
  "id": 42,
  "iid": 2,
  "ref": "main",
  "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
  "created_at": "2016-08-11T11:32:35.444Z",
  "status": "success",
  "user": {
    "name": "Administrator",
    "username": "root",
    "id": 1,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
    "web_url": "http://localhost:3000/root"
  },
  "environment": {
    "id": 9,
    "name": "production",
    "external_url": "https://about.gitlab.com"
  },
  "deployable": null
}

GitLab Premium 또는 Ultimate 사용자가 생성한 배포에는 approvals 및 pending_approval_count 속성이 포함됩니다:

{
  "status": "created",
  "pending_approval_count": 0,
  "approvals": [],
  ...
}

배포 업데이트#

배포를 업데이트합니다.

PUT /projects/:id/deployments/:deployment_id
속성 유형 필수 설명
id integer 또는 string 예 프로젝트의 ID 또는 URL 인코딩된 경로.
deployment_id integer 예 업데이트할 배포의 ID.
status string 예 배포의 새로운 상태. running, success, failed 또는 canceled 중 하나.
curl --request "PUT" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --data "status=success" \
  --url "https://gitlab.example.com/api/v4/projects/1/deployments/42"

응답 예시:

{
  "id": 42,
  "iid": 2,
  "ref": "main",
  "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
  "created_at": "2016-08-11T11:32:35.444Z",
  "status": "success",
  "user": {
    "name": "Administrator",
    "username": "root",
    "id": 1,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
    "web_url": "http://localhost:3000/root"
  },
  "environment": {
    "id": 9,
    "name": "production",
    "external_url": "https://about.gitlab.com"
  },
  "deployable": null
}

배포 삭제#

현재 환경의 마지막 배포가 아니거나 running 상태가 아닌 지정된 배포를 삭제합니다.

DELETE /projects/:id/deployments/:deployment_id
속성 유형 필수 설명
id integer 또는 string 예 프로젝트의 ID 또는 URL 인코딩된 경로
deployment_id integer 예 배포의 ID
curl --request "DELETE" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/deployments/1"

응답 예시:

{ "message": "204 Deployment destroyed" }
{ "message": "403 Forbidden" }
{ "message": "400 Cannot destroy running deployment" }
{ "message": "400 Deployment currently deployed to environment" }

배포와 연관된 모든 머지 리퀘스트 목록#

Note

모든 배포가 머지 리퀘스트와 연결될 수 있는 것은 아닙니다. 자세한 내용은 배포별로 새로 포함된 머지 리퀘스트 추적을 참조하세요.

지정된 배포에 포함된 모든 머지 리퀘스트를 나열합니다.

GET /projects/:id/deployments/:deployment_id/merge_requests

머지 리퀘스트 API와 동일한 파라미터를 지원하며 동일한 형식을 사용하여 응답을 반환합니다:

curl --request "GET" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/deployments/42/merge_requests"

배포 승인 또는 거부#

배포를 승인하거나 거부합니다.

이 기능에 대한 자세한 내용은 배포 승인을 참조하세요.

POST /projects/:id/deployments/:deployment_id/approval
속성 유형 필수 설명
id integer 또는 string 예 프로젝트의 ID 또는 URL 인코딩된 경로.
deployment_id integer 예 배포의 ID.
status string 예 승인 상태(approved 또는 rejected).
comment string 아니오 승인과 함께 제출할 코멘트.
represented_as string 아니오 사용자가 다중 승인 규칙에 속할 때 승인에 사용할 사용자/그룹/역할의 이름.
curl --request "POST" \
  --data "status=approved&comment=Looks good to me&represented_as=security" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/deployments/1/approval"

응답 예시:

{
  "user": {
    "id": 100,
    "username": "security-user-1",
    "name": "security user-1",
    "state": "active",
    "avatar_url": "https://www.gravatar.com/avatar/e130fcd3a1681f41a3de69d10841afa9?s=80&d=identicon",
    "web_url": "http://localhost:3000/security-user-1"
  },
  "status": "approved",
  "created_at": "2022-02-24T20:22:30.097Z",
  "comment":"Looks good to me"
}

배포 API

GitLab v19.5
Tier: Premium, Ultimate
Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
원문 보기

요약

이 API를 사용하여 GitLab 환경으로의 코드 배포를 관리합니다. finished_before 또는 finished_after를 사용할 때는 order_by를 finished_at으로, status를 success로 지정해야 합니다.

이 API를 사용하여 GitLab 환경으로의 코드 배포를 관리합니다.

모든 프로젝트 배포 목록#

프로젝트의 모든 배포를 나열합니다.

GET /projects/:id/deployments
속성 유형 필수 설명
id integer 또는 string 예 프로젝트의 ID 또는 URL 인코딩된 경로.
order_by string 아니오 id, iid, created_at, updated_at, finished_at 또는 ref 필드 중 하나로 정렬된 배포를 반환합니다. 기본값은 id.
sort string 아니오 asc 또는 desc 순서로 정렬된 배포를 반환합니다. 기본값은 asc.
updated_after datetime 아니오 지정된 날짜 이후에 업데이트된 배포를 반환합니다. ISO 8601 형식 예상(2019-03-15T08:00:00Z).
updated_before datetime 아니오 지정된 날짜 이전에 업데이트된 배포를 반환합니다. ISO 8601 형식 예상(2019-03-15T08:00:00Z).
finished_after datetime 아니오 지정된 날짜 이후에 완료된 배포를 반환합니다. ISO 8601 형식 예상(2019-03-15T08:00:00Z).
finished_before datetime 아니오 지정된 날짜 이전에 완료된 배포를 반환합니다. ISO 8601 형식 예상(2019-03-15T08:00:00Z).
environment string 아니오 배포를 필터링할 환경의 이름.
status string 아니오 배포를 필터링할 상태. created, running, success, failed, canceled 또는 blocked 중 하나.
curl --request "GET" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/deployments"
Note

finished_before 또는 finished_after를 사용할 때는 order_by를 finished_at으로, status를 success로 지정해야 합니다.

응답 예시:

[
  {
    "created_at": "2016-08-11T07:36:40.222Z",
    "updated_at": "2016-08-11T07:38:12.414Z",
    "status": "created",
    "deployable": {
      "commit": {
        "author_email": "admin@example.com",
        "author_name": "Administrator",
        "created_at": "2016-08-11T09:36:01.000+02:00",
        "id": "99d03678b90d914dbb1b109132516d71a4a03ea8",
        "message": "Merge branch 'new-title' into 'main'\r\n\r\nUpdate README\r\n\r\n\r\n\r\nSee merge request !1",
        "short_id": "99d03678",
        "title": "Merge branch 'new-title' into 'main'\r"
      },
      "coverage": null,
      "created_at": "2016-08-11T07:36:27.357Z",
      "finished_at": "2016-08-11T07:36:39.851Z",
      "id": 657,
      "name": "deploy",
      "ref": "main",
      "runner": null,
      "stage": "deploy",
      "started_at": null,
      "status": "success",
      "tag": false,
      "project": {
        "ci_job_token_scope_enabled": false
      },
      "user": {
        "id": 1,
        "name": "Administrator",
        "username": "root",
        "state": "active",
        "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
        "web_url": "http://gitlab.dev/root",
        "created_at": "2015-12-21T13:14:24.077Z",
        "bio": null,
        "location": null,
        "public_email": "",
        "linkedin": "",
        "twitter": "",
        "website_url": "",
        "organization": ""
      },
      "pipeline": {
        "created_at": "2016-08-11T02:12:10.222Z",
        "id": 36,
        "ref": "main",
        "sha": "99d03678b90d914dbb1b109132516d71a4a03ea8",
        "status": "success",
        "updated_at": "2016-08-11T02:12:10.222Z",
        "web_url": "http://gitlab.dev/root/project/pipelines/12"
      }
    },
    "environment": {
      "external_url": "https://about.gitlab.com",
      "id": 9,
      "name": "production"
    },
    "id": 41,
    "iid": 1,
    "ref": "main",
    "sha": "99d03678b90d914dbb1b109132516d71a4a03ea8",
    "user": {
      "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
      "id": 1,
      "name": "Administrator",
      "state": "active",
      "username": "root",
      "web_url": "http://localhost:3000/root"
    }
  }
]

배포 조회#

단일 배포를 조회합니다.

GET /projects/:id/deployments/:deployment_id
속성 유형 필수 설명
id integer 또는 string 예 프로젝트의 ID 또는 URL 인코딩된 경로
deployment_id integer 예 배포의 ID
curl --request "GET" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/deployments/1"

응답 예시:

{
  "id": 42,
  "iid": 2,
  "ref": "main",
  "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
  "created_at": "2016-08-11T11:32:35.444Z",
  "updated_at": "2016-08-11T11:34:01.123Z",
  "status": "success",
  "user": {
    "name": "Administrator",
    "username": "root",
    "id": 1,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
    "web_url": "http://localhost:3000/root"
  },
  "environment": {
    "id": 9,
    "name": "production",
    "external_url": "https://about.gitlab.com"
  },
  "deployable": {
    "id": 664,
    "status": "success",
    "stage": "deploy",
    "name": "deploy",
    "ref": "main",
    "tag": false,
    "coverage": null,
    "created_at": "2016-08-11T11:32:24.456Z",
    "started_at": null,
    "finished_at": "2016-08-11T11:32:35.145Z",
    "project": {
      "ci_job_token_scope_enabled": false
    },
    "user": {
      "id": 1,
      "name": "Administrator",
      "username": "root",
      "state": "active",
      "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
      "web_url": "http://gitlab.dev/root",
      "created_at": "2015-12-21T13:14:24.077Z",
      "bio": null,
      "location": null,
      "linkedin": "",
      "twitter": "",
      "website_url": "",
      "organization": ""
    },
    "commit": {
      "id": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
      "short_id": "a91957a8",
      "title": "Merge branch 'rename-readme' into 'main'\r",
      "author_name": "Administrator",
      "author_email": "admin@example.com",
      "created_at": "2016-08-11T13:28:26.000+02:00",
      "message": "Merge branch 'rename-readme' into 'main'\r\n\r\nRename README\r\n\r\n\r\n\r\nSee merge request !2"
    },
    "pipeline": {
      "created_at": "2016-08-11T07:43:52.143Z",
      "id": 42,
      "ref": "main",
      "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
      "status": "success",
      "updated_at": "2016-08-11T07:43:52.143Z",
      "web_url": "http://gitlab.dev/root/project/pipelines/5"
    },
    "runner": null
  }
}

다중 승인 규칙이 구성된 경우, GitLab Premium 또는 Ultimate 사용자가 생성한 배포에는 approval_summary 속성이 포함됩니다:

{
  "approval_summary": {
    "rules": [
      {
        "user_id": null,
        "group_id": 134,
        "access_level": null,
        "access_level_description": "qa-group",
        "required_approvals": 1,
        "deployment_approvals": []
      },
      {
        "user_id": null,
        "group_id": 135,
        "access_level": null,
        "access_level_description": "security-group",
        "required_approvals": 2,
        "deployment_approvals": [
          {
            "user": {
              "id": 100,
              "username": "security-user-1",
              "name": "security user-1",
              "state": "active",
              "avatar_url": "https://www.gravatar.com/avatar/e130fcd3a1681f41a3de69d10841afa9?s=80&d=identicon",
              "web_url": "http://localhost:3000/security-user-1"
            },
            "status": "approved",
            "created_at": "2022-04-11T03:37:03.058Z",
            "comment": null
          }
        ]
      }
    ]
  }
  ...
}

배포 생성#

배포를 생성합니다.

POST /projects/:id/deployments
속성 유형 필수 설명
id integer 또는 string 예 프로젝트의 ID 또는 URL 인코딩된 경로.
environment string 예 배포를 생성할 환경의 이름.
sha string 예 배포되는 커밋의 SHA.
ref string 예 배포되는 브랜치 또는 태그의 이름.
tag boolean 예 배포된 ref가 태그(true)인지 아닌지(false)를 나타내는 boolean.
status string 예 생성되는 배포의 상태. running, success, failed 또는 canceled 중 하나.
curl --request "POST" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --data "environment=production&sha=a91957a858320c0e17f3a0eca7cfacbff50ea29a&ref=main&tag=false&status=success" \
  --url "https://gitlab.example.com/api/v4/projects/1/deployments"

응답 예시:

{
  "id": 42,
  "iid": 2,
  "ref": "main",
  "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
  "created_at": "2016-08-11T11:32:35.444Z",
  "status": "success",
  "user": {
    "name": "Administrator",
    "username": "root",
    "id": 1,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
    "web_url": "http://localhost:3000/root"
  },
  "environment": {
    "id": 9,
    "name": "production",
    "external_url": "https://about.gitlab.com"
  },
  "deployable": null
}

GitLab Premium 또는 Ultimate 사용자가 생성한 배포에는 approvals 및 pending_approval_count 속성이 포함됩니다:

{
  "status": "created",
  "pending_approval_count": 0,
  "approvals": [],
  ...
}

배포 업데이트#

배포를 업데이트합니다.

PUT /projects/:id/deployments/:deployment_id
속성 유형 필수 설명
id integer 또는 string 예 프로젝트의 ID 또는 URL 인코딩된 경로.
deployment_id integer 예 업데이트할 배포의 ID.
status string 예 배포의 새로운 상태. running, success, failed 또는 canceled 중 하나.
curl --request "PUT" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --data "status=success" \
  --url "https://gitlab.example.com/api/v4/projects/1/deployments/42"

응답 예시:

{
  "id": 42,
  "iid": 2,
  "ref": "main",
  "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
  "created_at": "2016-08-11T11:32:35.444Z",
  "status": "success",
  "user": {
    "name": "Administrator",
    "username": "root",
    "id": 1,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
    "web_url": "http://localhost:3000/root"
  },
  "environment": {
    "id": 9,
    "name": "production",
    "external_url": "https://about.gitlab.com"
  },
  "deployable": null
}

배포 삭제#

현재 환경의 마지막 배포가 아니거나 running 상태가 아닌 지정된 배포를 삭제합니다.

DELETE /projects/:id/deployments/:deployment_id
속성 유형 필수 설명
id integer 또는 string 예 프로젝트의 ID 또는 URL 인코딩된 경로
deployment_id integer 예 배포의 ID
curl --request "DELETE" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/deployments/1"

응답 예시:

{ "message": "204 Deployment destroyed" }
{ "message": "403 Forbidden" }
{ "message": "400 Cannot destroy running deployment" }
{ "message": "400 Deployment currently deployed to environment" }

배포와 연관된 모든 머지 리퀘스트 목록#

Note

모든 배포가 머지 리퀘스트와 연결될 수 있는 것은 아닙니다. 자세한 내용은 배포별로 새로 포함된 머지 리퀘스트 추적을 참조하세요.

지정된 배포에 포함된 모든 머지 리퀘스트를 나열합니다.

GET /projects/:id/deployments/:deployment_id/merge_requests

머지 리퀘스트 API와 동일한 파라미터를 지원하며 동일한 형식을 사용하여 응답을 반환합니다:

curl --request "GET" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/deployments/42/merge_requests"

배포 승인 또는 거부#

배포를 승인하거나 거부합니다.

이 기능에 대한 자세한 내용은 배포 승인을 참조하세요.

POST /projects/:id/deployments/:deployment_id/approval
속성 유형 필수 설명
id integer 또는 string 예 프로젝트의 ID 또는 URL 인코딩된 경로.
deployment_id integer 예 배포의 ID.
status string 예 승인 상태(approved 또는 rejected).
comment string 아니오 승인과 함께 제출할 코멘트.
represented_as string 아니오 사용자가 다중 승인 규칙에 속할 때 승인에 사용할 사용자/그룹/역할의 이름.
curl --request "POST" \
  --data "status=approved&comment=Looks good to me&represented_as=security" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/deployments/1/approval"

응답 예시:

{
  "user": {
    "id": 100,
    "username": "security-user-1",
    "name": "security user-1",
    "state": "active",
    "avatar_url": "https://www.gravatar.com/avatar/e130fcd3a1681f41a3de69d10841afa9?s=80&d=identicon",
    "web_url": "http://localhost:3000/security-user-1"
  },
  "status": "approved",
  "created_at": "2022-02-24T20:22:30.097Z",
  "comment":"Looks good to me"
}