Commit 7b2791be authored by Craig Norris's avatar Craig Norris

Merge branch 'docs-remove-master-refs-ci' into 'master'

Remove more references to master in CI docs

See merge request gitlab-org/gitlab!61973
parents 515a9f8a d4a96c57
...@@ -90,7 +90,7 @@ Parameters ...@@ -90,7 +90,7 @@ Parameters
Example request using the `PRIVATE-TOKEN` header: Example request using the `PRIVATE-TOKEN` header:
```shell ```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/download?job=test" curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/main/download?job=test"
``` ```
To use this in a [`script` definition](../ci/yaml/README.md#script) inside To use this in a [`script` definition](../ci/yaml/README.md#script) inside
...@@ -98,25 +98,25 @@ To use this in a [`script` definition](../ci/yaml/README.md#script) inside ...@@ -98,25 +98,25 @@ To use this in a [`script` definition](../ci/yaml/README.md#script) inside
- The `JOB-TOKEN` header with the GitLab-provided `CI_JOB_TOKEN` variable. - The `JOB-TOKEN` header with the GitLab-provided `CI_JOB_TOKEN` variable.
For example, the following job downloads the artifacts of the `test` job For example, the following job downloads the artifacts of the `test` job
of the `master` branch. Note that the command is wrapped into single quotes of the `main` branch. Note that the command is wrapped into single quotes
because it contains a colon (`:`): because it contains a colon (`:`):
```yaml ```yaml
artifact_download: artifact_download:
stage: test stage: test
script: script:
- 'curl --location --output artifacts.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.example.com/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/master/download?job=test"' - 'curl --location --output artifacts.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.example.com/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/main/download?job=test"'
``` ```
- Or the `job_token` attribute with the GitLab-provided `CI_JOB_TOKEN` variable. - Or the `job_token` attribute with the GitLab-provided `CI_JOB_TOKEN` variable.
For example, the following job downloads the artifacts of the `test` job For example, the following job downloads the artifacts of the `test` job
of the `master` branch: of the `main` branch:
```yaml ```yaml
artifact_download: artifact_download:
stage: test stage: test
script: script:
- 'curl --location --output artifacts.zip "https://gitlab.example.com/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/master/download?job=test&job_token=$CI_JOB_TOKEN"' - 'curl --location --output artifacts.zip "https://gitlab.example.com/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/main/download?job=test&job_token=$CI_JOB_TOKEN"'
``` ```
Possible response status codes: Possible response status codes:
...@@ -193,7 +193,7 @@ Parameters: ...@@ -193,7 +193,7 @@ Parameters:
Example request: Example request:
```shell ```shell
curl --location --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/raw/some/release/file.pdf?job=pdf" curl --location --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/main/raw/some/release/file.pdf?job=pdf"
``` ```
Possible response status codes: Possible response status codes:
...@@ -243,7 +243,7 @@ Example response: ...@@ -243,7 +243,7 @@ Example response:
"download_url": null, "download_url": null,
"id": 42, "id": 42,
"name": "rubocop", "name": "rubocop",
"ref": "master", "ref": "main",
"artifacts": [], "artifacts": [],
"runner": null, "runner": null,
"stage": "test", "stage": "test",
......
...@@ -59,8 +59,7 @@ to run. If more merge requests are added to the train, they now include the `A` ...@@ -59,8 +59,7 @@ to run. If more merge requests are added to the train, they now include the `A`
changes that are included in the target branch, and the `C` changes that are from changes that are included in the target branch, and the `C` changes that are from
the merge request already in the train. the merge request already in the train.
Read more about Read more about [how merge trains keep your master green](https://about.gitlab.com/blog/2020/01/30/all-aboard-merge-trains/).
[how merge trains keep your master green](https://about.gitlab.com/blog/2020/01/30/all-aboard-merge-trains/).
<i class="fa fa-youtube-play youtube" aria-hidden="true"></i> <i class="fa fa-youtube-play youtube" aria-hidden="true"></i>
Watch this video for a demonstration on [how parallel execution Watch this video for a demonstration on [how parallel execution
......
...@@ -271,7 +271,7 @@ trigger_job: ...@@ -271,7 +271,7 @@ trigger_job:
### Mirroring status from upstream pipeline ### Mirroring status from upstream pipeline
You can mirror the pipeline status from an upstream pipeline to a bridge job by You can mirror the pipeline status from an upstream pipeline to a bridge job by
using the `needs:pipeline` keyword. The latest pipeline status from master is using the `needs:pipeline` keyword. The latest pipeline status from the default branch is
replicated to the bridge job. replicated to the bridge job.
Example: Example:
......
...@@ -140,21 +140,21 @@ By using cURL you can trigger a pipeline rerun with minimal effort, for example: ...@@ -140,21 +140,21 @@ By using cURL you can trigger a pipeline rerun with minimal effort, for example:
```shell ```shell
curl --request POST \ curl --request POST \
--form token=TOKEN \ --form token=TOKEN \
--form ref=master \ --form ref=main \
"https://gitlab.example.com/api/v4/projects/9/trigger/pipeline" "https://gitlab.example.com/api/v4/projects/9/trigger/pipeline"
``` ```
In this case, the pipeline for the project with ID `9` runs on the `master` branch. In this case, the pipeline for the project with ID `9` runs on the `main` branch.
Alternatively, you can pass the `token` and `ref` arguments in the query string: Alternatively, you can pass the `token` and `ref` arguments in the query string:
```shell ```shell
curl --request POST \ curl --request POST \
"https://gitlab.example.com/api/v4/projects/9/trigger/pipeline?token=TOKEN&ref=master" "https://gitlab.example.com/api/v4/projects/9/trigger/pipeline?token=TOKEN&ref=main"
``` ```
You can also benefit by using triggers in your `.gitlab-ci.yml`. Let's say that You can also benefit by using triggers in your `.gitlab-ci.yml`. Let's say that
you have two projects, A and B, and you want to trigger a pipeline on the `master` you have two projects, A and B, and you want to trigger a pipeline on the `main`
branch of project B whenever a tag on project A is created. This is the job you branch of project B whenever a tag on project A is created. This is the job you
need to add in project A's `.gitlab-ci.yml`: need to add in project A's `.gitlab-ci.yml`:
...@@ -162,7 +162,7 @@ need to add in project A's `.gitlab-ci.yml`: ...@@ -162,7 +162,7 @@ need to add in project A's `.gitlab-ci.yml`:
trigger_pipeline: trigger_pipeline:
stage: deploy stage: deploy
script: script:
- 'curl --request POST --form token=TOKEN --form ref=master "https://gitlab.example.com/api/v4/projects/9/trigger/pipeline"' - 'curl --request POST --form token=TOKEN --form ref=main "https://gitlab.example.com/api/v4/projects/9/trigger/pipeline"'
only: only:
- tags - tags
``` ```
...@@ -261,11 +261,11 @@ of all types of variables. ...@@ -261,11 +261,11 @@ of all types of variables.
## Using cron to trigger nightly pipelines ## Using cron to trigger nightly pipelines
Whether you craft a script or just run cURL directly, you can trigger jobs Whether you craft a script or just run cURL directly, you can trigger jobs
in conjunction with cron. The example below triggers a job on the `master` in conjunction with cron. The example below triggers a job on the `main` branch
branch of project with ID `9` every night at `00:30`: branch of project with ID `9` every night at `00:30`:
```shell ```shell
30 0 * * * curl --request POST --form token=TOKEN --form ref=master "https://gitlab.example.com/api/v4/projects/9/trigger/pipeline" 30 0 * * * curl --request POST --form token=TOKEN --form ref=main "https://gitlab.example.com/api/v4/projects/9/trigger/pipeline"
``` ```
This behavior can also be achieved through the GitLab UI with This behavior can also be achieved through the GitLab UI with
......
...@@ -253,7 +253,7 @@ variables: ...@@ -253,7 +253,7 @@ variables:
workflow: workflow:
rules: rules:
- if: $CI_COMMIT_REF_NAME =~ /master/ - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
variables: variables:
DEPLOY_VARIABLE: "deploy-production" # Override globally-defined DEPLOY_VARIABLE DEPLOY_VARIABLE: "deploy-production" # Override globally-defined DEPLOY_VARIABLE
- if: $CI_COMMIT_REF_NAME =~ /feature/ - if: $CI_COMMIT_REF_NAME =~ /feature/
...@@ -265,7 +265,7 @@ job1: ...@@ -265,7 +265,7 @@ job1:
variables: variables:
DEPLOY_VARIABLE: "job1-default-deploy" DEPLOY_VARIABLE: "job1-default-deploy"
rules: rules:
- if: $CI_COMMIT_REF_NAME =~ /master/ - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
variables: # Override DEPLOY_VARIABLE defined variables: # Override DEPLOY_VARIABLE defined
DEPLOY_VARIABLE: "job1-deploy-production" # at the job level. DEPLOY_VARIABLE: "job1-deploy-production" # at the job level.
- when: on_success # Run the job in other cases - when: on_success # Run the job in other cases
...@@ -279,7 +279,7 @@ job2: ...@@ -279,7 +279,7 @@ job2:
- echo "Run another script if $IS_A_FEATURE exists" - echo "Run another script if $IS_A_FEATURE exists"
``` ```
When the branch is `master`: When the branch is the default branch:
- job1's `DEPLOY_VARIABLE` is `job1-deploy-production`. - job1's `DEPLOY_VARIABLE` is `job1-deploy-production`.
- job2's `DEPLOY_VARIABLE` is `deploy-production`. - job2's `DEPLOY_VARIABLE` is `deploy-production`.
...@@ -559,7 +559,7 @@ You can also specify a `ref`. If you do not specify a value, the ref defaults to ...@@ -559,7 +559,7 @@ You can also specify a `ref`. If you do not specify a value, the ref defaults to
```yaml ```yaml
include: include:
- project: 'my-group/my-project' - project: 'my-group/my-project'
ref: master ref: main
file: '/templates/.gitlab-ci-template.yml' file: '/templates/.gitlab-ci-template.yml'
- project: 'my-group/my-project' - project: 'my-group/my-project'
...@@ -584,7 +584,7 @@ You can include multiple files from the same project: ...@@ -584,7 +584,7 @@ You can include multiple files from the same project:
```yaml ```yaml
include: include:
- project: 'my-group/my-project' - project: 'my-group/my-project'
ref: master ref: main
file: file:
- '/templates/.builds.yml' - '/templates/.builds.yml'
- '/templates/.tests.yml' - '/templates/.tests.yml'
...@@ -598,7 +598,7 @@ authentication in the remote URL is not supported. For example: ...@@ -598,7 +598,7 @@ authentication in the remote URL is not supported. For example:
```yaml ```yaml
include: include:
- remote: 'https://gitlab.com/example-project/-/raw/master/.gitlab-ci.yml' - remote: 'https://gitlab.com/example-project/-/raw/main/.gitlab-ci.yml'
``` ```
All [nested includes](#nested-includes) execute without context as a public user, All [nested includes](#nested-includes) execute without context as a public user,
...@@ -1137,7 +1137,7 @@ For example: ...@@ -1137,7 +1137,7 @@ For example:
docker build: docker build:
script: docker build -t my-image:$CI_COMMIT_REF_SLUG . script: docker build -t my-image:$CI_COMMIT_REF_SLUG .
rules: rules:
- if: '$CI_COMMIT_BRANCH == "master"' - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: delayed when: delayed
start_in: '3 hours' start_in: '3 hours'
allow_failure: true allow_failure: true
...@@ -1335,7 +1335,7 @@ For example: ...@@ -1335,7 +1335,7 @@ For example:
job: job:
script: echo "Hello, Rules!" script: echo "Hello, Rules!"
rules: rules:
- if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^feature/ && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"' - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^feature/ && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
when: always when: always
- if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^feature/' - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^feature/'
when: manual when: manual
...@@ -1533,7 +1533,7 @@ the particular rule triggers the job. ...@@ -1533,7 +1533,7 @@ the particular rule triggers the job.
job: job:
script: echo "Hello, Rules!" script: echo "Hello, Rules!"
rules: rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"' - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
when: manual when: manual
allow_failure: true allow_failure: true
``` ```
...@@ -1554,7 +1554,7 @@ job: ...@@ -1554,7 +1554,7 @@ job:
variables: variables:
DEPLOY_VARIABLE: "default-deploy" DEPLOY_VARIABLE: "default-deploy"
rules: rules:
- if: $CI_COMMIT_REF_NAME =~ /master/ - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
variables: # Override DEPLOY_VARIABLE defined variables: # Override DEPLOY_VARIABLE defined
DEPLOY_VARIABLE: "deploy-production" # at the job level. DEPLOY_VARIABLE: "deploy-production" # at the job level.
- if: $CI_COMMIT_REF_NAME =~ /feature/ - if: $CI_COMMIT_REF_NAME =~ /feature/
...@@ -1602,7 +1602,7 @@ job1: ...@@ -1602,7 +1602,7 @@ job1:
script: script:
- echo This rule uses parentheses. - echo This rule uses parentheses.
rules: rules:
if: ($CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "develop") && $MY_VARIABLE if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH == "develop") && $MY_VARIABLE
``` ```
WARNING: WARNING:
...@@ -1968,12 +1968,12 @@ build_job: ...@@ -1968,12 +1968,12 @@ build_job:
needs: needs:
- project: namespace/group/project-name - project: namespace/group/project-name
job: build-1 job: build-1
ref: master ref: main
artifacts: true artifacts: true
``` ```
`build_job` downloads the artifacts from the latest successful `build-1` job `build_job` downloads the artifacts from the latest successful `build-1` job
on the `master` branch in the `group/project-name` project. If the project is in the on the `main` branch in the `group/project-name` project. If the project is in the
same group or namespace, you can omit them from the `project:` keyword. For example, same group or namespace, you can omit them from the `project:` keyword. For example,
`project: group/project-name` or `project: project-name`. `project: group/project-name` or `project: project-name`.
...@@ -2084,9 +2084,9 @@ error similar to: ...@@ -2084,9 +2084,9 @@ error similar to:
In this example: In this example:
- When the branch is `master`, the `build` job exists in the pipeline, and the `rspec` - When the branch is the default branch, the `build` job exists in the pipeline, and the `rspec`
job waits for it to complete before starting. job waits for it to complete before starting.
- When the branch is not `master`, the `build` job does not exist in the pipeline. - When the branch is not the default branch, the `build` job does not exist in the pipeline.
The `rspec` job runs immediately (similar to `needs: []`) because its `needs` The `rspec` job runs immediately (similar to `needs: []`) because its `needs`
relationship to the `build` job is optional. relationship to the `build` job is optional.
...@@ -2094,7 +2094,7 @@ In this example: ...@@ -2094,7 +2094,7 @@ In this example:
build: build:
stage: build stage: build
rules: rules:
- if: $CI_COMMIT_REF_NAME == "master" - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
rspec: rspec:
stage: test stage: test
...@@ -2330,7 +2330,7 @@ To protect a manual job: ...@@ -2330,7 +2330,7 @@ To protect a manual job:
url: https://example.com url: https://example.com
when: manual when: manual
only: only:
- master - main
``` ```
1. In the [protected environments settings](../environments/protected_environments.md#protecting-environments), 1. In the [protected environments settings](../environments/protected_environments.md#protecting-environments),
...@@ -4039,7 +4039,7 @@ child-pipeline: ...@@ -4039,7 +4039,7 @@ child-pipeline:
trigger: trigger:
include: include:
- project: 'my-group/my-pipeline-library' - project: 'my-group/my-pipeline-library'
ref: 'master' ref: 'main'
file: '/path/to/child-pipeline.yml' file: '/path/to/child-pipeline.yml'
``` ```
...@@ -4638,7 +4638,7 @@ pages: ...@@ -4638,7 +4638,7 @@ pages:
paths: paths:
- public - public
only: only:
- master - main
``` ```
View the [GitLab Pages user documentation](../../user/project/pages/index.md). View the [GitLab Pages user documentation](../../user/project/pages/index.md).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment