- すべてのパイプラインスケジュールを取得
- パイプラインスケジュールの取得
- パイプラインスケジュールの新規作成
- パイプラインスケジュールの編集
- パイプライン・スケジュールの管理
- パイプラインスケジュールの削除
- スケジュールされたパイプラインの即時実行
- パイプラインスケジュール変数
- パイプラインスケジュール変数の新規作成
- パイプラインスケジュール変数の編集
- パイプラインスケジュール変数の削除
パイプラインスケジュール API
パイプラインのスケジュールについてはこちらをご覧ください。
すべてのパイプラインスケジュールを取得
プロジェクトのパイプラインスケジュールの一覧を取得します。
GET /projects/:id/pipeline_schedules
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
scope
| 列 | いいえ | パイプラインスケジュールの範囲、1つ:active 、inactive
|
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules"
[
{
"id": 13,
"description": "Test schedule pipeline",
"ref": "master",
"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": "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"
}
}
]
パイプラインスケジュールの取得
プロジェクトのパイプラインスケジュールを取得します。
GET /projects/:id/pipeline_schedules/:pipeline_schedule_id
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
pipeline_schedule_id
| 整数 | はい | パイプラインスケジュールID |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13"
{
"id": 13,
"description": "Test schedule pipeline",
"ref": "master",
"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": "master",
"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"
},
"variables": [
{
"key": "TEST_VARIABLE_1",
"variable_type": "env_var",
"value": "TEST_1"
}
]
}
パイプラインスケジュールの新規作成
プロジェクトのパイプラインスケジュールを新規作成します。
POST /projects/:id/pipeline_schedules
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
description
| 列 | はい | パイプラインスケジュールの説明 |
ref
| 列 | はい | ブランチ/タグ名がトリガーされます。 |
cron
| 列 | はい | cron (例:0 1 * * * )(Cron 構文)
|
cron_timezone
| 列 | いいえ |
ActiveSupport::TimeZone がサポートするタイムゾーン (例:Pacific Time (US & Canada) ) (デフォルト:'UTC' )
|
active
| ブーリアン | いいえ | パイプラインスケジュールのアクティビティ。 falseを設定した場合、パイプラインスケジュールは初期状態では非アクティブになります (デフォルト:true )
|
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form description="Build packages" --form ref="master" --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": "Build packages",
"ref": "master",
"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 |
description
| 列 | いいえ | パイプラインスケジュールの説明 |
ref
| 列 | いいえ | ブランチ/タグ名がトリガーされます。 |
cron
| 列 | いいえ | cron (例:0 1 * * * )(Cron 構文)
|
cron_timezone
| 列 | いいえ |
ActiveSupport::TimeZone (例:Pacific Time (US & Canada) )またはTZInfo::Timezone (例:America/Los_Angeles )がサポートするタイムゾーン。
|
active
| ブーリアン | いいえ | パイプラインスケジュールのアクティビティ。 falseを設定すると、パイプラインスケジュールは初期状態では無効になります。 |
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": "Test schedule pipeline",
"ref": "master",
"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": "master",
"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
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
pipeline_schedule_id
| 整数 | はい | パイプラインスケジュール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": "master",
"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": "master",
"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
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
pipeline_schedule_id
| 整数 | はい | パイプラインスケジュール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": "master",
"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": "master",
"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"
}
}
スケジュールされたパイプラインの即時実行
GitLab 12.8で導入されました。
このパイプラインの次のスケジュール実行は影響を受けません。
POST /projects/:id/pipeline_schedules/:pipeline_schedule_id/play
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
pipeline_schedule_id
| 整数 | はい | パイプラインスケジュール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"
}
パイプラインスケジュール変数
GitLab 10.0で導入されました。
パイプラインスケジュール変数の新規作成
パイプラインスケジュールの新しい変数を作成します。
POST /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
pipeline_schedule_id
| 整数 | はい | パイプラインスケジュールID |
key
| 列 | はい | 変数のkey ; 255 文字以下でなければなりません;A-Z ,a-z ,0-9 , および_ だけが許可されます。
|
value
| 列 | はい | 変数のvalue
|
variable_type
| 列 | いいえ | 変数の型。使用可能な型は、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
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
pipeline_schedule_id
| 整数 | はい | パイプラインスケジュールID |
key
| 列 | はい | 変数のkey
|
value
| 列 | はい | 変数のvalue
|
variable_type
| 列 | いいえ | 変数の型。使用可能な型は、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
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
pipeline_schedule_id
| 整数 | はい | パイプラインスケジュールID |
key
| 列 | はい | 変数のkey
|
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"
}