Commit b5ddd3b8 authored by Nick Gaskill's avatar Nick Gaskill

Merge branch '326498-evaluate-master-main-usage-and-resolve-issues-package' into 'master'

Resolve "Evaluate master/main usage and resolve issues - Package"

See merge request gitlab-org/gitlab!66469
parents 4b456219 0de30c56
...@@ -63,7 +63,7 @@ a group's namespace, rather than a user's namespace. Composer packages ...@@ -63,7 +63,7 @@ a group's namespace, rather than a user's namespace. Composer packages
git commit -m 'Composer package test' git commit -m 'Composer package test'
git tag v1.0.0 git tag v1.0.0
git remote add origin git@gitlab.example.com:<namespace>/<project-name>.git git remote add origin git@gitlab.example.com:<namespace>/<project-name>.git
git push --set-upstream origin master git push --set-upstream origin main
git push origin v1.0.0 git push origin v1.0.0
``` ```
......
...@@ -236,7 +236,7 @@ combining the two to save us some typing in the `script` section. ...@@ -236,7 +236,7 @@ combining the two to save us some typing in the `script` section.
Here's a more elaborate example that splits up the tasks into 4 pipeline stages, Here's a more elaborate example that splits up the tasks into 4 pipeline stages,
including two tests that run in parallel. The `build` is stored in the container including two tests that run in parallel. The `build` is stored in the container
registry and used by subsequent stages, downloading the image registry and used by subsequent stages, downloading the image
when needed. Changes to `master` also get tagged as `latest` and deployed using when needed. Changes to `main` also get tagged as `latest` and deployed using
an application-specific deploy script: an application-specific deploy script:
```yaml ```yaml
...@@ -285,14 +285,14 @@ release-image: ...@@ -285,14 +285,14 @@ release-image:
- docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE - docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
- docker push $CONTAINER_RELEASE_IMAGE - docker push $CONTAINER_RELEASE_IMAGE
only: only:
- master - main
deploy: deploy:
stage: deploy stage: deploy
script: script:
- ./deploy.sh - ./deploy.sh
only: only:
- master - main
``` ```
NOTE: NOTE:
...@@ -436,7 +436,7 @@ build_image: ...@@ -436,7 +436,7 @@ build_image:
only: only:
- branches - branches
except: except:
- master - main
delete_image: delete_image:
image: docker:19.03.12 image: docker:19.03.12
...@@ -457,7 +457,7 @@ delete_image: ...@@ -457,7 +457,7 @@ delete_image:
only: only:
- branches - branches
except: except:
- master - main
``` ```
NOTE: NOTE:
...@@ -605,10 +605,10 @@ Here are examples of regex patterns you may want to use: ...@@ -605,10 +605,10 @@ Here are examples of regex patterns you may want to use:
v.+ v.+
``` ```
- Match only the tag named `master`: - Match only the tag named `main`:
```plaintext ```plaintext
master main
``` ```
- Match tags that are either named or start with `release`: - Match tags that are either named or start with `release`:
...@@ -617,10 +617,10 @@ Here are examples of regex patterns you may want to use: ...@@ -617,10 +617,10 @@ Here are examples of regex patterns you may want to use:
release.* release.*
``` ```
- Match tags that either start with `v`, are named `master`, or begin with `release`: - Match tags that either start with `v`, are named `main`, or begin with `release`:
```plaintext ```plaintext
(?:v.+|master|release.*) (?:v.+|main|release.*)
``` ```
### Set cleanup limits to conserve resources ### Set cleanup limits to conserve resources
...@@ -675,11 +675,11 @@ You can set, update, and disable the cleanup policies using the GitLab API. ...@@ -675,11 +675,11 @@ You can set, update, and disable the cleanup policies using the GitLab API.
Examples: Examples:
- Select all tags, keep at least 1 tag per image, clean up any tag older than 14 days, run once a month, preserve any images with the name `master` and the policy is enabled: - Select all tags, keep at least 1 tag per image, clean up any tag older than 14 days, run once a month, preserve any images with the name `main` and the policy is enabled:
```shell ```shell
curl --request PUT --header 'Content-Type: application/json;charset=UTF-8' --header "PRIVATE-TOKEN: <your_access_token>" \ curl --request PUT --header 'Content-Type: application/json;charset=UTF-8' --header "PRIVATE-TOKEN: <your_access_token>" \
--data-binary '{"container_expiration_policy_attributes":{"cadence":"1month","enabled":true,"keep_n":1,"older_than":"14d","name_regex":"","name_regex_delete":".*","name_regex_keep":".*-master"}}' \ --data-binary '{"container_expiration_policy_attributes":{"cadence":"1month","enabled":true,"keep_n":1,"older_than":"14d","name_regex":"","name_regex_delete":".*","name_regex_keep":".*-main"}}' \
"https://gitlab.example.com/api/v4/projects/2" "https://gitlab.example.com/api/v4/projects/2"
``` ```
......
...@@ -711,7 +711,7 @@ you can configure GitLab CI/CD to build new packages automatically. ...@@ -711,7 +711,7 @@ you can configure GitLab CI/CD to build new packages automatically.
### Create Maven packages with GitLab CI/CD by using Maven ### Create Maven packages with GitLab CI/CD by using Maven
You can create a new package each time the `master` branch is updated. You can create a new package each time the `main` branch is updated.
1. Create a `ci_settings.xml` file that serves as Maven's `settings.xml` file. 1. Create a `ci_settings.xml` file that serves as Maven's `settings.xml` file.
...@@ -768,7 +768,7 @@ You can create a new package each time the `master` branch is updated. ...@@ -768,7 +768,7 @@ You can create a new package each time the `master` branch is updated.
script: script:
- 'mvn deploy -s ci_settings.xml' - 'mvn deploy -s ci_settings.xml'
only: only:
- master - main
``` ```
1. Push those files to your repository. 1. Push those files to your repository.
...@@ -781,7 +781,7 @@ user's home location. In this example: ...@@ -781,7 +781,7 @@ user's home location. In this example:
### Create Maven packages with GitLab CI/CD by using Gradle ### Create Maven packages with GitLab CI/CD by using Gradle
You can create a package each time the `master` branch You can create a package each time the `main` branch
is updated. is updated.
1. Authenticate with [a CI job token in Gradle](#authenticate-with-a-ci-job-token-in-gradle). 1. Authenticate with [a CI job token in Gradle](#authenticate-with-a-ci-job-token-in-gradle).
...@@ -794,7 +794,7 @@ is updated. ...@@ -794,7 +794,7 @@ is updated.
script: script:
- 'gradle publish' - 'gradle publish'
only: only:
- master - main
``` ```
1. Commit files to your repository. 1. Commit files to your repository.
......
...@@ -322,7 +322,7 @@ If you're using NuGet with GitLab CI/CD, a CI job token can be used instead of a ...@@ -322,7 +322,7 @@ If you're using NuGet with GitLab CI/CD, a CI job token can be used instead of a
personal access token or deploy token. The token inherits the permissions of the personal access token or deploy token. The token inherits the permissions of the
user that generates the pipeline. user that generates the pipeline.
This example shows how to create a new package each time the `master` branch is This example shows how to create a new package each time the `main` branch is
updated: updated:
1. Add a `deploy` job to your `.gitlab-ci.yml` file: 1. Add a `deploy` job to your `.gitlab-ci.yml` file:
...@@ -340,7 +340,7 @@ updated: ...@@ -340,7 +340,7 @@ updated:
- dotnet nuget add source "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/nuget/index.json" --name gitlab --username gitlab-ci-token --password $CI_JOB_TOKEN --store-password-in-clear-text - dotnet nuget add source "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/nuget/index.json" --name gitlab --username gitlab-ci-token --password $CI_JOB_TOKEN --store-password-in-clear-text
- dotnet nuget push "bin/Release/*.nupkg" --source gitlab - dotnet nuget push "bin/Release/*.nupkg" --source gitlab
only: only:
- master - main
``` ```
1. Commit the changes and push it to your GitLab repository to trigger a new CI/CD build. 1. Commit the changes and push it to your GitLab repository to trigger a new CI/CD build.
......
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