파이프라인 스케줄 API

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

pipeline schedules에 대해 더 읽어보세요.

모든 파이프라인 스케줄 가져오기

프로젝트의 파이프라인 스케줄 디렉터리을 가져옵니다.

GET /projects/:id/pipeline_schedules
속성 유형 필수 설명
id integer/string Yes 프로젝트의 ID 또는 URL 인코딩 된 경로
scope string No 파이프라인 스케줄의 범위, 다음 중 하나여야 함: active, inactive
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules"
[
    {
        "id": 13,
        "description": "테스트 스케줄 파이프라인",
        "ref": "refs/heads/main",
        "cron": "* * * * *",
        "cron_timezone": "Asia/Tokyo",
        "next_run_at": "2017-05-19T13:41:00.000Z",
        "active": true,
        "created_at": "2017-05-19T13:31:08.849Z",
        "updated_at": "2017-05-19T13:40:17.727Z",
        "owner": {
            "name": "관리자",
            "username": "root",
            "id": 1,
            "state": "active",
            "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
            "web_url": "https://gitlab.example.com/root"
        }
    }
]

단일 파이프라인 스케줄 가져오기

프로젝트의 파이프라인 스케줄을 가져옵니다.

GET /projects/:id/pipeline_schedules/:pipeline_schedule_id
속성 유형 필수 설명
id integer/string Yes 프로젝트의 ID 또는 URL 인코딩 된 경로
pipeline_schedule_id integer Yes 파이프라인 스케줄 ID
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13"
{
    "id": 13,
    "description": "테스트 스케줄 파이프라인",
    "ref": "refs/heads/main",
    "cron": "* * * * *",
    "cron_timezone": "Asia/Tokyo",
    "next_run_at": "2017-05-19T13:41:00.000Z",
    "active": true,
    "created_at": "2017-05-19T13:31:08.849Z",
    "updated_at": "2017-05-19T13:40:17.727Z",
    "last_pipeline": {
        "id": 332,
        "sha": "0e788619d0b5ec17388dffb973ecd505946156db",
        "ref": "refs/heads/main",
        "status": "pending"
    },
    "owner": {
        "name": "관리자",
        "username": "root",
        "id": 1,
        "state": "active",
        "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
        "web_url": "https://gitlab.example.com/root"
    },
    "variables": [
        {
            "key": "TEST_VARIABLE_1",
            "variable_type": "env_var",
            "value": "TEST_1",
            "raw": false
        }
    ]
}

파이프라인 스케줄에 의해 트리거된 모든 파이프라인 가져오기

프로젝트에서 파이프라인 스케줄에 의해 트리거된 모든 파이프라인을 가져옵니다.

GET /projects/:id/pipeline_schedules/:pipeline_schedule_id/pipelines

지원되는 속성:

속성 유형 필수 설명
id integer/string Yes 프로젝트의 ID 또는 URL 인코딩 된 경로
pipeline_schedule_id integer Yes 파이프라인 스케줄 ID

예시 요청:

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13/pipelines"

예시 응답:

[
  {
    "id": 47,
    "iid": 12,
    "project_id": 29,
    "status": "pending",
    "source": "scheduled",
    "ref": "new-pipeline",
    "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
    "web_url": "https://example.com/foo/bar/pipelines/47",
    "created_at": "2016-08-11T11:28:34.085Z",
    "updated_at": "2016-08-11T11:32:35.169Z"
  },
  {
    "id": 48,
    "iid": 13,
    "project_id": 29,
    "status": "pending",
    "source": "scheduled",
    "ref": "new-pipeline",
    "sha": "eb94b618fb5865b26e80fdd8ae531b7a63ad851a",
    "web_url": "https://example.com/foo/bar/pipelines/48",
    "created_at": "2016-08-12T10:06:04.561Z",
    "updated_at": "2016-08-12T10:09:56.223Z"
  }
]

새로운 파이프라인 스케줄 생성

프로젝트의 새로운 파이프라인 스케줄을 생성합니다.

POST /projects/:id/pipeline_schedules
속성 유형 필수 설명
cron 문자열 크론 일정, 예: 0 1 * * *.
description 문자열 파이프라인 스케줄의 설명입니다.
id 정수/문자열 프로젝트의 ID 또는 URL 인코딩된 경로.
ref 문자열 트리거되는 브랜치 또는 태그 이름입니다. 단축형 (예: main) 및 전체 형식 (예: refs/heads/main 또는 refs/tags/main) 모두 허용됩니다. 또한 축약형이 제공된 경우 자동으로 전체 참조 버전으로 확장되지만, 참조가 모호한 경우 모호한 참조는 거부됩니다.
active 부울 아니오 파이프라인 스케줄의 활성화입니다. false로 설정하면 파이프라인 스케줄은 초기에 비활성화됩니다 (기본: true).
cron_timezone 문자열 아니오 ActiveSupport::TimeZone에서 지원하는 시간대, 예: Pacific Time (US & Canada) (기본: UTC).
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
     --form description="패키지 빌드" --form ref="main" --form cron="0 1 * * 5" --form cron_timezone="UTC" \
     --form active="true" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules"
{
    "id": 14,
    "description": "패키지 빌드",
    "ref": "refs/heads/main",
    "cron": "0 1 * * 5",
    "cron_timezone": "UTC",
    "next_run_at": "2017-05-26T01:00:00.000Z",
    "active": true,
    "created_at": "2017-05-19T13:43:08.169Z",
    "updated_at": "2017-05-19T13:43:08.169Z",
    "last_pipeline": null,
    "owner": {
        "name": "Administrator",
        "username": "root",
        "id": 1,
        "state": "active",
        "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
        "web_url": "https://gitlab.example.com/root"
    }
}

파이프라인 스케줄 편집

프로젝트의 파이프라인 스케줄을 업데이트합니다. 업데이트가 완료되면 자동으로 다시 예약됩니다.

PUT /projects/:id/pipeline_schedules/:pipeline_schedule_id
속성 유형 필수 설명
id 정수/문자열 프로젝트의 ID 또는 URL 인코딩된 경로.
pipeline_schedule_id 정수 파이프라인 스케줄 ID입니다.
active 부울 아니오 파이프라인 스케줄의 활성화입니다. false로 설정하면 파이프라인 스케줄은 초기에 비활성화됩니다.
cron_timezone 문자열 아니오 ActiveSupport::TimeZone에서 지원하는 시간대 (예: Pacific Time (US & Canada)) 또는 TZInfo::Timezone (예: America/Los_Angeles).
cron 문자열 아니오 크론 일정, 예: 0 1 * * *.
description 문자열 아니오 파이프라인 스케줄의 설명입니다.
ref 문자열 아니오 트리거되는 브랜치 또는 태그 이름입니다. 단축형 (예: main) 및 전체 형식 (예: refs/heads/main 또는 refs/tags/main) 모두 허용됩니다. 또한 축약형이 제공된 경우 자동으로 전체 참조 버전으로 확장되지만, 참조가 모호한 경우 거부됩니다.
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
     --form cron="0 2 * * *" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13"
{
    "id": 13,
    "description": "일정 파이프라인 테스트",
    "ref": "refs/heads/main",
    "cron": "0 2 * * *",
    "cron_timezone": "Asia/Tokyo",
    "next_run_at": "2017-05-19T17:00:00.000Z",
    "active": true,
    "created_at": "2017-05-19T13:31:08.849Z",
    "updated_at": "2017-05-19T13:44:16.135Z",
    "last_pipeline": {
        "id": 332,
        "sha": "0e788619d0b5ec17388dffb973ecd505946156db",
        "ref": "refs/heads/main",
        "status": "pending"
    },
    "owner": {
        "name": "Administrator",
        "username": "root",
        "id": 1,
        "state": "active",
        "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
        "web_url": "https://gitlab.example.com/root"
    }
}

파이프라인 스케줄 소유권 가져가기

프로젝트의 파이프라인 스케줄의 소유자를 업데이트합니다.

POST /projects/:id/pipeline_schedules/:pipeline_schedule_id/take_ownership
속성 유형 필수여부 설명
id integer/string Yes 프로젝트의 ID 또는 URL 인코딩된 경로
pipeline_schedule_id integer Yes 파이프라인 스케줄 ID
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13/take_ownership"
{
    "id": 13,
    "description": "Test schedule pipeline",
    "ref": "refs/heads/main",
    "cron": "0 2 * * *",
    "cron_timezone": "Asia/Tokyo",
    "next_run_at": "2017-05-19T17:00:00.000Z",
    "active": true,
    "created_at": "2017-05-19T13:31:08.849Z",
    "updated_at": "2017-05-19T13:46:37.468Z",
    "last_pipeline": {
        "id": 332,
        "sha": "0e788619d0b5ec17388dffb973ecd505946156db",
        "ref": "refs/heads/main",
        "status": "pending"
    },
    "owner": {
        "name": "shinya",
        "username": "maeda",
        "id": 50,
        "state": "active",
        "avatar_url": "http://www.gravatar.com/avatar/8ca0a796a679c292e3a11da50f99e801?s=80&d=identicon",
        "web_url": "https://gitlab.example.com/maeda"
    }
}

파이프라인 스케줄 삭제

프로젝트의 파이프라인 스케줄을 삭제합니다.

DELETE /projects/:id/pipeline_schedules/:pipeline_schedule_id
속성 유형 필수여부 설명
id integer/string Yes 프로젝트의 ID 또는 URL 인코딩된 경로
pipeline_schedule_id integer Yes 파이프라인 스케줄 ID
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13"
{
    "id": 13,
    "description": "Test schedule pipeline",
    "ref": "refs/heads/main",
    "cron": "0 2 * * *",
    "cron_timezone": "Asia/Tokyo",
    "next_run_at": "2017-05-19T17:00:00.000Z",
    "active": true,
    "created_at": "2017-05-19T13:31:08.849Z",
    "updated_at": "2017-05-19T13:46:37.468Z",
    "last_pipeline": {
        "id": 332,
        "sha": "0e788619d0b5ec17388dffb973ecd505946156db",
        "ref": "refs/heads/main",
        "status": "pending"
    },
    "owner": {
        "name": "shinya",
        "username": "maeda",
        "id": 50,
        "state": "active",
        "avatar_url": "http://www.gravatar.com/avatar/8ca0a796a679c292e3a11da50f99e801?s=80&d=identicon",
        "web_url": "https://gitlab.example.com/maeda"
    }
}

예약된 파이프라인 즉시 실행

즉시 실행되는 새로운 예약된 파이프라인을 트리거합니다. 이 파이프라인의 다음 예약된 실행에는 영향을 주지 않습니다.

POST /projects/:id/pipeline_schedules/:pipeline_schedule_id/play
속성 유형 필수여부 설명
id integer/string Yes 프로젝트의 ID 또는 URL 인코딩된 경로
pipeline_schedule_id integer Yes 파이프라인 스케줄 ID

예시 요청:

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/42/pipeline_schedules/1/play"

예시 응답:

{
  "message": "201 Created"
}

파이프라인 스케줄 변수

새로운 파이프라인 스케줄 변수 생성

파이프라인 스케줄의 새로운 변수를 생성합니다.

POST /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables
속성 유형 필수여부 설명
id integer/string Yes 프로젝트의 ID 또는 URL 인코딩된 경로
key string Yes 변수의 key; 255자를 초과하지 않아야하며 A-Z, a-z, 0-9, _만 허용됩니다.
pipeline_schedule_id integer Yes 파이프라인 스케줄 ID
value string Yes 변수의 value
variable_type string No 변수의 유형. 사용 가능한 유형: env_var (기본값), file
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form "key=NEW_VARIABLE" \
     --form "value=new value" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13/variables"
{
    "key": "NEW_VARIABLE",
    "variable_type": "env_var",
    "value": "new value"
}

파이프라인 스케줄 변수 편집

파이프라인 스케줄 변수를 업데이트합니다.

PUT /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables/:key
속성 유형 필수 설명
id integer/string Yes 프로젝트의 ID 또는 URL-encoded path
key string Yes 변수의 key
pipeline_schedule_id integer Yes 파이프라인 스케줄 ID
value string Yes 변수의 value
variable_type string No 변수의 유형. 사용 가능한 유형: env_var (기본값), file
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
     --form "value=updated value" \
     "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13/variables/NEW_VARIABLE"
{
    "key": "NEW_VARIABLE",
    "value": "updated value",
    "variable_type": "env_var"
}

파이프라인 스케줄 변수 삭제

파이프라인 스케줄 변수를 삭제합니다.

DELETE /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables/:key
속성 유형 필수 설명
id integer/string Yes 프로젝트의 ID 또는 URL-encoded path
key string Yes 변수의 key
pipeline_schedule_id integer Yes 파이프라인 스케줄 ID
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13/variables/NEW_VARIABLE"
{
    "key": "NEW_VARIABLE",
    "value": "updated value"
}