debian-mirror-gitlab/doc/ci/pipelines/schedules.md

101 lines
4.4 KiB
Markdown
Raw Normal View History

2020-04-08 14:13:33 +05:30
---
2020-06-23 00:09:42 +05:30
stage: Verify
2021-09-04 01:27:46 +05:30
group: Pipeline Execution
2022-11-25 23:54:43 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2020-04-08 14:13:33 +05:30
disqus_identifier: 'https://docs.gitlab.com/ee/user/project/pipelines/schedules.html'
type: reference, howto
---
2022-05-07 20:08:51 +05:30
# Scheduled pipelines **(FREE)**
2020-04-08 14:13:33 +05:30
2022-05-07 20:08:51 +05:30
Use scheduled pipelines to run GitLab CI/CD [pipelines](index.md) at regular intervals.
2020-04-08 14:13:33 +05:30
2020-05-24 23:13:21 +05:30
## Prerequisites
2022-05-07 20:08:51 +05:30
For a scheduled pipeline to run:
2020-05-24 23:13:21 +05:30
2022-05-07 20:08:51 +05:30
- The schedule owner must have the Developer role. For pipelines on protected branches,
the schedule owner must be [allowed to merge](../../user/project/protected_branches.md#configure-a-protected-branch)
to the branch.
- The [CI/CD configuration](../yaml/index.md) must be valid.
2020-05-24 23:13:21 +05:30
2022-05-07 20:08:51 +05:30
Otherwise, the pipeline is not created. No error message is displayed.
2020-05-24 23:13:21 +05:30
2022-05-07 20:08:51 +05:30
## Add a pipeline schedule
2020-04-08 14:13:33 +05:30
2022-05-07 20:08:51 +05:30
> Scheduled pipelines for tags [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/23292) in GitLab 14.9.
2020-04-08 14:13:33 +05:30
2022-05-07 20:08:51 +05:30
To add a pipeline schedule:
2020-04-08 14:13:33 +05:30
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects** and find your project.
2022-05-07 20:08:51 +05:30
1. On the left sidebar, select **CI/CD > Schedules**.
1. Select **New schedule** and fill in the form.
- **Interval Pattern**: Select one of the preconfigured intervals, or enter a custom
interval in [cron notation](../../topics/cron/index.md). You can use any cron value,
but scheduled pipelines cannot run more frequently than the instance's
[maximum scheduled pipeline frequency](../../administration/cicd.md#change-maximum-scheduled-pipeline-frequency).
- **Target branch or tag**: Select the branch or tag for the pipeline.
- **Variables**: Add any number of [CI/CD variables](../variables/index.md) to the schedule.
These variables are available only when the scheduled pipeline runs,
and not in any other pipeline run.
2020-04-08 14:13:33 +05:30
2022-11-25 23:54:43 +05:30
If the project already has the [maximum number of pipeline schedules](../../administration/instance_limits.md#number-of-pipeline-schedules),
you must delete unused schedules before you can add another.
2022-05-03 16:02:30 +05:30
## Edit a pipeline schedule
> Introduced in GitLab 14.8, only a pipeline schedule owner can edit the schedule.
The owner of a pipeline schedule can edit it:
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects** and find your project.
2022-05-03 16:02:30 +05:30
1. In the left sidebar, select **CI/CD > Schedules**.
1. Next to the schedule, select **Edit** (**{pencil}**) and fill in the form.
The user must have the Developer role or above for the project. If the user is
2022-05-07 20:08:51 +05:30
not the owner of the schedule, they must first [take ownership](#take-ownership)
2022-05-03 16:02:30 +05:30
of the schedule.
2022-05-07 20:08:51 +05:30
## Run manually
2020-04-08 14:13:33 +05:30
2022-05-07 20:08:51 +05:30
To trigger a pipeline schedule manually, so that it runs immediately instead of
the next scheduled time:
2020-04-08 14:13:33 +05:30
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects** and find your project.
2022-05-07 20:08:51 +05:30
1. On the left sidebar, select **CI/CD > Schedules**.
1. On the right of the list, for
the pipeline you want to run, select **Play** (**{play}**).
2020-04-08 14:13:33 +05:30
2022-05-07 20:08:51 +05:30
You can manually run scheduled pipelines once per minute.
2020-04-08 14:13:33 +05:30
2022-05-07 20:08:51 +05:30
## Take ownership
2020-04-08 14:13:33 +05:30
2022-05-07 20:08:51 +05:30
Scheduled pipelines execute with the permissions of the user
who owns the schedule. The pipeline has access to the same resources as the pipeline owner,
including [protected environments](../environments/protected_environments.md) and the
[CI/CD job token](../jobs/ci_job_token.md).
2020-04-08 14:13:33 +05:30
2022-05-07 20:08:51 +05:30
To take ownership of a pipeline created by a different user:
2020-04-08 14:13:33 +05:30
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects** and find your project.
2022-05-07 20:08:51 +05:30
1. On the left sidebar, select **CI/CD > Schedules**.
1. On the right of the list, for
the pipeline you want to become owner of, select **Take ownership**.
2020-04-08 14:13:33 +05:30
2022-05-07 20:08:51 +05:30
## Related topics
2020-04-08 14:13:33 +05:30
2022-05-07 20:08:51 +05:30
- Pipeline schedules can be maintained by using the [Pipeline schedules API](../../api/pipeline_schedules.md).
- You can [control which jobs are added to scheduled pipelines](../jobs/job_control.md#run-jobs-for-scheduled-pipelines).
2020-04-08 14:13:33 +05:30
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
one might have when setting this up, or when something is changed, or on upgrading, it's
important to describe those, too. Think of things that may go wrong and include them here.
This is important to minimize requests for support, and to avoid doc comments with
questions that you know someone might ask.
2023-01-13 00:05:48 +05:30
Each scenario can be a third-level heading, for example `### Getting error message X`.
2020-04-08 14:13:33 +05:30
If you have none to add when creating a doc, leave this section in place
but commented out to help encourage others to add to it in the future. -->