Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-05-24 03:08:48 +00:00
parent 190709c797
commit a67ba1bbfa
7 changed files with 131 additions and 49 deletions

View File

@ -185,6 +185,7 @@
- "doc/**/*"
- ".markdownlint.yml"
- "scripts/lint-doc.sh"
- ".gitlab/ci/docs.gitlab-ci.yml"
.docs-deprecations-and-removals-patterns: &docs-deprecations-and-removals-patterns
- "doc/update/deprecations.md"

View File

@ -7,34 +7,19 @@
= s_('ProjectSettings|Set the default behavior of this option in merge requests. Changes to this are also applied to existing merge requests.')
= link_to "What is squashing?", help_page_path('user/project/merge_requests/squash_and_merge.md'), target: '_blank', rel: 'noopener noreferrer'
.form-check.gl-mb-2
= settings.radio_button :squash_option, :never, class: "form-check-input"
= label_tag :project_project_setting_attributes_squash_option_never, class: 'form-check-label' do
.gl-font-weight-bold
= s_('ProjectSettings|Do not allow')
.text-secondary
= s_('ProjectSettings|Squashing is never performed and the checkbox is hidden.')
.form-check.gl-mb-2
= settings.radio_button :squash_option, :default_off, class: "form-check-input"
= label_tag :project_project_setting_attributes_squash_option_default_off, class: 'form-check-label' do
.gl-font-weight-bold
= s_('ProjectSettings|Allow')
.text-secondary
= s_('ProjectSettings|Checkbox is visible and unselected by default.')
.form-check.gl-mb-2
= settings.radio_button :squash_option, :default_on, class: "form-check-input"
= label_tag :project_project_setting_attributes_squash_option_default_on, class: 'form-check-label' do
.gl-font-weight-bold
= s_('ProjectSettings|Encourage')
.text-secondary
= s_('ProjectSettings|Checkbox is visible and selected by default.')
.form-check.gl-mb-2
= settings.radio_button :squash_option, :always, class: "form-check-input"
= label_tag :project_project_setting_attributes_squash_option_always, class: 'form-check-label' do
.gl-font-weight-bold
= s_('ProjectSettings|Require')
.text-secondary
= s_('ProjectSettings|Squashing is always performed. Checkbox is visible and selected, and users cannot change it.')
= settings.gitlab_ui_radio_component :squash_option,
:never,
s_('ProjectSettings|Do not allow'),
help_text: s_('ProjectSettings|Squashing is never performed and the checkbox is hidden.')
= settings.gitlab_ui_radio_component :squash_option,
:default_off,
s_('ProjectSettings|Allow'),
help_text: s_('ProjectSettings|Checkbox is visible and unselected by default.')
= settings.gitlab_ui_radio_component :squash_option,
:default_on,
s_('ProjectSettings|Encourage'),
help_text: s_('ProjectSettings|Checkbox is visible and selected by default.')
= settings.gitlab_ui_radio_component :squash_option,
:always,
s_('ProjectSettings|Require'),
help_text: s_('ProjectSettings|Squashing is always performed. Checkbox is visible and selected, and users cannot change it.')

View File

@ -202,7 +202,7 @@ The runner tags list can not be empty when it's not allowed to pick untagged job
Below are some example scenarios of different variations.
### runner runs only tagged jobs
### Runner runs only tagged jobs
The following examples illustrate the potential impact of the runner being set
to run only tagged jobs.
@ -222,7 +222,7 @@ Example 3:
1. The runner is configured to run only tagged jobs and has the `docker` tag.
1. A job that has no tags defined is executed and stuck.
### runner is allowed to run untagged jobs
### Runner is allowed to run untagged jobs
The following examples illustrate the potential impact of the runner being set
to run tagged and untagged jobs.
@ -281,6 +281,17 @@ variables:
- echo "Hello runner selector feature"
```
## Runner statuses
A runner can have one of the following statuses.
| Status | Description |
|--------|-------------|
| **online** | The runner has contacted GitLab within the last 2 hours and is available to run jobs. |
| **offline** | The runner has not contacted GitLab in more than 2 hours and is not available to run jobs. Check the runner to see if you can bring it online. |
| **stale** | The runner has not contacted GitLab in more than 3 months. If the runner was created more than 3 months ago, but it never contacted the instance, it is also considered **stale**. |
| **never_contacted** | The runner has never contacted GitLab. To make the runner contact GitLab, run `gitlab-runner run`. |
## Configure runner behavior with variables
You can use [CI/CD variables](../variables/index.md) to configure runner Git behavior

View File

@ -320,7 +320,7 @@ The [File Sync](#file-syncing-to-web-terminal) feature is supported on Kubernete
To enable the Web IDE terminals you must create the file
`.gitlab/.gitlab-webide.yml` inside the repository's root. This
file is fairly similar to the [CI configuration file](../../../ci/yaml/index.md)
file is fairly similar to the [`.gitlab-ci.yml` file](../../../ci/yaml/index.md)
syntax but with some restrictions:
- No global blocks (such as `before_script` or `after_script`) can be defined.
@ -334,7 +334,7 @@ syntax but with some restrictions:
that, if you override the default `script` value, you have to add a command
which would keep the job running, like `sleep`.
In the code below there is an example of this configuration file:
For example, with this configuration file:
```yaml
terminal:
@ -348,16 +348,16 @@ terminal:
NODE_ENV: "test"
```
After the terminal has started, the console is displayed and we could access
After the terminal starts, the console is displayed and you can access
the project repository files.
When you use the image keyword, a container with the specified image is created. If you specify an image, it has no effect. This is the case when you use the [shell executor](https://docs.gitlab.com/runner/executors/shell.html).
When you use the `image` keyword, a container with the specified image is created.
If you use the [shell executor](https://docs.gitlab.com/runner/executors/shell.html)
or the [SSH executor](https://docs.gitlab.com/runner/executors/ssh.html), `image` has no effect.
**Important**. The terminal job is branch dependent. This means that the
configuration file used to trigger and configure the terminal is the one in
the selected branch of the Web IDE.
If there is no configuration file in a branch, an error message is shown.
The terminal job is branch dependent. The configuration file used to trigger
and configure the terminal is the one in the selected branch of the Web IDE.
If no configuration file exists in a branch, an error message is displayed.
### Running interactive terminals in the Web IDE

View File

@ -473,6 +473,21 @@ module Gitlab
)
handle_cherry_pick_or_revert_response(response)
rescue GRPC::BadStatus => e
detailed_error = decode_detailed_error(e)
case detailed_error&.error
when :access_check
access_check_error = detailed_error.access_check
# These messages were returned from internal/allowed API calls
raise Gitlab::Git::PreReceiveError.new(fallback_message: access_check_error.error_message)
when :cherry_pick_conflict
raise Gitlab::Git::Repository::CreateTreeError, 'CONFLICT'
when :target_branch_diverged
raise Gitlab::Git::CommitError, 'branch diverged'
else
raise e
end
end
def handle_cherry_pick_or_revert_response(response)

View File

@ -106,10 +106,10 @@ then
echo "Merge request pipeline (detached) detected. Testing all files."
else
MERGE_BASE=$(git merge-base ${CI_MERGE_REQUEST_TARGET_BRANCH_SHA} ${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA})
if git diff --diff-filter=d --name-only "${MERGE_BASE}..${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}" | grep -E "\.vale|\.markdownlint|lint-doc\.sh"
if git diff --diff-filter=d --name-only "${MERGE_BASE}..${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}" | grep -E "\.vale|\.markdownlint|lint-doc\.sh|docs\.gitlab-ci\.yml"
then
MD_DOC_PATH=${MD_DOC_PATH:-doc}
echo "Vale, Markdownlint, or lint-doc.sh configuration changed. Testing all files."
echo "Vale, Markdownlint, lint-doc.sh, or pipeline configuration changed. Testing all files."
else
MD_DOC_PATH=$(git diff --diff-filter=d --name-only "${MERGE_BASE}..${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}" -- 'doc/*.md')
if [ -n "${MD_DOC_PATH}" ]

View File

@ -416,6 +416,15 @@ RSpec.describe Gitlab::GitalyClient::OperationService do
end
end
shared_examples '#user_cherry_pick with a gRPC error' do
it 'raises an exception' do
expect_any_instance_of(Gitaly::OperationService::Stub).to receive(:user_cherry_pick)
.and_raise(raised_error)
expect { subject }.to raise_error(expected_error, expected_error_message)
end
end
describe '#user_cherry_pick' do
let(:response_class) { Gitaly::UserCherryPickResponse }
@ -430,13 +439,74 @@ RSpec.describe Gitlab::GitalyClient::OperationService do
)
end
before do
expect_any_instance_of(Gitaly::OperationService::Stub)
.to receive(:user_cherry_pick).with(kind_of(Gitaly::UserCherryPickRequest), kind_of(Hash))
.and_return(response)
context 'when errors are not raised but returned in the response' do
before do
expect_any_instance_of(Gitaly::OperationService::Stub)
.to receive(:user_cherry_pick).with(kind_of(Gitaly::UserCherryPickRequest), kind_of(Hash))
.and_return(response)
end
it_behaves_like 'cherry pick and revert errors'
end
it_behaves_like 'cherry pick and revert errors'
context 'when AccessCheckError is raised' do
let(:raised_error) do
new_detailed_error(
GRPC::Core::StatusCodes::INTERNAL,
'something failed',
Gitaly::UserCherryPickError.new(
access_check: Gitaly::AccessCheckError.new(
error_message: 'something went wrong'
)))
end
let(:expected_error) { Gitlab::Git::PreReceiveError }
let(:expected_error_message) { "something went wrong" }
it_behaves_like '#user_cherry_pick with a gRPC error'
end
context 'when NotAncestorError is raised' do
let(:raised_error) do
new_detailed_error(
GRPC::Core::StatusCodes::FAILED_PRECONDITION,
'Branch diverged',
Gitaly::UserCherryPickError.new(
target_branch_diverged: Gitaly::NotAncestorError.new
)
)
end
let(:expected_error) { Gitlab::Git::CommitError }
let(:expected_error_message) { 'branch diverged' }
it_behaves_like '#user_cherry_pick with a gRPC error'
end
context 'when MergeConflictError is raised' do
let(:raised_error) do
new_detailed_error(
GRPC::Core::StatusCodes::FAILED_PRECONDITION,
'Conflict',
Gitaly::UserCherryPickError.new(
cherry_pick_conflict: Gitaly::MergeConflictError.new
)
)
end
let(:expected_error) { Gitlab::Git::Repository::CreateTreeError }
let(:expected_error_message) { }
it_behaves_like '#user_cherry_pick with a gRPC error'
end
context 'when a non-detailed gRPC error is raised' do
let(:raised_error) { GRPC::Internal.new('non-detailed error') }
let(:expected_error) { GRPC::Internal }
let(:expected_error_message) { }
it_behaves_like '#user_cherry_pick with a gRPC error'
end
end
describe '#user_revert' do