diff options
Diffstat (limited to 'doc/ci/jobs/job_control.md')
-rw-r--r-- | doc/ci/jobs/job_control.md | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/doc/ci/jobs/job_control.md b/doc/ci/jobs/job_control.md index b17db47eef2..09c7500a883 100644 --- a/doc/ci/jobs/job_control.md +++ b/doc/ci/jobs/job_control.md @@ -271,7 +271,7 @@ check the value of the `$CI_PIPELINE_SOURCE` variable: | `push` | For pipelines triggered by a `git push` event, including for branches and tags. | | `schedule` | For [scheduled pipelines](../pipelines/schedules.md). | | `trigger` | For pipelines created by using a [trigger token](../triggers/index.md#configure-cicd-jobs-to-run-in-triggered-pipelines). | -| `web` | For pipelines created by using **Run pipeline** button in the GitLab UI, from the project's **CI/CD > Pipelines** section. | +| `web` | For pipelines created by using **Run pipeline** button in the GitLab UI, from the project's **Build > Pipelines** section. | | `webide` | For pipelines created by using the [WebIDE](../../user/project/web_ide/index.md). | The following example runs the job as a manual job in scheduled pipelines or in push @@ -338,7 +338,7 @@ You can use the `$` character for both variables and paths. For example, if the `$DOCKERFILES_DIR` variable exists, its value is used. If it does not exist, the `$` is interpreted as being part of a path. -## Reuse rules in different jobs +### Reuse rules in different jobs > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/322992) in GitLab 14.3. @@ -369,6 +369,10 @@ job2: ## Specify when jobs run with `only` and `except` +NOTE: +`only` and `except` are not being actively developed. [`rules`](#specify-when-jobs-run-with-rules) +is the preferred keyword to control when to add jobs to pipelines. + You can use [`only`](../yaml/index.md#only--except) and [`except`](../yaml/index.md#only--except) to control when to add jobs to pipelines. @@ -377,14 +381,18 @@ to control when to add jobs to pipelines. ### `only:refs` / `except:refs` examples -`only` or `except` used without `refs` is the same as -[`only:refs` / `except/refs`](../yaml/index.md#onlyrefs--exceptrefs) +You can use `only` or `except` with: -In the following example, `job` runs only for: +- Specific keywords. See the full list in the [`only`/`except` syntax reference](../yaml/index.md#onlyrefs--exceptrefs). +- Branch names. Avoid branch names that are exactly the same as a specific keyword. + For example, jobs configured to run for the `tags` keyword (tag pipelines) + would also run for a branch named `tags`. +- Regex patterns to specify a range of branch names. -- Git tags -- [Triggers](../triggers/index.md#configure-cicd-jobs-to-run-in-triggered-pipelines) -- [Scheduled pipelines](../pipelines/schedules.md) +The following examples omit `refs` because `only` or `except` used without `refs` +is the same as [`only:refs` / `except/refs`](../yaml/index.md#onlyrefs--exceptrefs). + +For example: ```yaml job: @@ -395,6 +403,12 @@ job: - schedules ``` +In this example, `job` runs only for: + +- Git tags +- [Triggers](../triggers/index.md#configure-cicd-jobs-to-run-in-triggered-pipelines) +- [Scheduled pipelines](../pipelines/schedules.md) + To execute jobs only for the parent repository and not forks: ```yaml @@ -1101,5 +1115,5 @@ to change this behavior. To run protected manual jobs: - Add the administrator as a direct member of the private project (any role) -- [Impersonate a user](../../user/admin_area/index.md#user-impersonation) who is a +- [Impersonate a user](../../administration/admin_area.md#user-impersonation) who is a direct member of the project. |