summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab/issue_templates/Feature proposal.md9
-rw-r--r--app/controllers/projects_controller.rb1
-rw-r--r--app/helpers/merge_requests_helper.rb2
-rw-r--r--app/models/merge_request.rb7
-rw-r--r--app/models/project.rb1
-rw-r--r--app/models/project_setting.rb15
-rw-r--r--app/serializers/merge_request_poll_cached_widget_entity.rb12
-rw-r--r--app/serializers/merge_request_poll_widget_entity.rb12
-rw-r--r--app/services/merge_requests/ff_merge_service.rb2
-rw-r--r--app/services/merge_requests/merge_base_service.rb2
-rw-r--r--app/services/merge_requests/merge_service.rb2
-rw-r--r--app/services/merge_requests/squash_service.rb7
-rw-r--r--changelogs/unreleased/17613-configurable-defaults-for-squash-commits-option.yml5
-rw-r--r--changelogs/unreleased/fj-224657-include-snippets-size-in-group-statistics.yml5
-rw-r--r--changelogs/unreleased/sh-error-tracking-query-canceled.yml5
-rw-r--r--db/migrate/20200526193555_add_squash_option_to_project.rb9
-rw-r--r--db/structure.sql2
-rw-r--r--doc/.vale/gitlab/FutureTense.yml (renamed from doc/.linting/vale/styles/gitlab/FutureTense.yml)2
-rw-r--r--doc/api/groups.md3
-rw-r--r--doc/gitlab-basics/start-using-git.md214
-rw-r--r--doc/topics/git/index.md3
-rw-r--r--doc/user/application_security/dependency_scanning/index.md1
-rw-r--r--doc/user/group/saml_sso/group_managed_accounts.md2
-rw-r--r--doc/user/project/clusters/add_remove_clusters.md5
-rw-r--r--doc/user/project/clusters/index.md272
-rw-r--r--doc/user/project/integrations/prometheus.md6
-rw-r--r--doc/user/project/operations/alert_management.md1
-rw-r--r--doc/user/project/operations/img/alert_list_v13_1.pngbin25167 -> 24192 bytes
-rw-r--r--lib/api/entities/group.rb1
-rw-r--r--lib/gitlab/error_tracking.rb1
-rw-r--r--locale/gitlab.pot6
-rwxr-xr-xscripts/trigger-build1
-rw-r--r--spec/controllers/projects/merge_requests_controller_spec.rb4
-rw-r--r--spec/requests/api/groups_spec.rb5
-rw-r--r--spec/requests/api/merge_requests_spec.rb2
-rw-r--r--spec/serializers/merge_request_poll_cached_widget_entity_spec.rb22
-rw-r--r--spec/serializers/merge_request_poll_widget_entity_spec.rb22
-rw-r--r--spec/services/auto_merge/base_service_spec.rb2
-rw-r--r--spec/services/merge_requests/merge_service_spec.rb19
-rw-r--r--spec/services/merge_requests/squash_service_spec.rb36
40 files changed, 520 insertions, 208 deletions
diff --git a/.gitlab/issue_templates/Feature proposal.md b/.gitlab/issue_templates/Feature proposal.md
index 45b5fc85cd1..589310b4cef 100644
--- a/.gitlab/issue_templates/Feature proposal.md
+++ b/.gitlab/issue_templates/Feature proposal.md
@@ -43,7 +43,14 @@ https://about.gitlab.com/handbook/engineering/ux/ux-research-training/user-story
### Permissions and Security
-<!-- What permissions are required to perform the described actions? Are they consistent with the existing permissions as documented for users, groups, and projects as appropriate? Is the proposed behavior consistent between the UI, API, and other access methods (e.g. email replies)?-->
+<!-- What permissions are required to perform the described actions? Are they consistent with the existing permissions as documented for users, groups, and projects as appropriate? Is the proposed behavior consistent between the UI, API, and other access methods (e.g. email replies)?
+Consider adding checkboxes and expectations of users with certain levels of membership https://docs.gitlab.com/ee/user/permissions.html
+* [ ] Add expected impact to members with no access (0)
+* [ ] Add expected impact to Guest (10) members
+* [ ] Add expected impact to Reporter (20) members
+* [ ] Add expected impact to Developer (30) members
+* [ ] Add expected impact to Maintainer (40) members
+* [ ] Add expected impact to Owner (50) members -->
### Documentation
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 36ca88da1c7..00c01c86ae2 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -405,6 +405,7 @@ class ProjectsController < Projects::ApplicationController
],
project_setting_attributes: %i[
show_default_award_emojis
+ squash_option
]
]
end
diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb
index 7940ec1162b..caf39741543 100644
--- a/app/helpers/merge_requests_helper.rb
+++ b/app/helpers/merge_requests_helper.rb
@@ -118,7 +118,7 @@ module MergeRequestsHelper
auto_merge_strategy: AutoMergeService::STRATEGY_MERGE_WHEN_PIPELINE_SUCCEEDS,
should_remove_source_branch: true,
sha: merge_request.diff_head_sha,
- squash: merge_request.squash
+ squash: merge_request.squash_on_merge?
}
end
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index ddd0dbbc8dc..d491c9e44a5 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -1144,6 +1144,13 @@ class MergeRequest < ApplicationRecord
end
end
+ def squash_on_merge?
+ return true if target_project.squash_always?
+ return false if target_project.squash_never?
+
+ squash?
+ end
+
def has_ci?
return false if has_no_commits?
diff --git a/app/models/project.rb b/app/models/project.rb
index d464c39a43e..9b1e453216b 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -363,6 +363,7 @@ class Project < ApplicationRecord
to: :project_setting, allow_nil: true
delegate :scheduled?, :started?, :in_progress?, :failed?, :finished?,
prefix: :import, to: :import_state, allow_nil: true
+ delegate :squash_always?, :squash_never?, :squash_enabled_by_default?, :squash_readonly?, to: :project_setting
delegate :no_import?, to: :import_state, allow_nil: true
delegate :name, to: :owner, allow_nil: true, prefix: true
delegate :members, to: :team, prefix: true
diff --git a/app/models/project_setting.rb b/app/models/project_setting.rb
index 9022d3e879d..aca7eec3382 100644
--- a/app/models/project_setting.rb
+++ b/app/models/project_setting.rb
@@ -3,7 +3,22 @@
class ProjectSetting < ApplicationRecord
belongs_to :project, inverse_of: :project_setting
+ enum squash_option: {
+ never: 0,
+ always: 1,
+ default_on: 2,
+ default_off: 3
+ }, _prefix: 'squash'
+
self.primary_key = :project_id
+
+ def squash_enabled_by_default?
+ %w[always default_on].include?(squash_option)
+ end
+
+ def squash_readonly?
+ %w[always never].include?(squash_option)
+ end
end
ProjectSetting.prepend_if_ee('EE::ProjectSetting')
diff --git a/app/serializers/merge_request_poll_cached_widget_entity.rb b/app/serializers/merge_request_poll_cached_widget_entity.rb
index 72f629b3507..23266bfed7a 100644
--- a/app/serializers/merge_request_poll_cached_widget_entity.rb
+++ b/app/serializers/merge_request_poll_cached_widget_entity.rb
@@ -74,6 +74,18 @@ class MergeRequestPollCachedWidgetEntity < IssuableEntity
diffs_project_merge_request_path(merge_request.project, merge_request)
end
+ expose :squash_enabled_by_default do |merge_request|
+ presenter(merge_request).project.squash_enabled_by_default?
+ end
+
+ expose :squash_readonly do |merge_request|
+ presenter(merge_request).project.squash_readonly?
+ end
+
+ expose :squash_on_merge do |merge_request|
+ presenter(merge_request).squash_on_merge?
+ end
+
private
delegate :current_user, to: :request
diff --git a/app/serializers/merge_request_poll_widget_entity.rb b/app/serializers/merge_request_poll_widget_entity.rb
index aad607f358a..b0d311681c0 100644
--- a/app/serializers/merge_request_poll_widget_entity.rb
+++ b/app/serializers/merge_request_poll_widget_entity.rb
@@ -145,6 +145,18 @@ class MergeRequestPollWidgetEntity < Grape::Entity
presenter(merge_request).revert_in_fork_path
end
+ expose :squash_enabled_by_default do |merge_request|
+ presenter(merge_request).project.squash_enabled_by_default?
+ end
+
+ expose :squash_readonly do |merge_request|
+ presenter(merge_request).project.squash_readonly?
+ end
+
+ expose :squash_on_merge do |merge_request|
+ presenter(merge_request).squash_on_merge?
+ end
+
private
delegate :current_user, to: :request
diff --git a/app/services/merge_requests/ff_merge_service.rb b/app/services/merge_requests/ff_merge_service.rb
index 6f1fa607ef9..b3896d61a78 100644
--- a/app/services/merge_requests/ff_merge_service.rb
+++ b/app/services/merge_requests/ff_merge_service.rb
@@ -16,7 +16,7 @@ module MergeRequests
merge_request.target_branch,
merge_request: merge_request)
- if merge_request.squash
+ if merge_request.squash_on_merge?
merge_request.update_column(:squash_commit_sha, merge_request.in_progress_merge_commit_sha)
end
diff --git a/app/services/merge_requests/merge_base_service.rb b/app/services/merge_requests/merge_base_service.rb
index 27b5e31faab..fe09c92aab9 100644
--- a/app/services/merge_requests/merge_base_service.rb
+++ b/app/services/merge_requests/merge_base_service.rb
@@ -20,7 +20,7 @@ module MergeRequests
def source
strong_memoize(:source) do
- if merge_request.squash
+ if merge_request.squash_on_merge?
squash_sha!
else
merge_request.diff_head_sha
diff --git a/app/services/merge_requests/merge_service.rb b/app/services/merge_requests/merge_service.rb
index 8d57a76f7d0..48c1ef3cefe 100644
--- a/app/services/merge_requests/merge_service.rb
+++ b/app/services/merge_requests/merge_service.rb
@@ -56,6 +56,8 @@ module MergeRequests
'Only fast-forward merge is allowed for your project. Please update your source branch'
elsif !@merge_request.mergeable?
'Merge request is not mergeable'
+ elsif !@merge_request.squash && project.squash_always?
+ 'This project requires squashing commits when merge requests are accepted.'
end
raise_error(error) if error
diff --git a/app/services/merge_requests/squash_service.rb b/app/services/merge_requests/squash_service.rb
index 4b04d42b48e..faa2e921581 100644
--- a/app/services/merge_requests/squash_service.rb
+++ b/app/services/merge_requests/squash_service.rb
@@ -11,11 +11,14 @@ module MergeRequests
return success(squash_sha: merge_request.diff_head_sha)
end
+ return error(s_('MergeRequests|This project does not allow squashing commits when merge requests are accepted.')) if squash_forbidden?
+
if squash_in_progress?
return error(s_('MergeRequests|Squash task canceled: another squash is already in progress.'))
end
squash! || error(s_('MergeRequests|Failed to squash. Should be done manually.'))
+
rescue SquashInProgressError
error(s_('MergeRequests|An error occurred while checking whether another squash is in progress.'))
end
@@ -40,6 +43,10 @@ module MergeRequests
raise SquashInProgressError, e.message
end
+ def squash_forbidden?
+ target_project.squash_never?
+ end
+
def repository
target_project.repository
end
diff --git a/changelogs/unreleased/17613-configurable-defaults-for-squash-commits-option.yml b/changelogs/unreleased/17613-configurable-defaults-for-squash-commits-option.yml
new file mode 100644
index 00000000000..bb774921361
--- /dev/null
+++ b/changelogs/unreleased/17613-configurable-defaults-for-squash-commits-option.yml
@@ -0,0 +1,5 @@
+---
+title: Add squash commits options as a project setting.
+merge_request: 33099
+author:
+type: added
diff --git a/changelogs/unreleased/fj-224657-include-snippets-size-in-group-statistics.yml b/changelogs/unreleased/fj-224657-include-snippets-size-in-group-statistics.yml
new file mode 100644
index 00000000000..c8bc75ca696
--- /dev/null
+++ b/changelogs/unreleased/fj-224657-include-snippets-size-in-group-statistics.yml
@@ -0,0 +1,5 @@
+---
+title: Add snippets_size to Group entity
+merge_request: 35585
+author:
+type: changed
diff --git a/changelogs/unreleased/sh-error-tracking-query-canceled.yml b/changelogs/unreleased/sh-error-tracking-query-canceled.yml
new file mode 100644
index 00000000000..82751283983
--- /dev/null
+++ b/changelogs/unreleased/sh-error-tracking-query-canceled.yml
@@ -0,0 +1,5 @@
+---
+title: Avoid grouping statement timeouts in Sentry
+merge_request: 35479
+author:
+type: other
diff --git a/db/migrate/20200526193555_add_squash_option_to_project.rb b/db/migrate/20200526193555_add_squash_option_to_project.rb
new file mode 100644
index 00000000000..6dd4e1c7c8e
--- /dev/null
+++ b/db/migrate/20200526193555_add_squash_option_to_project.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddSquashOptionToProject < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :project_settings, :squash_option, :integer, default: 3, limit: 2
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index 72893e84a28..83297c9e47e 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -14163,6 +14163,7 @@ CREATE TABLE public.project_settings (
push_rule_id bigint,
show_default_award_emojis boolean DEFAULT true,
allow_merge_on_skipped_pipeline boolean,
+ squash_option smallint DEFAULT 3,
CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL))
);
@@ -23417,6 +23418,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200526153844
20200526164946
20200526164947
+20200526193555
20200526231421
20200527092027
20200527094322
diff --git a/doc/.linting/vale/styles/gitlab/FutureTense.yml b/doc/.vale/gitlab/FutureTense.yml
index 9efe3f25551..edb7e1afff1 100644
--- a/doc/.linting/vale/styles/gitlab/FutureTense.yml
+++ b/doc/.vale/gitlab/FutureTense.yml
@@ -1,5 +1,5 @@
---
-# Warning: gitlab.FutureTense
+# Suggestion: gitlab.FutureTense
#
# Checks for use of future tense in sentences. Present tense is preferred as
# much as possible.
diff --git a/doc/api/groups.md b/doc/api/groups.md
index e58506380d1..8b31851b4a7 100644
--- a/doc/api/groups.md
+++ b/doc/api/groups.md
@@ -94,7 +94,8 @@ GET /groups?statistics=true
"wiki_size" : 100,
"lfs_objects_size" : 123,
"job_artifacts_size" : 57,
- "packages_size": 0
+ "packages_size": 0,
+ "snippets_size" : 50,
}
}
]
diff --git a/doc/gitlab-basics/start-using-git.md b/doc/gitlab-basics/start-using-git.md
index 439032f39b3..7d348bdc37e 100644
--- a/doc/gitlab-basics/start-using-git.md
+++ b/doc/gitlab-basics/start-using-git.md
@@ -104,68 +104,134 @@ repository.
You can read more on how Git manages configurations in the
[Git Config](https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration) documentation.
-## Basic Git commands
+## Git authentication methods
-Start using Git via the command line with the most basic commands as described below.
+To connect your computer with GitLab, you need to add your credentials to identify yourself.
+You have two options:
-### Initialize a local directory for Git version control
+- Authenticate on a project-by-project basis through HTTPS, and enter your credentials every time
+ you perform an operation between your computer and GitLab.
+- Authenticate through SSH once and GitLab won't ask your credentials every time you pull, push,
+ and clone.
-If you have an existing local directory that you want to *initialize* for version
-control, use the `init` command to instruct Git to begin tracking the directory:
+To start the authentication process, we'll [clone](#clone-a-repository) an existing repository
+to our computer:
-```shell
-git init
-```
+- If you want to use **SSH** to authenticate, follow the instructions on the [SSH documentation](../ssh/README.md)
+ to set it up before cloning.
+- If you want to use **HTTPS**, GitLab will request your user name and password:
+ - If you have 2FA enabled for your account, you'll have to use a [Personal Access Token](../user/profile/personal_access_tokens.md)
+ with **read_repository** or **write_repository** permissions instead of your account's password.
+ Create one before cloning.
+ - If you don't have 2FA enabled, use your account's password.
-This creates a `.git` directory that contains the Git configuration files.
+NOTE: **Note:**
+Authenticating via SSH is GitLab's recommended method. You can read more about credential storage
+in the [Git Credentials documentation](https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage).
-Once the directory has been initialized, you can [add a remote repository](#add-a-remote-repository)
-and [send changes to GitLab.com](#send-changes-to-gitlabcom). You will also need to
-[create a new project in GitLab](../gitlab-basics/create-project.md#push-to-create-a-new-project)
-for your Git repository.
+## Git terminology
-### Clone a repository
+If you're familiar with the Git terminology, you may want to jump directly
+into the [basic commands](#basic-git-commands).
+
+### Namespace
+
+A **namespace** is either a **user name** or a **group name**.
+
+For example, suppose Jo is a GitLab.com user and they chose their user name as
+`jo`. You can see Jo's profile at `https://gitlab.com/jo`. `jo` is a namespace.
+
+Jo also created a group in GitLab, and chose the path `test-group` for their
+group. The group can be accessed under `https://gitlab.com/test-group`. `test-group` is a namespace.
+
+### Repository
+
+Your files in GitLab live in a **repository**, similar to how you have them in a folder or
+directory in your computer. **Remote** repository refers to the files in
+GitLab and the copy in your computer is called **local** copy.
+A **project** in GitLab is what holds a repository, which holds your files.
+Often, the word "repository" is shortened to "repo".
+
+### Fork
+
+When you want to copy someone else's repository, you [**fork**](../user/project/repository/forking_workflow.md#creating-a-fork)
+the project. By forking it, you'll create a copy of the project into your own
+namespace to have read and write permissions to modify the project files
+and settings.
+
+For example, if you fork this project, <https://gitlab.com/gitlab-tests/sample-project/> into your namespace, you'll create your own copy of the repository in your namespace (`https://gitlab.com/your-namespace/sample-project/`). From there, you can clone it into your computer,
+work on its files, and (optionally) submit proposed changes back to the
+original repository if you'd like.
+
+### Download vs clone
-To start working locally on an existing remote repository, clone it with the command
-`git clone <repository path>`. By cloning a repository, you'll download a copy of its
-files to your local computer, automatically preserving the Git connection with the
-remote repository.
+To create a copy of a remote repository files on your computer, you can either
+**download** or **clone** it. If you download it, you cannot sync it with the
+remote repository on GitLab.
-You can either clone it via [HTTPS](#clone-via-https) or [SSH](#clone-via-ssh). If you chose to
-clone it via HTTPS, you'll have to enter your credentials every time you pull and push.
-You can read more about credential storage in the
-[Git Credentials documentation](https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage).
-With [SSH](../ssh/README.md), you enter your credentials only once.
+On the other hand, by cloning a repository, you'll download a copy of its
+files to your local computer, but preserve the Git connection with the remote
+repository, so that you can work on the its files on your computer and then
+upload the changes to GitLab.
+
+### Pull and push
+
+After you saved a local copy of a repository and modified its files on your computer, you can upload the
+changes to GitLab. This is referred to as **pushing** to GitLab, as this is achieved by the command
+[`git push`](#send-changes-to-gitlabcom).
+
+When the remote repository changes, your local copy will be behind it. You can update it with the new
+changes in the remote repo.
+This is referred to as **pulling** from GitLab, as this is achieved by the command
+[`git pull`](#download-the-latest-changes-in-the-project).
+
+## Basic Git commands
+
+For the purposes of this guide, we will use this example project on GitLab.com:
+[https://gitlab.com/gitlab-tests/sample-project/](https://gitlab.com/gitlab-tests/sample-project/).
+
+To use it, log into GitLab.com and fork the example project into your
+namespace to have your own copy to playing with. Your sample
+project will be available under `https://gitlab.com/<your-namespace>/sample-project/`.
+
+You can also choose any other project to follow this guide. Then, replace the
+example URLs with your own project's.
+
+If you want to start by copying an existing GitLab repository onto your
+computer, see how to [clone a repository](#clone-a-repository). On the other
+hand, if you want to start by uploading an existing folder from your computer
+to GitLab, see how to [convert a local folder into a Git repository](#convert-a-local-directory-into-a-repository).
+
+### Clone a repository
+
+To start working locally on an existing remote repository, clone it with the
+command `git clone <repository path>`. You can either clone it via [HTTPS](#clone-via-https) or [SSH](#clone-via-ssh), according to your preferred [authentication method](#git-authentication-methods).
You can find both paths (HTTPS and SSH) by navigating to your project's landing page
and clicking **Clone**. GitLab will prompt you with both paths, from which you can copy
and paste in your command line.
-As an example, consider this repository path:
+For example, considering our [sample project](https://gitlab.com/gitlab-tests/sample-project/):
-- HTTPS: `https://gitlab.com/gitlab-org/gitlab.git`
-- SSH: `git@gitlab.com:gitlab-org/gitlab.git`
+- To clone through HTTPS, use `https://gitlab.com/gitlab-tests/sample-project.git`.
+- To clone through SSH, use `git@gitlab.com:gitlab-tests/sample-project.git`.
-To get started, open a terminal window in the directory you wish to clone the
+To get started, open a terminal window in the directory you wish to add the
repository files into, and run one of the `git clone` commands as described below.
Both commands will download a copy of the files in a folder named after the project's
-name. You can then navigate to the new directory and start working on it locally.
+name and preserve the connection with the remote repository.
+You can then navigate to the new directory with `cd sample-project` and start working on it
+locally.
#### Clone via HTTPS
-To clone `https://gitlab.com/gitlab-org/gitlab.git` via HTTPS:
+To clone `https://gitlab.com/gitlab-tests/sample-project/` via HTTPS:
```shell
-git clone https://gitlab.com/gitlab-org/gitlab.git
+git clone https://gitlab.com/gitlab-tests/sample-project.git
```
-You'll have to add your password every time you clone through HTTPS. If you have 2FA enabled
-for your account, you'll have to use a [Personal Access Token](../user/profile/personal_access_tokens.md)
-with **read_repository** or **write_repository** permissions instead of your account's password.
-
-If you don't have 2FA enabled, use your account's password.
-
TIP: **Troubleshooting:**
On Windows, if you entered incorrect passwords multiple times and GitLab is responding `Access denied`,
you may have to add your namespace (user name or group name) to clone through HTTPS:
@@ -179,16 +245,44 @@ To clone `git@gitlab.com:gitlab-org/gitlab.git` via SSH:
git clone git@gitlab.com:gitlab-org/gitlab.git
```
-### Switch to the master branch
+### Convert a local directory into a repository
-You are always in a branch when working with Git. The main branch is the master
-branch, but you can use the same command to switch to a different branch by
-changing `master` to the branch name.
+When you have your files in a local folder and want to convert it into
+a repository, you'll need to _initialize_ the folder through the `git init`
+command. This will instruct Git to begin to track that directory as a
+repository. To do so, open the terminal on the directory you'd like to convert
+and run:
```shell
-git checkout master
+git init
```
+This command creates a `.git` folder in your directory that contains Git
+records and configuration files. We advise against editing these files
+directly.
+
+Then, on the next step, add the [path to your remote repository](#add-a-remote-repository)
+so that Git can upload your files into the correct project.
+
+#### Add a remote repository
+
+By "adding a remote repository" to your local directory you'll tell Git that
+the path to that specific project in GitLab corresponds to that specific
+folder you have in your computer. This way, your local folder will be
+identified by Git as the local content for that specific remote project.
+
+To add a remote repository to your local copy:
+
+1. In GitLab, [create a new project](../gitlab-basics/create-project.md#push-to-create-a-new-project) to hold your files.
+1. Visit this project's homepage, scroll down to **Push an existing folder**, and copy the command that starts with `git remote add`.
+1. On your computer, open the terminal in the directory you've initialized, paste the command you copied, and press <kbd>enter</kbd>:
+
+ ```shell
+ git remote add origin <git@gitlab.com:username/projectpath.git
+ ```
+
+After you've done that, you can [stage your files](#add-and-commit-local-changes) and [upload them to GitLab](#send-changes-to-gitlabcom).
+
### Download the latest changes in the project
To work on an up-to-date copy of the project (it is important to do this every time
@@ -219,16 +313,16 @@ git remote -v
The `-v` flag stands for verbose.
-### Add a remote repository
+## Branching
-To add a link to a remote repository:
+If you want to add code to a project but you're not sure if it will work properly, or you're
+collaborating on the project with others, and don't want your work to get mixed up, it's a good idea
+to work on a different **branch**.
-```shell
-git remote add <source-name> <repository-path>
-```
-
-You'll use this source name every time you [push changes to GitLab.com](#send-changes-to-gitlabcom),
-so use something easy to remember and type.
+When you create a branch in a Git repository, you make a copy of its files at the time of branching. You're free
+to do whatever you want with the code in your branch without impacting the main branch or other branches. And when
+you're ready to bring your changes to the main codebase, you can merge your branch into the main one
+used in your project (such as `master`).
### Create a branch
@@ -240,6 +334,16 @@ use a hyphen or underscore):
git checkout -b <name-of-branch>
```
+### Switch to the master branch
+
+You are always in a branch when working with Git. The main branch is the master
+branch, but you can use the same command to switch to a different branch by
+changing `master` to the branch name.
+
+```shell
+git checkout master
+```
+
### Work on an existing branch
To switch to an existing branch, so you can work on it:
@@ -279,7 +383,7 @@ git add <file-name OR folder-name>
git commit -m "COMMENT TO DESCRIBE THE INTENTION OF THE COMMIT"
```
-### Add all changes to commit
+#### Add all changes to commit
To add and commit (save) all local changes quickly:
@@ -293,10 +397,6 @@ The `.` character means _all file changes in the current directory and all subdi
### Send changes to GitLab.com
-NOTE: **Note:**
-To create a merge request from a fork to an upstream repository, see the
-[forking workflow](../user/project/repository/forking_workflow.md)
-
To push all local commits (saved changes) to the remote repository:
```shell
@@ -309,6 +409,10 @@ For example, to push your local commits to the _`master`_ branch of the _`origin
git push origin master
```
+NOTE: **Note:**
+To create a merge request from a fork to an upstream repository, see the
+[forking workflow](../user/project/repository/forking_workflow.md).
+
### Delete all changes in the branch
To delete all local changes in the branch that have not been added to the staging
@@ -353,7 +457,7 @@ git checkout <name-of-branch>
git merge master
```
-### Synchronize changes in a forked repository with the upstream
+## Synchronize changes in a forked repository with the upstream
[Forking a repository](../user/project/repository/forking_workflow.md) lets you create
a copy of a repository in your namespace. Changes made to your copy of the repository
diff --git a/doc/topics/git/index.md b/doc/topics/git/index.md
index 2e36fea14bf..89da3dfdbd0 100644
--- a/doc/topics/git/index.md
+++ b/doc/topics/git/index.md
@@ -26,8 +26,9 @@ The following resources will help you get started with Git:
- [Git Basics](https://git-scm.com/book/en/v2/Getting-Started-Git-Basics)
- [Git on the Server - GitLab](https://git-scm.com/book/en/v2/Git-on-the-Server-GitLab)
- [How to install Git](how_to_install_git/index.md)
+- [Git terminology](../../gitlab-basics/start-using-git.md#git-terminology)
- [Start using Git on the command line](../../gitlab-basics/start-using-git.md)
-- [Command line file editing basic commands](../../gitlab-basics/command-line-commands.md)
+- [Edit files through the command line](../../gitlab-basics/command-line-commands.md)
- [GitLab Git Cheat Sheet (download)](https://about.gitlab.com/images/press/git-cheat-sheet.pdf)
- Commits:
- [Revert a commit](../../user/project/merge_requests/revert_changes.md#reverting-a-commit)
diff --git a/doc/user/application_security/dependency_scanning/index.md b/doc/user/application_security/dependency_scanning/index.md
index 2bed1af5897..656f4045bc5 100644
--- a/doc/user/application_security/dependency_scanning/index.md
+++ b/doc/user/application_security/dependency_scanning/index.md
@@ -186,6 +186,7 @@ The following variables are used for configuring specific analyzers (used for a
| `DS_PIP_VERSION` | `gemnasium-python` | | Force the install of a specific pip version (example: `"19.3"`), otherwise the pip installed in the Docker image is used. ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/12811) in GitLab 12.7) |
| `DS_PIP_DEPENDENCY_PATH` | `gemnasium-python` | | Path to load Python pip dependencies from. ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/12412) in GitLab 12.2) |
| `DS_PYTHON_VERSION` | `retire.js` | | Version of Python. If set to 2, dependencies are installed using Python 2.7 instead of Python 3.6. ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/12296) in GitLab 12.1)|
+| `DS_JAVA_VERSION` | `gemnasium-maven` | `11` | Version of Java. Available versions: `8`, `11`, `13`, `14`. Maven and Gradle will use the Java version specified by this value. |
| `MAVEN_CLI_OPTS` | `gemnasium-maven` | `"-DskipTests --batch-mode"` | List of command line arguments that will be passed to `maven` by the analyzer. See an example for [using private repositories](../index.md#using-private-maven-repos). |
| `GRADLE_CLI_OPTS` | `gemnasium-maven` | | List of command line arguments that will be passed to `gradle` by the analyzer. |
| `SBT_CLI_OPTS` | `gemnasium-maven` | | List of command-line arguments that the analyzer will pass to `sbt`. |
diff --git a/doc/user/group/saml_sso/group_managed_accounts.md b/doc/user/group/saml_sso/group_managed_accounts.md
index 30127c2192b..e317573d89d 100644
--- a/doc/user/group/saml_sso/group_managed_accounts.md
+++ b/doc/user/group/saml_sso/group_managed_accounts.md
@@ -13,7 +13,7 @@ This is a [Closed Beta](https://about.gitlab.com/handbook/product/#closed-beta)
> - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/709) in GitLab 12.1.
> - It's deployed behind a feature flag, disabled by default.
-When [SSO for Groups]](index.md) is being enforced, groups can enable an additional level of protection by enforcing the creation of dedicated user accounts to access the group.
+When [SSO for Groups](index.md) is being enforced, groups can enable an additional level of protection by enforcing the creation of dedicated user accounts to access the group.
With group-managed accounts enabled, users are required to create a new, dedicated user linked to the group.
The notification email address associated with the user is locked to the email address received from the configured identity provider.
diff --git a/doc/user/project/clusters/add_remove_clusters.md b/doc/user/project/clusters/add_remove_clusters.md
index d0cba729e35..c93d3e6b96e 100644
--- a/doc/user/project/clusters/add_remove_clusters.md
+++ b/doc/user/project/clusters/add_remove_clusters.md
@@ -13,6 +13,11 @@ GitLab offers integrated cluster creation for the following Kubernetes providers
GitLab can also integrate with any standard Kubernetes provider, either on-premise or hosted.
+NOTE: **Scalable app deployment with GitLab and Google Cloud Platform**
+[Watch the webcast](https://about.gitlab.com/webcast/scalable-app-deploy/) and
+learn how to spin up a Kubernetes cluster managed by Google Cloud Platform (GCP)
+in a few clicks.
+
TIP: **Tip:**
Every new Google Cloud Platform (GCP) account receives [$300 in credit upon sign up](https://console.cloud.google.com/freetrial),
and in partnership with Google, GitLab is able to offer an additional $200 for new GCP accounts to get started with GitLab's
diff --git a/doc/user/project/clusters/index.md b/doc/user/project/clusters/index.md
index 961a9fda5ff..2c532ac24c8 100644
--- a/doc/user/project/clusters/index.md
+++ b/doc/user/project/clusters/index.md
@@ -12,15 +12,6 @@ info: To determine the technical writer assigned to the Stage/Group associated w
> - [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/39840) in
> GitLab 11.11 for [instances](../../instance/clusters/index.md).
-GitLab provides many features with a Kubernetes integration. Kubernetes can be
-integrated with projects, but also:
-
-- [Groups](../../group/clusters/index.md).
-- [Instances](../../instance/clusters/index.md).
-
-NOTE: **Scalable app deployment with GitLab and Google Cloud Platform**
-[Watch the webcast](https://about.gitlab.com/webcast/scalable-app-deploy/) and learn how to spin up a Kubernetes cluster managed by Google Cloud Platform (GCP) in a few clicks.
-
## Overview
Using the GitLab project Kubernetes integration, you can:
@@ -28,17 +19,26 @@ Using the GitLab project Kubernetes integration, you can:
- Use [Review Apps](../../../ci/review_apps/index.md).
- Run [pipelines](../../../ci/pipelines/index.md).
- [Deploy](#deploying-to-a-kubernetes-cluster) your applications.
-- Detect and [monitor Kubernetes](#kubernetes-monitoring).
+- Detect and [monitor Kubernetes](#monitoring-your-kubernetes-cluster).
- Use it with [Auto DevOps](#auto-devops).
- Use [Web terminals](#web-terminals).
- Use [Deploy Boards](#deploy-boards-premium). **(PREMIUM)**
- Use [Canary Deployments](#canary-deployments-premium). **(PREMIUM)**
-- View [Logs](#logs).
+- View [Logs](#viewing-pod-logs).
- Run serverless workloads on [Kubernetes with Knative](serverless/index.md).
+Besides integration at the project level, Kubernetes clusters can also be
+integrated at the [group level](../../group/clusters/index.md) or
+[GitLab instance level](../../instance/clusters/index.md).
+
+## Setting up
+
### Supported cluster versions
-GitLab is committed to support at least two production-ready Kubernetes minor versions at any given time. We regularly review the versions we support, and provide a four-month deprecation period before we remove support of a specific version. The range of supported versions is based on the evaluation of:
+GitLab is committed to support at least two production-ready Kubernetes minor
+versions at any given time. We regularly review the versions we support, and
+provide a four-month deprecation period before we remove support of a specific
+version. The range of supported versions is based on the evaluation of:
- Our own needs.
- The versions supported by major managed Kubernetes providers.
@@ -55,80 +55,82 @@ Currently, GitLab supports the following Kubernetes versions:
NOTE: **Note:**
Some GitLab features may support versions outside the range provided here.
-### Deploy Boards **(PREMIUM)**
-
-GitLab's Deploy Boards offer a consolidated view of the current health and
-status of each CI [environment](../../../ci/environments/index.md) running on Kubernetes,
-displaying the status of the pods in the deployment. Developers and other
-teammates can view the progress and status of a rollout, pod by pod, in the
-workflow they already use without any need to access Kubernetes.
-
-[Read more about Deploy Boards](../deploy_boards.md)
-
-### Canary Deployments **(PREMIUM)**
+### Adding and removing clusters
-Leverage [Kubernetes' Canary deployments](https://kubernetes.io/docs/concepts/cluster-administration/manage-deployment/#canary-deployments)
-and visualize your canary deployments right inside the Deploy Board, without
-the need to leave GitLab.
-
-[Read more about Canary Deployments](../canary_deployments.md)
-
-### Logs
-
-GitLab makes it easy to view the logs of running pods in connected Kubernetes clusters. By displaying the logs directly in GitLab, developers can avoid having to manage console tools or jump to a different interface.
-
-[Read more about Kubernetes logs](kubernetes_pod_logs.md)
+See [Adding and removing Kubernetes clusters](add_remove_clusters.md) for details on how
+to:
-### Kubernetes monitoring
+- Create a cluster in Google Cloud Platform (GCP) or Amazon Elastic Kubernetes Service
+ (EKS) using GitLab's UI.
+- Add an integration to an existing cluster from any Kubernetes platform.
-Automatically detect and monitor Kubernetes metrics. Automatic monitoring of
-[NGINX Ingress](../integrations/prometheus_library/nginx.md) is also supported.
+### Multiple Kubernetes clusters **(PREMIUM)**
-[Read more about Kubernetes monitoring](../integrations/prometheus_library/kubernetes.md)
+> Introduced in [GitLab Premium](https://about.gitlab.com/pricing/) 10.3.
-### Auto DevOps
+With GitLab Premium, you can associate more than one Kubernetes cluster to your
+project. That way you can have different clusters for different environments,
+like dev, staging, production, and so on.
-Auto DevOps automatically detects, builds, tests, deploys, and monitors your
-applications.
+Simply add another cluster, like you did the first time, and make sure to
+[set an environment scope](#setting-the-environment-scope-premium) that will
+differentiate the new cluster with the rest.
-To make full use of Auto DevOps(Auto Deploy, Auto Review Apps, and Auto Monitoring)
-you will need the Kubernetes project integration enabled.
+#### Setting the environment scope **(PREMIUM)**
-[Read more about Auto DevOps](../../../topics/autodevops/index.md)
+When adding more than one Kubernetes cluster to your project, you need to differentiate
+them with an environment scope. The environment scope associates clusters with [environments](../../../ci/environments/index.md) similar to how the
+[environment-specific variables](../../../ci/variables/README.md#limit-the-environment-scopes-of-environment-variables) work.
-NOTE: **Note**
-Kubernetes clusters can be used without Auto DevOps.
+The default environment scope is `*`, which means all jobs, regardless of their
+environment, will use that cluster. Each scope can only be used by a single
+cluster in a project, and a validation error will occur if otherwise.
+Also, jobs that don't have an environment keyword set will not be able to access any cluster.
-### Web terminals
+For example, let's say the following Kubernetes clusters exist in a project:
-> Introduced in GitLab 8.15.
+| Cluster | Environment scope |
+| ----------- | ----------------- |
+| Development | `*` |
+| Production | `production` |
-When enabled, the Kubernetes integration adds [web terminal](../../../ci/environments/index.md#web-terminals)
-support to your [environments](../../../ci/environments/index.md). This is based on the `exec` functionality found in
-Docker and Kubernetes, so you get a new shell session within your existing
-containers. To use this integration, you should deploy to Kubernetes using
-the deployment variables above, ensuring any deployments, replica sets, and
-pods are annotated with:
+And the following environments are set in
+[`.gitlab-ci.yml`](../../../ci/yaml/README.md):
-- `app.gitlab.com/env: $CI_ENVIRONMENT_SLUG`
-- `app.gitlab.com/app: $CI_PROJECT_PATH_SLUG`
+```yaml
+stages:
+- test
+- deploy
-`$CI_ENVIRONMENT_SLUG` and `$CI_PROJECT_PATH_SLUG` are the values of
-the CI variables.
+test:
+ stage: test
+ script: sh test
-You must be the project owner or have `maintainer` permissions to use terminals. Support is limited
-to the first container in the first pod of your environment.
+deploy to staging:
+ stage: deploy
+ script: make deploy
+ environment:
+ name: staging
+ url: https://staging.example.com/
-## Adding and removing clusters
+deploy to production:
+ stage: deploy
+ script: make deploy
+ environment:
+ name: production
+ url: https://example.com/
+```
-See [Adding and removing Kubernetes clusters](add_remove_clusters.md) for details on how
-to:
+The result will then be:
-- Create a cluster in Google Cloud Platform (GCP) or Amazon Elastic Kubernetes Service
- (EKS) using GitLab's UI.
-- Add an integration to an existing cluster from any Kubernetes platform.
+- The Development cluster details will be available in the `deploy to staging`
+ job.
+- The production cluster details will be available in the `deploy to production`
+ job.
+- No cluster details will be available in the `test` job because it doesn't
+ define any environment.
-## Cluster configuration
+## Configuring your Kubernetes cluster
After [adding a Kubernetes cluster](add_remove_clusters.md) to GitLab, read this section that covers
important considerations for configuring Kubernetes clusters with GitLab.
@@ -203,72 +205,6 @@ you can either:
- Create an `A` record that points to the Ingress IP address with your domain provider.
- Enter a wildcard DNS address using a service such as nip.io or xip.io. For example, `192.168.1.1.xip.io`.
-### Setting the environment scope **(PREMIUM)**
-
-When adding more than one Kubernetes cluster to your project, you need to differentiate
-them with an environment scope. The environment scope associates clusters with [environments](../../../ci/environments/index.md) similar to how the
-[environment-specific variables](../../../ci/variables/README.md#limit-the-environment-scopes-of-environment-variables) work.
-
-The default environment scope is `*`, which means all jobs, regardless of their
-environment, will use that cluster. Each scope can only be used by a single
-cluster in a project, and a validation error will occur if otherwise.
-Also, jobs that don't have an environment keyword set will not be able to access any cluster.
-
-For example, let's say the following Kubernetes clusters exist in a project:
-
-| Cluster | Environment scope |
-| ----------- | ----------------- |
-| Development | `*` |
-| Production | `production` |
-
-And the following environments are set in
-[`.gitlab-ci.yml`](../../../ci/yaml/README.md):
-
-```yaml
-stages:
-- test
-- deploy
-
-test:
- stage: test
- script: sh test
-
-deploy to staging:
- stage: deploy
- script: make deploy
- environment:
- name: staging
- url: https://staging.example.com/
-
-deploy to production:
- stage: deploy
- script: make deploy
- environment:
- name: production
- url: https://example.com/
-```
-
-The result will then be:
-
-- The Development cluster details will be available in the `deploy to staging`
- job.
-- The production cluster details will be available in the `deploy to production`
- job.
-- No cluster details will be available in the `test` job because it doesn't
- define any environment.
-
-### Multiple Kubernetes clusters **(PREMIUM)**
-
-> Introduced in [GitLab Premium](https://about.gitlab.com/pricing/) 10.3.
-
-With GitLab Premium, you can associate more than one Kubernetes cluster to your
-project. That way you can have different clusters for different environments,
-like dev, staging, production, and so on.
-
-Simply add another cluster, like you did the first time, and make sure to
-[set an environment scope](#setting-the-environment-scope-premium) that will
-differentiate the new cluster with the rest.
-
## Installing applications
GitLab can install and manage some applications like Helm, GitLab Runner, Ingress,
@@ -277,6 +213,19 @@ installing, upgrading, uninstalling, and troubleshooting applications for
your project cluster, see
[GitLab Managed Apps](../../clusters/applications.md).
+## Auto DevOps
+
+Auto DevOps automatically detects, builds, tests, deploys, and monitors your
+applications.
+
+To make full use of Auto DevOps (Auto Deploy, Auto Review Apps, and
+Auto Monitoring) you will need the Kubernetes project integration enabled.
+
+[Read more about Auto DevOps](../../../topics/autodevops/index.md)
+
+NOTE: **Note**
+Kubernetes clusters can be used without Auto DevOps.
+
## Deploying to a Kubernetes cluster
A Kubernetes cluster can be the destination for a deployment job. If
@@ -329,6 +278,54 @@ NOTE: **Note:** When using a [GitLab-managed cluster](#gitlab-managed-clusters),
namespaces are created automatically prior to deployment and [can not be
customized](https://gitlab.com/gitlab-org/gitlab/-/issues/38054).
+### Integrations
+
+#### Canary Deployments **(PREMIUM)**
+
+Leverage [Kubernetes' Canary deployments](https://kubernetes.io/docs/concepts/cluster-administration/manage-deployment/#canary-deployments)
+and visualize your canary deployments right inside the Deploy Board, without
+the need to leave GitLab.
+
+[Read more about Canary Deployments](../canary_deployments.md)
+
+#### Deploy Boards **(PREMIUM)**
+
+GitLab's Deploy Boards offer a consolidated view of the current health and
+status of each CI [environment](../../../ci/environments/index.md) running on Kubernetes,
+displaying the status of the pods in the deployment. Developers and other
+teammates can view the progress and status of a rollout, pod by pod, in the
+workflow they already use without any need to access Kubernetes.
+
+[Read more about Deploy Boards](../deploy_boards.md)
+
+#### Viewing pod logs
+
+GitLab makes it easy to view the logs of running pods in connected Kubernetes
+clusters. By displaying the logs directly in GitLab, developers can avoid having
+to manage console tools or jump to a different interface.
+
+[Read more about Kubernetes logs](kubernetes_pod_logs.md)
+
+#### Web terminals
+
+> Introduced in GitLab 8.15.
+
+When enabled, the Kubernetes integration adds [web terminal](../../../ci/environments/index.md#web-terminals)
+support to your [environments](../../../ci/environments/index.md). This is based
+on the `exec` functionality found in Docker and Kubernetes, so you get a new
+shell session within your existing containers. To use this integration, you
+should deploy to Kubernetes using the deployment variables above, ensuring any
+deployments, replica sets, and pods are annotated with:
+
+- `app.gitlab.com/env: $CI_ENVIRONMENT_SLUG`
+- `app.gitlab.com/app: $CI_PROJECT_PATH_SLUG`
+
+`$CI_ENVIRONMENT_SLUG` and `$CI_PROJECT_PATH_SLUG` are the values of
+the CI variables.
+
+You must be the project owner or have `maintainer` permissions to use terminals.
+Support is limited to the first container in the first pod of your environment.
+
### Troubleshooting
Before the deployment jobs starts, GitLab creates the following specifically for
@@ -359,7 +356,14 @@ in a way that causes this error. Ensure you deselect the
[GitLab-managed cluster](#gitlab-managed-clusters) option if you want to manage
namespaces and service accounts yourself.
-## Monitoring your Kubernetes cluster **(ULTIMATE)**
+## Monitoring your Kubernetes cluster
+
+Automatically detect and monitor Kubernetes metrics. Automatic monitoring of
+[NGINX Ingress](../integrations/prometheus_library/nginx.md) is also supported.
+
+[Read more about Kubernetes monitoring](../integrations/prometheus_library/kubernetes.md)
+
+### Visualizing cluster health **(ULTIMATE)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/4701) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 10.6.
diff --git a/doc/user/project/integrations/prometheus.md b/doc/user/project/integrations/prometheus.md
index bc4a372d852..e781493bd85 100644
--- a/doc/user/project/integrations/prometheus.md
+++ b/doc/user/project/integrations/prometheus.md
@@ -1166,16 +1166,16 @@ For [manually configured Prometheus instances](#manual-configuration-of-promethe
> [Introduced](<https://gitlab.com/gitlab-org/gitlab/-/issues/40997>) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 12.9.
-[Cluster Health Metrics](../clusters/index.md#monitoring-your-kubernetes-cluster-ultimate) can also be embedded in [GitLab-flavored Markdown](../../markdown.md).
+[Cluster Health Metrics](../clusters/index.md#visualizing-cluster-health-ultimate) can also be embedded in [GitLab-flavored Markdown](../../markdown.md).
-To embed a metric chart, include a link to that chart in the form `https://<root_url>/<project>/-/cluster/<cluster_id>?<query_params>` anywhere that GitLab-flavored Markdown is supported. To generate and copy a link to the chart, follow the instructions in the [Cluster Health Metric documentation](../clusters/index.md#monitoring-your-kubernetes-cluster-ultimate).
+To embed a metric chart, include a link to that chart in the form `https://<root_url>/<project>/-/cluster/<cluster_id>?<query_params>` anywhere that GitLab-flavored Markdown is supported. To generate and copy a link to the chart, follow the instructions in the [Cluster Health Metric documentation](../clusters/index.md#visualizing-cluster-health-ultimate).
The following requirements must be met for the metric to unfurl:
- The `<cluster_id>` must correspond to a real cluster.
- Prometheus must be monitoring the cluster.
- The user must be allowed access to the project cluster metrics.
-- The dashboards must be reporting data on the [Cluster Health Page](../clusters/index.md#monitoring-your-kubernetes-cluster-ultimate)
+- The dashboards must be reporting data on the [Cluster Health Page](../clusters/index.md#visualizing-cluster-health-ultimate)
If the above requirements are met, then the metric will unfurl as seen below.
diff --git a/doc/user/project/operations/alert_management.md b/doc/user/project/operations/alert_management.md
index 3c33e78a9d7..7b6e40c7179 100644
--- a/doc/user/project/operations/alert_management.md
+++ b/doc/user/project/operations/alert_management.md
@@ -83,7 +83,6 @@ Each alert contains the following metrics:
- **Severity** - The current importance of a alert and how much attention it should receive.
- **Start time** - How long ago the alert fired. This field uses the standard GitLab pattern of `X time ago`, but is supported by a granular date/time tooltip depending on the user's locale.
-- **End time** - How long ago the alert fired was resolved. This field uses the standard GitLab pattern of `X time ago`, but is supported by a granular date/time tooltip depending on the user's locale.
- **Alert description** - The description of the alert, which attempts to capture the most meaningful data.
- **Event count** - The number of times that an alert has fired.
- **Status** - The [current status](#alert-management-statuses) of the alert.
diff --git a/doc/user/project/operations/img/alert_list_v13_1.png b/doc/user/project/operations/img/alert_list_v13_1.png
index 9946d68644d..7cda00a25ad 100644
--- a/doc/user/project/operations/img/alert_list_v13_1.png
+++ b/doc/user/project/operations/img/alert_list_v13_1.png
Binary files differ
diff --git a/lib/api/entities/group.rb b/lib/api/entities/group.rb
index 8a6a5b7057c..e430eba4880 100644
--- a/lib/api/entities/group.rb
+++ b/lib/api/entities/group.rb
@@ -31,6 +31,7 @@ module API
expose :wiki_size
expose :lfs_objects_size
expose :build_artifacts_size, as: :job_artifacts_size
+ expose :snippets_size
end
end
end
diff --git a/lib/gitlab/error_tracking.rb b/lib/gitlab/error_tracking.rb
index 4e215348ea1..1600b15454c 100644
--- a/lib/gitlab/error_tracking.rb
+++ b/lib/gitlab/error_tracking.rb
@@ -10,7 +10,6 @@ module Gitlab
Acme::Client::Error::Timeout
Acme::Client::Error::UnsupportedOperation
ActiveRecord::ConnectionTimeoutError
- ActiveRecord::QueryCanceled
Gitlab::RequestContext::RequestDeadlineExceeded
GRPC::DeadlineExceeded
JIRA::HTTPError
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 2a0bcd664d3..05c403d4025 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -13264,6 +13264,9 @@ msgstr ""
msgid "License History"
msgstr ""
+msgid "License ID:"
+msgstr ""
+
msgid "License URL"
msgstr ""
@@ -14096,6 +14099,9 @@ msgstr ""
msgid "MergeRequests|Squash task canceled: another squash is already in progress."
msgstr ""
+msgid "MergeRequests|This project does not allow squashing commits when merge requests are accepted."
+msgstr ""
+
msgid "MergeRequests|Thread stays resolved"
msgstr ""
diff --git a/scripts/trigger-build b/scripts/trigger-build
index b8bea95a069..9f0df21e7f1 100755
--- a/scripts/trigger-build
+++ b/scripts/trigger-build
@@ -184,6 +184,7 @@ module Trigger
edition = Trigger.ee? ? 'EE' : 'CE'
{
+ "ee" => Trigger.ee? ? "true" : "false",
"GITLAB_VERSION" => ENV['CI_COMMIT_SHA'],
"GITLAB_TAG" => ENV['CI_COMMIT_TAG'],
"GITLAB_ASSETS_TAG" => ENV['CI_COMMIT_TAG'] ? ENV['CI_COMMIT_REF_NAME'] : ENV['CI_COMMIT_SHA'],
diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb
index 382593fd7cb..4327e0bbb7a 100644
--- a/spec/controllers/projects/merge_requests_controller_spec.rb
+++ b/spec/controllers/projects/merge_requests_controller_spec.rb
@@ -442,7 +442,7 @@ RSpec.describe Projects::MergeRequestsController do
merge_request.update(squash: false)
merge_with_sha(squash: '1')
- expect(merge_request.reload.squash).to be_truthy
+ expect(merge_request.reload.squash_on_merge?).to be_truthy
end
end
@@ -451,7 +451,7 @@ RSpec.describe Projects::MergeRequestsController do
merge_request.update(squash: true)
merge_with_sha(squash: '0')
- expect(merge_request.reload.squash).to be_falsey
+ expect(merge_request.reload.squash_on_merge?).to be_falsey
end
end
diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb
index 04bf529b74b..79ab9158461 100644
--- a/spec/requests/api/groups_spec.rb
+++ b/spec/requests/api/groups_spec.rb
@@ -184,11 +184,12 @@ RSpec.describe API::Groups do
it "includes statistics if requested" do
attributes = {
- storage_size: 1158,
+ storage_size: 2392,
repository_size: 123,
wiki_size: 456,
lfs_objects_size: 234,
- build_artifacts_size: 345
+ build_artifacts_size: 345,
+ snippets_size: 1234
}.stringify_keys
exposed_attributes = attributes.dup
exposed_attributes['job_artifacts_size'] = exposed_attributes.delete('build_artifacts_size')
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index 803178d590f..d71cd843a47 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -1930,7 +1930,7 @@ RSpec.describe API::MergeRequests do
it "updates the MR's squash attribute" do
expect do
put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/merge", user), params: { squash: true }
- end.to change { merge_request.reload.squash }
+ end.to change { merge_request.reload.squash_on_merge? }
expect(response).to have_gitlab_http_status(:ok)
end
diff --git a/spec/serializers/merge_request_poll_cached_widget_entity_spec.rb b/spec/serializers/merge_request_poll_cached_widget_entity_spec.rb
index 1357f7cf624..51564de6041 100644
--- a/spec/serializers/merge_request_poll_cached_widget_entity_spec.rb
+++ b/spec/serializers/merge_request_poll_cached_widget_entity_spec.rb
@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe MergeRequestPollCachedWidgetEntity do
include ProjectForksHelper
+ using RSpec::Parameterized::TableSyntax
let(:project) { create :project, :repository }
let(:resource) { create(:merge_request, source_project: project, target_project: project) }
@@ -181,6 +182,27 @@ RSpec.describe MergeRequestPollCachedWidgetEntity do
end
end
+ describe 'squash defaults for projects' do
+ where(:squash_option, :value, :default, :readonly) do
+ 'always' | true | true | true
+ 'never' | false | false | true
+ 'default_on' | false | true | false
+ 'default_off' | false | false | false
+ end
+
+ with_them do
+ before do
+ project.project_setting.update!(squash_option: squash_option)
+ end
+
+ it 'the key reflects the correct value' do
+ expect(subject[:squash_on_merge]).to eq(value)
+ expect(subject[:squash_enabled_by_default]).to eq(default)
+ expect(subject[:squash_readonly]).to eq(readonly)
+ end
+ end
+ end
+
describe 'attributes for squash commit message' do
context 'when merge request is mergeable' do
before do
diff --git a/spec/serializers/merge_request_poll_widget_entity_spec.rb b/spec/serializers/merge_request_poll_widget_entity_spec.rb
index 2b6159e883d..f0493699209 100644
--- a/spec/serializers/merge_request_poll_widget_entity_spec.rb
+++ b/spec/serializers/merge_request_poll_widget_entity_spec.rb
@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe MergeRequestPollWidgetEntity do
include ProjectForksHelper
+ using RSpec::Parameterized::TableSyntax
let(:project) { create :project, :repository }
let(:resource) { create(:merge_request, source_project: project, target_project: project) }
@@ -171,6 +172,27 @@ RSpec.describe MergeRequestPollWidgetEntity do
end
end
+ describe 'squash defaults for projects' do
+ where(:squash_option, :value, :default, :readonly) do
+ 'always' | true | true | true
+ 'never' | false | false | true
+ 'default_on' | false | true | false
+ 'default_off' | false | false | false
+ end
+
+ with_them do
+ before do
+ project.project_setting.update!(squash_option: squash_option)
+ end
+
+ it 'the key reflects the correct value' do
+ expect(subject[:squash_on_merge]).to eq(value)
+ expect(subject[:squash_enabled_by_default]).to eq(default)
+ expect(subject[:squash_readonly]).to eq(readonly)
+ end
+ end
+ end
+
context 'when head pipeline is finished' do
before do
create(:ci_pipeline, :success, project: project,
diff --git a/spec/services/auto_merge/base_service_spec.rb b/spec/services/auto_merge/base_service_spec.rb
index 9673a65344d..98fa6012089 100644
--- a/spec/services/auto_merge/base_service_spec.rb
+++ b/spec/services/auto_merge/base_service_spec.rb
@@ -51,7 +51,7 @@ RSpec.describe AutoMerge::BaseService do
expect(merge_request.merge_params['commit_message']).to eq("Merge branch 'patch-12' into 'master'")
expect(merge_request.merge_params['sha']).to eq('200fcc9c260f7219eaf0daba87d818f0922c5b18')
expect(merge_request.merge_params['should_remove_source_branch']).to eq(false)
- expect(merge_request.squash).to eq(false)
+ expect(merge_request.squash_on_merge?).to eq(false)
expect(merge_request.merge_params['squash_commit_message']).to eq('Update README.md')
end
end
diff --git a/spec/services/merge_requests/merge_service_spec.rb b/spec/services/merge_requests/merge_service_spec.rb
index 94ecd1830c2..11e341994f7 100644
--- a/spec/services/merge_requests/merge_service_spec.rb
+++ b/spec/services/merge_requests/merge_service_spec.rb
@@ -360,6 +360,25 @@ RSpec.describe MergeRequests::MergeService do
expect(Gitlab::AppLogger).to have_received(:error).with(a_string_matching(error_message))
end
+ context 'when squashing is required' do
+ before do
+ merge_request.update!(source_branch: 'master', target_branch: 'feature')
+ merge_request.target_project.project_setting.squash_always!
+ end
+
+ it 'raises an error if squashing is not done' do
+ error_message = 'requires squashing commits'
+
+ service.execute(merge_request)
+
+ expect(merge_request).to be_open
+
+ expect(merge_request.merge_commit_sha).to be_nil
+ expect(merge_request.merge_error).to include(error_message)
+ expect(Gitlab::AppLogger).to have_received(:error).with(a_string_matching(error_message))
+ end
+ end
+
context 'when squashing' do
before do
merge_request.update!(source_branch: 'master', target_branch: 'feature')
diff --git a/spec/services/merge_requests/squash_service_spec.rb b/spec/services/merge_requests/squash_service_spec.rb
index b51b7d9fbc6..1ec1dc0f6eb 100644
--- a/spec/services/merge_requests/squash_service_spec.rb
+++ b/spec/services/merge_requests/squash_service_spec.rb
@@ -131,6 +131,42 @@ RSpec.describe MergeRequests::SquashService do
include_examples 'the squash succeeds'
end
+ context 'when squashing is disabled by default on the project' do
+ # Squashing is disabled by default, but it should still allow you
+ # to squash-and-merge if selected through the UI
+ let(:merge_request) { merge_request_with_only_new_files }
+
+ before do
+ merge_request.project.project_setting.squash_default_off!
+ end
+
+ include_examples 'the squash succeeds'
+ end
+
+ context 'when squashing is forbidden on the project' do
+ let(:merge_request) { merge_request_with_only_new_files }
+
+ before do
+ merge_request.project.project_setting.squash_never!
+ end
+
+ it 'raises a squash error' do
+ expect(service.execute).to match(
+ status: :error,
+ message: a_string_including('does not allow squashing commits when merge requests are accepted'))
+ end
+ end
+
+ context 'when squashing is enabled by default on the project' do
+ let(:merge_request) { merge_request_with_only_new_files }
+
+ before do
+ merge_request.project.project_setting.squash_always!
+ end
+
+ include_examples 'the squash succeeds'
+ end
+
context 'when squashing with files too large to display' do
let(:merge_request) { merge_request_with_large_files }