Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-01-13 03:13:43 +00:00
parent 4dc620034e
commit 2de2cc6833
13 changed files with 121 additions and 111 deletions

View File

@ -31,7 +31,8 @@ export default {
props: { props: {
groupId: { groupId: {
type: Number, type: Number,
required: true, required: false,
default: null,
}, },
groupNamespace: { groupNamespace: {
type: String, type: String,
@ -57,6 +58,11 @@ export default {
required: false, required: false,
default: () => [], default: () => [],
}, },
loadingDefaultProjects: {
type: Boolean,
required: false,
default: false,
},
}, },
data() { data() {
return { return {
@ -111,6 +117,9 @@ export default {
searchTerm() { searchTerm() {
this.search(); this.search();
}, },
defaultProjects(projects) {
this.selectedProjects = [...projects];
},
}, },
mounted() { mounted() {
this.search(); this.search();
@ -202,6 +211,7 @@ export default {
ref="projectsDropdown" ref="projectsDropdown"
class="dropdown dropdown-projects" class="dropdown dropdown-projects"
toggle-class="gl-shadow-none" toggle-class="gl-shadow-none"
:loading="loadingDefaultProjects"
:show-clear-all="hasSelectedProjects" :show-clear-all="hasSelectedProjects"
show-highlighted-items-title show-highlighted-items-title
highlighted-items-title-class="gl-p-3" highlighted-items-title-class="gl-p-3"
@ -209,6 +219,7 @@ export default {
@hide="onHide" @hide="onHide"
> >
<template #button-content> <template #button-content>
<gl-loading-icon v-if="loadingDefaultProjects" class="gl-mr-2" />
<div class="gl-display-flex gl-flex-grow-1"> <div class="gl-display-flex gl-flex-grow-1">
<gl-avatar <gl-avatar
v-if="isOnlyOneProjectSelected" v-if="isOnlyOneProjectSelected"

View File

@ -304,3 +304,10 @@ $gl-line-height-42: px-to-rem(42px);
width: 25%; width: 25%;
} }
} }
// TODO: Move to @gitlab/ui by https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1671
.gl-md-pr-5 {
@include gl-media-breakpoint-up(md) {
padding-right: $gl-spacing-scale-5;
}
}

View File

@ -38,7 +38,8 @@ module IssuablesDescriptionTemplatesHelper
# Only local templates will be listed if licenses for inherited templates are not present # Only local templates will be listed if licenses for inherited templates are not present
all_templates = all_templates.values.flatten.map { |tpl| tpl[:name] }.compact.uniq all_templates = all_templates.values.flatten.map { |tpl| tpl[:name] }.compact.uniq
all_templates.find { |tmpl_name| tmpl_name == params[:issuable_template] } template = all_templates.find { |tmpl_name| tmpl_name == params[:issuable_template] }
template || all_templates.find { |tmpl_name| tmpl_name.casecmp?('default') }
end end
def available_service_desk_templates_for(project) def available_service_desk_templates_for(project)

View File

@ -883,9 +883,9 @@ of choice already. Some examples include [HAProxy](https://www.haproxy.org/)
Big-IP LTM, and Citrix Net Scaler. This documentation outlines what ports Big-IP LTM, and Citrix Net Scaler. This documentation outlines what ports
and protocols you need configure. and protocols you need configure.
WARNING: NOTE:
Long-running background jobs can maintain an idle connection with Praefect for up 6 hours. Set your load balancer timeout to be at least We recommend the equivalent of HAProxy `leastconn` load-balancing strategy because long-running operations (for example,
6 hours long. clones) keep some connections open for extended periods.
| LB Port | Backend Port | Protocol | | LB Port | Backend Port | Protocol |
|:--------|:-------------|:---------| |:--------|:-------------|:---------|

View File

@ -16,7 +16,7 @@ When implementing new features, please refer to these existing features to avoid
- [CODEOWNERS](../user/project/code_owners.md#set-up-code-owners): `.gitlab/CODEOWNERS`. - [CODEOWNERS](../user/project/code_owners.md#set-up-code-owners): `.gitlab/CODEOWNERS`.
- [Route Maps](../ci/review_apps/#route-maps): `.gitlab/route-map.yml`. - [Route Maps](../ci/review_apps/#route-maps): `.gitlab/route-map.yml`.
- [Customize Auto DevOps Helm Values](../topics/autodevops/customize.md#customize-values-for-helm-chart): `.gitlab/auto-deploy-values.yaml`. - [Customize Auto DevOps Helm Values](../topics/autodevops/customize.md#customize-values-for-helm-chart): `.gitlab/auto-deploy-values.yaml`.
- [GitLab managed apps CI/CD](../user/clusters/applications.md#usage): `.gitlab/managed-apps/config.yaml`. - [GitLab managed apps CI/CD](../user/clusters/applications.md#prerequisites): `.gitlab/managed-apps/config.yaml`.
- [Insights](../user/project/insights/index.md#configure-your-insights): `.gitlab/insights.yml`. - [Insights](../user/project/insights/index.md#configure-your-insights): `.gitlab/insights.yml`.
- [Service Desk Templates](../user/project/service_desk.md#using-customized-email-templates): `.gitlab/service_desk_templates/`. - [Service Desk Templates](../user/project/service_desk.md#using-customized-email-templates): `.gitlab/service_desk_templates/`.
- [Web IDE](../user/project/web_ide/#web-ide-configuration-file): `.gitlab/.gitlab-webide.yml`. - [Web IDE](../user/project/web_ide/#web-ide-configuration-file): `.gitlab/.gitlab-webide.yml`.

View File

@ -54,7 +54,7 @@ Supported applications:
- [PostHog](#install-posthog-using-gitlab-cicd) - [PostHog](#install-posthog-using-gitlab-cicd)
- [Prometheus](#install-prometheus-using-gitlab-cicd) - [Prometheus](#install-prometheus-using-gitlab-cicd)
### Usage ### Prerequisites
You can find and import all the files referenced below You can find and import all the files referenced below
in the [example cluster applications in the [example cluster applications
@ -95,7 +95,7 @@ applications you have configured. In case of pipeline failure, the
output of the [Helm Tiller](https://v2.helm.sh/docs/install/#running-tiller-locally) binary output of the [Helm Tiller](https://v2.helm.sh/docs/install/#running-tiller-locally) binary
is saved as a [CI job artifact](../../ci/pipelines/job_artifacts.md). is saved as a [CI job artifact](../../ci/pipelines/job_artifacts.md).
#### Usage in GitLab versions earlier than 13.5 #### Prerequisites in GitLab versions earlier than 13.5
For GitLab versions 13.5 and earlier, the Ingress, Fluentd, Prometheus, and Sentry For GitLab versions 13.5 and earlier, the Ingress, Fluentd, Prometheus, and Sentry
apps were fetched from the central Helm stable repository (`https://kubernetes-charts.storage.googleapis.com/`). apps were fetched from the central Helm stable repository (`https://kubernetes-charts.storage.googleapis.com/`).

View File

@ -116,6 +116,8 @@ You might also be interested in templates for various
### Set a default template for merge requests and issues **(PREMIUM)** ### Set a default template for merge requests and issues **(PREMIUM)**
> The `default.md` template becoming the default [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/76326) in GitLab 14.7.
In a project, you can choose a default description template for new issues and merge requests. In a project, you can choose a default description template for new issues and merge requests.
As a result, every time a new merge request or issue is created, it's pre-filled with the text you As a result, every time a new merge request or issue is created, it's pre-filled with the text you
entered in the template. entered in the template.
@ -125,17 +127,29 @@ Prerequisites:
- On your project's left sidebar, select **Settings > General** and expand **Visibility, project features, permissions**. - On your project's left sidebar, select **Settings > General** and expand **Visibility, project features, permissions**.
Ensure issues or merge requests are set to either **Everyone with access** or **Only Project Members**. Ensure issues or merge requests are set to either **Everyone with access** or **Only Project Members**.
To set a default description template for merge requests: To set a default description template for merge requests, either:
1. Go to your project's **Settings**. - [Create a merge request template](#create-a-merge-request-template) named `default.md` and save it in `.gitlab/merge_request_templates/`.
1. Select **Expand** under the **Merge requests** header. **If a `default.md` file exists, it's used as the default template even if you select another one in the project settings.**
1. Fill in the **Default description template for merge requests** text area. - Select the default template in project settings:
1. Select **Save changes**.
To set a default description template for issues: 1. On the top bar, select **Menu > Projects** and find your project.
1. On the left sidebar, select **Settings**.
1. Expand **Merge requests**.
1. Fill in the **Default description template for merge requests** text area.
1. Select **Save changes**.
1. Select **Expand** under **Default issue template**. To set a default description template for issues, either:
1. Fill in the **Default description template for issues** text area.
- [Create an issue template](#create-an-issue-template) named `default.md` and save it in `.gitlab/issue_templates/`.
**If a `default.md` file exists, it's used as the default template even if you select another one in the project settings.**
- Select the default template in project settings:
1. On the top bar, select **Menu > Projects** and find your project.
1. On the left sidebar, select **Settings**.
1. Expand **Default issue template**.
1. Fill in the **Default description template for issues** text area.
1. Select **Save changes**.
Because GitLab merge request and issues support [Markdown](../markdown.md), you can use it to format Because GitLab merge request and issues support [Markdown](../markdown.md), you can use it to format
headings, lists, and so on. headings, lists, and so on.

View File

@ -112,7 +112,7 @@ To create a group access token:
1. Run the following commands in a [Rails console](../../../administration/operations/rails_console.md): 1. Run the following commands in a [Rails console](../../../administration/operations/rails_console.md):
```ruby ```ruby
# Set the GitLab administration user to use. If user ID 1 is not available or is not an adinistrator, use 'admin = User.admins.first' instead to select an admininistrator. # Set the GitLab administration user to use. If user ID 1 is not available or is not an administrator, use 'admin = User.admins.first' instead to select an administrator.
admin = User.find(1) admin = User.find(1)
# Set the group group you want to create a token for. For example, group with ID 109. # Set the group group you want to create a token for. For example, group with ID 109.

View File

@ -27970,6 +27970,12 @@ msgstr ""
msgid "ProjectSettings|Highlight the usage of hidden unicode characters. These have innocent uses for right-to-left languages, but can also be used in potential exploits." msgid "ProjectSettings|Highlight the usage of hidden unicode characters. These have innocent uses for right-to-left languages, but can also be used in potential exploits."
msgstr "" msgstr ""
msgid "ProjectSettings|If a %{code_start}default.md%{code_end} file exists in %{code_start}.gitlab/issue_templates%{code_end} in the repository, it overrides this setting."
msgstr ""
msgid "ProjectSettings|If a %{code_start}default.md%{code_end} file exists in %{code_start}.gitlab/merge_request_templates%{code_end} in the repository, it overrides this setting."
msgstr ""
msgid "ProjectSettings|If merge trains are enabled, merging is only possible if the branch can be rebased without conflicts." msgid "ProjectSettings|If merge trains are enabled, merging is only possible if the branch can be rebased without conflicts."
msgstr "" msgstr ""

View File

@ -83,13 +83,6 @@ module QA
def start_node(name) def start_node(name)
shell "docker start #{name}" shell "docker start #{name}"
wait_until_shell_command_matches(
"docker inspect -f {{.State.Running}} #{name}",
/true/,
sleep_interval: 3,
max_duration: 180,
retry_on_exception: true
)
end end
def stop_node(name) def stop_node(name)
@ -180,7 +173,6 @@ module QA
start_node(@praefect) start_node(@praefect)
wait_for_health_check_all_nodes wait_for_health_check_all_nodes
wait_for_reliable_connection
end end
def verify_storage_move(source_storage, destination_storage, repo_type: :project) def verify_storage_move(source_storage, destination_storage, repo_type: :project)
@ -192,21 +184,15 @@ module QA
end end
def wait_for_praefect def wait_for_praefect
wait_until_shell_command_matches( QA::Runtime::Logger.info("Waiting for health check on praefect")
"docker inspect -f {{.State.Running}} #{@praefect}", Support::Waiter.wait_until(max_duration: 120, sleep_interval: 1, raise_on_failure: true) do
/true/, # praefect runs a grpc server on port 2305, which will return an error 'Connection refused' until such time it is ready
sleep_interval: 3, wait_until_shell_command("docker exec #{@gitaly_cluster} bash -c 'curl #{@praefect}:2305'") do |line|
max_duration: 180, break if line.include?('curl: (1) Received HTTP/0.9 when not allowed')
retry_on_exception: true
)
QA::Runtime::Logger.info('Wait until Praefect starts and is listening') QA::Runtime::Logger.debug(line.chomp)
wait_until_shell_command_matches( end
"docker exec #{@praefect} bash -c 'cat /var/log/gitlab/praefect/current'", end
/listening at tcp address/
)
wait_for_gitaly_check
end end
def wait_for_sql_ping def wait_for_sql_ping
@ -220,72 +206,35 @@ module QA
['error when pinging healthcheck', 'failed checking node health'].include?(msg) ['error when pinging healthcheck', 'failed checking node health'].include?(msg)
end end
def wait_for_no_praefect_storage_error
# If a healthcheck error was the last message to be logged, we'll keep seeing that message even if it's no longer a problem
# That is, there's no message shown in the Praefect logs when the healthcheck succeeds
# To work around that we perform the gitaly check rake task, wait a few seconds, and then we confirm that no healthcheck errors appear
QA::Runtime::Logger.info("Checking that Praefect does not report healthcheck errors with its gitaly nodes")
Support::Waiter.wait_until(max_duration: 120) do
wait_for_gitaly_check
sleep 5
shell "docker exec #{@praefect} bash -c 'tail -n 1 /var/log/gitlab/praefect/current'" do |line|
QA::Runtime::Logger.debug(line.chomp)
log = JSON.parse(line)
break true unless health_check_failure_message?(log['msg'])
rescue JSON::ParserError
# Ignore lines that can't be parsed as JSON
end
end
end
def wait_for_storage_nodes
wait_for_no_praefect_storage_error
Support::Waiter.repeat_until(max_attempts: 3, max_duration: 120, sleep_interval: 1) do
nodes_confirmed = {
@primary_node => false,
@secondary_node => false,
@tertiary_node => false
}
wait_until_shell_command("docker exec #{@praefect} bash -c '/opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml dial-nodes'") do |line|
QA::Runtime::Logger.debug(line.chomp)
nodes_confirmed.each_key do |node|
nodes_confirmed[node] = true if line =~ /SUCCESS: confirmed Gitaly storage "#{node}" in virtual storages \[#{@virtual_storage}\] is served/
end
nodes_confirmed.values.all?
end
end
end
def wait_for_health_check_all_nodes def wait_for_health_check_all_nodes
wait_for_health_check(@primary_node) wait_for_gitaly_health_check(@primary_node)
wait_for_health_check(@secondary_node) wait_for_gitaly_health_check(@secondary_node)
wait_for_health_check(@tertiary_node) wait_for_gitaly_health_check(@tertiary_node)
end end
def wait_for_health_check(node) def wait_for_gitaly_health_check(node)
QA::Runtime::Logger.info("Waiting for health check on #{node}") QA::Runtime::Logger.info("Waiting for health check on #{node}")
Support::Waiter.wait_until(max_duration: 120, sleep_interval: 1, raise_on_failure: true) do
# gitaly runs a grpc server on port 8075, which will return an error 'Connection refused' until such time it is ready
wait_until_shell_command("docker exec #{@praefect} bash -c 'curl #{node}:8075'") do |line|
break if line.include?('curl: (1) Received HTTP/0.9 when not allowed')
QA::Runtime::Logger.debug(line.chomp)
end
end
wait_until_node_is_marked_as_healthy_storage(node) wait_until_node_is_marked_as_healthy_storage(node)
end end
def wait_for_primary_node_health_check def wait_for_primary_node_health_check
wait_for_health_check(@primary_node) wait_for_gitaly_health_check(@primary_node)
end end
def wait_for_secondary_node_health_check def wait_for_secondary_node_health_check
wait_for_health_check(@secondary_node) wait_for_gitaly_health_check(@secondary_node)
end end
def wait_for_tertiary_node_health_check def wait_for_tertiary_node_health_check
wait_for_health_check(@tertiary_node) wait_for_gitaly_health_check(@tertiary_node)
end end
def wait_for_health_check_failure(node) def wait_for_health_check_failure(node)
@ -311,7 +260,6 @@ module QA
shell sql_to_docker_exec_cmd("SELECT count(*) FROM healthy_storages WHERE storage = '#{node}';") do |line| shell sql_to_docker_exec_cmd("SELECT count(*) FROM healthy_storages WHERE storage = '#{node}';") do |line|
result << line result << line
end end
QA::Runtime::Logger.debug("result is ---#{result}")
result[2].to_i == 0 result[2].to_i == 0
end end
end end
@ -322,21 +270,10 @@ module QA
shell sql_to_docker_exec_cmd("SELECT count(*) FROM healthy_storages WHERE storage = '#{node}';") do |line| shell sql_to_docker_exec_cmd("SELECT count(*) FROM healthy_storages WHERE storage = '#{node}';") do |line|
result << line result << line
end end
QA::Runtime::Logger.debug("result is ---#{result}")
result[2].to_i == 1 result[2].to_i == 1
end end
end end
def wait_for_gitaly_check
Support::Waiter.wait_until(max_duration: 120, sleep_interval: 1, raise_on_failure: true) do
wait_until_shell_command("docker exec #{@gitlab} bash -c 'gitlab-rake gitlab:git:fsck'") do |line|
QA::Runtime::Logger.debug(line.chomp)
line.include?('Done')
end
end
end
# Waits until there is an increase in the number of reads for # Waits until there is an increase in the number of reads for
# any node compared to the number of reads provided. If a node # any node compared to the number of reads provided. If a node
# has no pre-read data, consider it to have had zero reads. # has no pre-read data, consider it to have had zero reads.
@ -354,12 +291,6 @@ module QA
data.find(-> {{ value: 0 }}) { |item| item[:node] == node }[:value] data.find(-> {{ value: 0 }}) { |item| item[:node] == node }[:value]
end end
def wait_for_reliable_connection
QA::Runtime::Logger.info('Wait until GitLab and Praefect can communicate reliably')
wait_for_sql_ping
wait_for_storage_nodes
end
def wait_for_replication(project_id) def wait_for_replication(project_id)
Support::Waiter.wait_until(sleep_interval: 1) { replication_queue_incomplete_count == 0 && replicated?(project_id) } Support::Waiter.wait_until(sleep_interval: 1) { replication_queue_incomplete_count == 0 && replicated?(project_id) }
end end
@ -476,7 +407,7 @@ module QA
end end
def repository_replicated_to_disk?(node, relative_path) def repository_replicated_to_disk?(node, relative_path)
Support::Waiter.wait_until(max_duration: 300, sleep_interval: 3, raise_on_failure: false) do Support::Waiter.wait_until(max_duration: 300, sleep_interval: 1, raise_on_failure: false) do
result = [] result = []
shell sql_to_docker_exec_cmd("SELECT count(*) FROM storage_repositories where relative_path='#{relative_path}';") do |line| shell sql_to_docker_exec_cmd("SELECT count(*) FROM storage_repositories where relative_path='#{relative_path}';") do |line|
result << line result << line

View File

@ -49,7 +49,6 @@ module QA
# for Gitaly to be ready for writes again # for Gitaly to be ready for writes again
praefect_manager.stop_primary_node praefect_manager.stop_primary_node
praefect_manager.wait_for_primary_node_health_check_failure praefect_manager.wait_for_primary_node_health_check_failure
praefect_manager.wait_for_gitaly_check
Resource::Repository::Commit.fabricate_via_api! do |commit| Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = project commit.project = project

View File

@ -72,6 +72,37 @@ RSpec.describe IssuablesDescriptionTemplatesHelper, :clean_gitlab_redis_cache do
].to_json ].to_json
expect(helper.available_service_desk_templates_for(@project)).to eq(value) expect(helper.available_service_desk_templates_for(@project)).to eq(value)
end end
context 'when no issuable_template parameter or default template is present' do
it 'does not select a template' do
expect(helper.selected_template(project)).to be(nil)
end
end
context 'when an issuable_template parameter has been provided' do
before do
allow(helper).to receive(:params).and_return({ issuable_template: 'another_issue_template' })
end
it 'selects the issuable template' do
expect(helper.selected_template(project)).to eq('another_issue_template')
end
end
context 'when there is a default template' do
let(:templates) do
{
"" => [
{ name: "another_issue_template", id: "another_issue_template", project_id: project.id },
{ name: "default", id: "default", project_id: project.id }
]
}
end
it 'selects the default template' do
expect(helper.selected_template(project)).to eq('default')
end
end
end end
context 'when there are not templates in the project' do context 'when there are not templates in the project' do

View File

@ -259,6 +259,16 @@ RSpec.describe Issues::MoveService do
it_behaves_like 'copy or reset relative position' it_behaves_like 'copy or reset relative position'
end end
context 'issue with escalation status' do
it 'keeps the escalation status' do
escalation_status = create(:incident_management_issuable_escalation_status, issue: old_issue)
move_service.execute(old_issue, new_project)
expect(escalation_status.reload.issue).to eq(old_issue)
end
end
end end
describe 'move permissions' do describe 'move permissions' do