diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /doc/ci/environments/index.md | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) | |
download | gitlab-ce-311b0269b4eb9839fa63f80c8d7a58f32b8138a0.tar.gz |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'doc/ci/environments/index.md')
-rw-r--r-- | doc/ci/environments/index.md | 89 |
1 files changed, 82 insertions, 7 deletions
diff --git a/doc/ci/environments/index.md b/doc/ci/environments/index.md index ca81ad30317..87d7b9f9e30 100644 --- a/doc/ci/environments/index.md +++ b/doc/ci/environments/index.md @@ -21,13 +21,13 @@ GitLab: If you have a deployment service like [Kubernetes](../../user/infrastructure/clusters/index.md) associated with your project, you can use it to assist with your deployments. -You can even access a [web terminal](#web-terminals) for your environment from within GitLab. +You can even access a [web terminal](#web-terminals-deprecated) for your environment from within GitLab. ## View environments and deployments Prerequisites: -- You must have a minimum of [Reporter permission](../../user/permissions.md#project-members-permissions). +- You must have at least the Reporter [role](../../user/permissions.md#project-members-permissions). To view a list of environments and deployments: @@ -159,9 +159,9 @@ deploy_prod: environment: name: production url: https://example.com - when: manual rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + when: manual ``` The `when: manual` action: @@ -171,9 +171,13 @@ The `when: manual` action: You can find the play button in the pipelines, environments, deployments, and jobs views. -## Configure Kubernetes deployments +## Configure Kubernetes deployments (DEPRECATED) -> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/27630) in GitLab 12.6. +> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/27630) in GitLab 12.6. +> - [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. + +WARNING: +This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. If you are deploying to a [Kubernetes cluster](../../user/infrastructure/clusters/index.md) associated with your project, you can configure these deployments from your @@ -308,6 +312,31 @@ Note the following: for these jobs. This ensures that runners can fetch the repository even after a feature branch is deleted. For more information, see [Ref Specs for Runners](../pipelines/index.md#ref-specs-for-runners). +## Track newly included merge requests per deployment + +GitLab can track newly included merge requests per deployment. +When a deployment succeeded, the system calculates commit-diffs between the latest deployment and the previous deployment. +This tracking information can be fetched via the [Deployment API](../../api/deployments.md#list-of-merge-requests-associated-with-a-deployment) +and displayed at a post-merge pipeline in [merge request pages](../../user/project/merge_requests/index.md). + +To activate this tracking, your environment must be configured in the following: + +- [Environment name](../yaml/index.md#environmentname) is not foldered with `/` (that is, top-level/long-lived environments), _OR_ +- [Environment tier](#deployment-tier-of-environments) is either `production` or `staging`. + +Here are the example setups of [`environment` keyword](../yaml/index.md#environment) in `.gitlab-ci.yml`: + +```yaml +# Trackable +environment: production +environment: production/aws +environment: development + +# Non Trackable +environment: review/$CI_COMMIT_REF_SLUG +environment: testing/aws +``` + ## Working with environments Once environments are configured, GitLab provides many features for working with them, @@ -631,7 +660,12 @@ It may take a minute or two for data to appear after initial deployment. Metric charts can be embedded in GitLab Flavored Markdown. See [Embedding Metrics in GitLab Flavored Markdown](../../operations/metrics/embed.md) for more details. -### Web terminals +### Web terminals (DEPRECATED) + +> [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. + +WARNING: +This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. If you deploy to your environments with the help of a deployment service (for example, the [Kubernetes integration](../../user/infrastructure/clusters/index.md)), GitLab can open @@ -680,6 +714,29 @@ fetch line: fetch = +refs/environments/*:refs/remotes/origin/environments/* ``` +### Archive Old Deployments + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/73628) in GitLab 14.5. + +FLAG: +On self-managed GitLab, by default this feature is not available. To make it available per project or for your entire instance, ask an administrator to [enable the feature flag](../../administration/feature_flags.md) named `deployments_archive`. On GitLab.com, this feature will be rolled out gradually. + +When a new deployment happens in your project, +GitLab creates [a special Git-ref to the deployment](#check-out-deployments-locally). +Since these Git-refs are populated from the remote GitLab repository, +you could find that some Git operations, such as `git-fetch` and `git-pull`, +become slower as the number of deployments in your project increases. + +To maintain the efficiency of your Git operations, GitLab keeps +only recent deployment refs (up to 50,000) and deletes the rest of the old deployment refs. +Archived deployments are still available, in the UI or by using the API, for auditing purposes. +Also, you can still fetch the deployed commit from the repository +with specifying the commit SHA (for example, `git checkout <deployment-sha>`), even after archive. + +NOTE: +GitLab preserves all commits as [`keep-around` refs](../../user/project/repository/reducing_the_repo_size_using_git.md) +so that deployed commits are not garbage collected, even if it's not referenced by the deployment refs. + ### Scope environments with specs > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/2112) in GitLab Premium 9.4. @@ -822,7 +879,9 @@ To ensure the `action: stop` can always run when needed, you can: > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/21182) in GitLab 14.4. FLAG: -On self-managed GitLab, by default this bug fix is not available. To make it available per project or for your entire instance, ask an administrator to [enable the `surface_environment_creation_failure` flag](../../administration/feature_flags.md). On GitLab.com, this bug fix is not available, but will be rolled out shortly. +On self-managed GitLab, by default this bug fix is available. To hide the bug fix per project, +ask an administrator to [disable the feature flag](../../administration/feature_flags.md) named `surface_environment_creation_failure`. +On GitLab.com, this bug fix is available. If your project is configured to [create a dynamic environment](#create-a-dynamic-environment), you might encounter this error because the dynamically generated parameter can't be used for creating an environment. @@ -875,3 +934,19 @@ To fix this, use one of the following solutions: script: deploy review app environment: review/$CI_COMMIT_REF_SLUG ``` + +### Deployment refs are not found + +Starting from GitLab 14.5, GitLab [deletes old deployment refs](#archive-old-deployments) +to keep your Git repository performant. + +If you have to restore archived Git-refs, please ask an administrator of your self-managed GitLab instance +to execute the following command on Rails console: + +```ruby +Project.find_by_full_path(<your-project-full-path>).deployments.where(archived: true).each(&:create_ref) +``` + +Please note that GitLab could drop this support in the future for the performance concern. +You can open an issue in [GitLab Issue Tracker](https://gitlab.com/gitlab-org/gitlab/-/issues/new) +to discuss the behavior of this feature. |