パイプラインのスケジュール実行
このページの内容
- はじめに
- パイプラインのスケジュール実行機能の使い方
- Web アプリのプロジェクト設定を使用する
- API を使用する場合
- ワークフローのスケジュール実行からパイプラインのスケジュール実行への移行
- パイプラインのスケジュール実行のビデオチュートリアル
- FAQ
- Can I migrate existing scheduled workflows to scheduled pipelines?
- How do I find the schedules that I have created?
- What time zone is used for scheduled pipelines?
- Can pipelines be scheduled to run at a specific time of day?
- Are scheduled pipelines guaranteed to run at precisely the time scheduled?
- Why did my scheduled pipeline run later than expected?
- Do you support regex?
- 次のステップ
パイプラインのスケジュール実行機能は現時点では GitHub VCS ユーザーと Bitbucket VCS ユーザーにご利用いただけます。 パイプラインのスケジュール実行機能を使うと、スケジュールに基づき定期的にパイプラインをトリガーすることができます。 パイプラインのスケジュール実行では、以下のようなパイプラインのすべての機能が保持されます。
-
パイプラインに関連付けるユーザーの管理: これにより、 制限付きコンテキストの使用が可能になります。
-
セットアップ ワークフロー経由の ダイナミックコンフィグの使用
-
.circleci/config.yml
. の編集が不要なスケジュール変更 -
自動キャンセル機能の利用.
-
スケジュールに関連付ける パイプライン パラメーターの指定。
-
ワークフロー間などで共通するスケジュールの管理.
パイプラインのスケジュール実行は、API を使って、または CircleCI Web アプリのプロジェクト設定から設定します。
パイプラインのスケジュール実行は、1 つのブランチに対してのみ設定できます。 2 つのブランチに対してスケジュール実行をしたい場合、2 つのスケジュールを設定する必要があります。 |
はじめに
パイプラインのスケジュール実行は、CircleCI Web アプリまたは API から、スケジュールに基づいて定期的にパイプラインを起動することができます。 スケジュールは、毎日、毎週、毎月、または非常に特定のタイムテーブルの範囲にすることができます 基本的なスケジュールされたパイプラインを設定するには、.circleci/config.yml
ファイルに追加の設定は必要ありませんが、この機能をより高度に使用するには、追加の .circleci/config.yml
設定が必要になります(例、ワークフローのフィルタリング、またはパラメータの使用など)。
パイプラインパラメータは、文字列、整数、またはブール値の形で型付けされたパイプライン変数です。 スケジュールされたパイプラインにパラメータを追加するには、Web アプリでスケジュールを設定する際に、トリガーフォームから行います。 この方法で設定されたパラメータは、パラメータキー(parameters
)を使用して設定ファイルに追加する必要があります。
スケジューリングされたパイプラインは、CircleCI スケジューリングシステム、または特定のユーザー(例えば、自身)である "actor" によって実行するように設定されています。 ワークフローで制限されたコンテキストを利用する場合、スケジューリングアクターは重要な考慮事項です。 ワークフローを実行するユーザー(actor)がコンテキストへのアクセス権を持っていない場合、ワークフローは Unauthorized
ステータスで失敗します。
基本的な使い方は パイプラインのスケジュール実行を夜間に設定するページで、より高度な例は 複数のワークフローを使ったパイプラインのスケジュール実行 ページをご覧ください。
パイプラインのスケジュール実行機能の使い方
パイプラインのスケジュール実行機能を使うには、API を使用する方法と、CircleCI Web アプリを使用する方法があります。 それぞれの方法を下記でご紹介します。
Web アプリのプロジェクト設定を使用する
-
CircleCI Web アプリで、サイドバーにある Projects に移動し、プロジェクトの隣にある 省略記号 (…) をクリックします。 Project Settings ボタンは各プロジェクトのランディングページにもあります。
-
Triggers に移動します。
-
新しいスケジュールを作成するには、Add Trigger をクリックします。
-
フォームに入力して新しいスケジュールを定義し、Save Trigger をクリックします。
このフォームでは、 パイプラインパラメーター を追加するオプションも指定します。これは、設定ファイルで最初に宣言した型指定されたパイプライン変数です。
複数のワークフローで共通のスケジュールを管理するには、.circleci/config.yml
ファイルで手動で設定する必要があります。 コード例については 複数のワークフローを使ったパイプラインのスケジュール実行のページを参照してください。
API を使用する場合
プロジェクトにスケジュール化したワークフローがなく、パイプラインのスケジュール実行を試してみたい場合:
-
CCI トークンを準備します、または API トークンの管理 のページに記載されている手順に従って新しいトークンを作成します。
-
API を使用 して新しいスケジュールを作成します。 たとえば以下のようになります。
curl --location --request POST "https://circleci.com/api/v2/project/<project-slug>/schedule" \
--header "circle-token: <PERSONAL_API_KEY>" \
--header "Content-Type: application/json" \
--data-raw '{
"name": "my schedule name",
"description": "some description",
"attribution-actor": "system",
"parameters": {
"branch": "main"
<additional pipeline parameters can be added here>
},
"timetable": {
"per-hour": 3,
"hours-of-day": [1,15],
"days-of-week": ["MON", "WED"]
}
}'
詳細については、 API v2 に関するドキュメントの スケジュール のセクションを参照してください。
ワークフローのスケジュール実行からパイプラインのスケジュール実行への移行
パイプラインのスケジュール実行に移行する必要がある既存のワークフローがある場合は、 パイプラインのスケジュール実行への移行ガイドをご覧ください。
パイプラインのスケジュール実行のビデオチュートリアル
このビデオでは以下のシナリオに対する短いチュートリアルをご覧いただけます。
-
Web アプリでスケジュールを設定する
-
API を使ってスケジュールを設定する
-
ワークフローのスケジュール実行からパイプラインのスケジュール実行への移行する
<div class="video-wrapper"> <iframe width="560" height="315" src="https://www.youtube.com/embed/x3ruGpx6SEI" title="Scheduled pipelines tutorial" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> </div>
これらのシナリオに関するドキュメントは、以下のページを参照してください: - パイプラインのスケジュール実行を夜間に設定する - 複数のワークフローを使ったパイプラインのスケジュール実行
FAQ
Can I migrate existing scheduled workflows to scheduled pipelines?
Yes, visit the Scheduled pipelines migration guide for more information.
How do I find the schedules that I have created?
As scheduled pipelines are stored directly in CircleCI, there is a UUID associated with each schedule. You can view schedules that you have created on the Triggers page of the project settings. You can also list all the schedules under a single project:
curl --location --request GET "https://circleci.com/api/v2/project/<project-slug>/schedule" \
--header "circle-token: <PERSONAL_API_KEY>"
For GitHub and Bitbucket users: project-slug
takes the form of vcs-type/org-name/repo-name
, for example, gh/CircleCI-Public/api-preview-docs
.
What time zone is used for scheduled pipelines?
Coordinated Universal Time (UTC) is the time zone in which schedules are interpreted.
Can pipelines be scheduled to run at a specific time of day?
Yes, you can Scheduled pipelines. You can set up scheduled pipelines through the CircleCI web app, or with CircleCI API v2.
If you are currently using Scheduled workflows, please see the Migration guide to update your scheduled workflows to scheduled pipelines.
Are scheduled pipelines guaranteed to run at precisely the time scheduled?
CircleCI provides no guarantees about precision. A schedule will be run as if the commit was pushed at the configured time.
Why did my scheduled pipeline run later than expected?
There is a nuanced difference in the scheduling expression with Scheduled Pipelines, compared to the Cron expression.
For example, when you express the schedule as 1 per-hour for 08:00 UTC, the scheduled pipeline will run once within the 08:00 to 09:00 UTC window. Note that it does not mean that it will run at 08:00 UTC exactly.
However, subsequent runs of the scheduled pipeline will always be run on the same time as its previous run. In other words, if a previous scheduled pipeline ran at 08:11 UTC, the next runs should also be at 08:11 UTC.
Do you support regex?
Not currently. Scheduled pipelines require highly deterministic inputs such as a commit SHA, branch, or tag (fully qualified, no regexes) included in the webhook, API call, or schedule.
ドキュメントの改善にご協力ください
このガイドは、CircleCI の他のドキュメントと同様にオープンソースであり、 GitHub でご利用いただけます。 ご協力いただき、ありがとうございます。
- このページの編集をご提案ください (最初に「コントリビューションガイド」をご覧ください)。
- ドキュメントの問題点を報告する、またはフィードバックやコメントを送信するには、GitHub で issue を作成してください。
- CircleCI は、ユーザーの皆様の弊社プラットフォームにおけるエクスペリエンスを向上させる方法を常に模索しています。 フィードバックをお寄せいただける場合は、リサーチコミュニティにご参加ください。
サポートが必要ですか
CircleCI のサポートエンジニアによる、サービスに関する問題、請求およびアカウントについての質問への対応、設定の構築に関する問題解決のサポートを行っています。 サポートチケットを送信して、CircleCI のサポートエンジニアにお問い合わせください。日本語でお問い合わせいただけます。
または、 サポートサイト から、サポート記事やコミュニティフォーラム、トレーニングリソースをご覧いただけます。
CircleCI Documentation by CircleCI is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.