Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-04-21 15:10:09 +00:00
parent 77839aae00
commit 48e30ea32f
48 changed files with 126 additions and 78 deletions

View File

@ -99,7 +99,7 @@ rules:
message: 'Migrate to GlSkeletonLoader, or import GlDeprecatedSkeletonLoading.'
overrides:
- files:
- '{,ee/,jh/}spec/frontend*/**/*'
- '{,ee/,jh/}spec/frontend*/**/*'
rules:
'@gitlab/require-i18n-strings': off
'@gitlab/no-runtime-template-compiler': off
@ -139,13 +139,11 @@ overrides:
parser: '@graphql-eslint/eslint-plugin'
operations:
- '{,ee/,jh/}app/**/*.graphql'
# You can run `bundle exec rake gitlab:graphql:schema:dump` and then uncomment this line
# schema: './tmp/tests/graphql/gitlab_schema.graphql'
# You can run `bundle exec rake gitlab:graphql:schema:dump` and then uncomment this line
# schema: './tmp/tests/graphql/gitlab_schema.graphql'
rules:
filenames/match-regex: off
spaced-comment: off
# TODO: We need a way to include this rule + support ee_else_ce fragments
#'@graphql-eslint/unique-fragment-name': error
# TODO: Uncomment these rules when then `schema` is available
#'@graphql-eslint/fragments-on-composite-type': error
#'@graphql-eslint/known-argument-names': error
@ -153,3 +151,4 @@ overrides:
'@graphql-eslint/no-anonymous-operations': error
'@graphql-eslint/unique-operation-name': error
'@graphql-eslint/require-id-when-available': error
'@graphql-eslint/unique-fragment-name': error

View File

@ -103,7 +103,7 @@ yarn-audit-dependency_scanning:
extends: .default-retry
stage: test
image:
name: registry.gitlab.com/gitlab-org/security-products/package-hunter-cli:v1.3.0@sha256:6cb717d1772cf5a8a68dd8268e44925f71b7867d9f3fa41a4ba2c291b7446c50
name: registry.gitlab.com/gitlab-org/security-products/package-hunter-cli:v1.3.1@sha256:582b70bdb002075e33d63758e4c55af376b9f50278f826b4366acce922a9e357
entrypoint: [""]
variables:
HTR_user: '$PACKAGE_HUNTER_USER'

View File

@ -111,7 +111,6 @@ review-deploy:
artifacts:
paths:
- environment_url.txt
- curl_output.txt
expire_in: 7 days
when: always

View File

@ -1,3 +1,5 @@
# This fragment is used as ee-else-ce
# eslint-disable-next-line @graphql-eslint/unique-fragment-name
fragment HttpIntegrationPayloadData on AlertManagementHttpIntegration {
id
}

View File

@ -1,3 +1,5 @@
# This fragment is used as ee-else-ce
# eslint-disable-next-line @graphql-eslint/unique-fragment-name
fragment BoardFragment on Board {
id
name

View File

@ -1,5 +1,7 @@
#import "./board_list_shared.fragment.graphql"
# This fragment is used as ee-else-ce
# eslint-disable-next-line @graphql-eslint/unique-fragment-name
fragment BoardListFragment on BoardList {
...BoardListShared
}

View File

@ -1,3 +1,5 @@
# This fragment is used as ee-else-ce
# eslint-disable-next-line @graphql-eslint/unique-fragment-name
fragment BoardScopeFragment on Board {
id
name

View File

@ -1,5 +1,7 @@
#import "~/graphql_shared/fragments/issue.fragment.graphql"
# This fragment is used as ee-else-ce
# eslint-disable-next-line @graphql-eslint/unique-fragment-name
fragment Issue on Issue {
id
...IssueNode

View File

@ -1,4 +1,4 @@
fragment Iteration on Iteration {
fragment IterationShared on Iteration {
id
title
}

View File

@ -1,4 +0,0 @@
fragment PageInfo on PageInfo {
startCursor
endCursor
}

View File

@ -1,4 +1,5 @@
# eslint-disable-next-line @graphql-eslint/require-id-when-available
# This fragment is used as ee-else-ce
# eslint-disable-next-line @graphql-eslint/require-id-when-available, @graphql-eslint/unique-fragment-name
fragment IncidentFields on Issue {
severity
escalationStatus

View File

@ -1,6 +0,0 @@
fragment Label on Label {
id
color
textColor
title
}

View File

@ -1,4 +1,4 @@
#import "./label.fragment.graphql"
#import "~/graphql_shared/fragments/label.fragment.graphql"
query searchLabels($fullPath: ID!, $search: String, $isProject: Boolean = false) {
group(fullPath: $fullPath) @skip(if: $isProject) {

View File

@ -1,4 +1,4 @@
#import "./user.fragment.graphql"
#import "~/graphql_shared/fragments/user.fragment.graphql"
query searchUsers($fullPath: ID!, $search: String, $isProject: Boolean = false) {
group(fullPath: $fullPath) @skip(if: $isProject) {

View File

@ -1,6 +0,0 @@
fragment User on User {
id
avatarUrl
name
username
}

View File

@ -1,3 +1,5 @@
# This fragment is used as ee-else-ce
# eslint-disable-next-line @graphql-eslint/unique-fragment-name
fragment TreeEntryCommit on LogTreeCommit {
sha
message

View File

@ -1,3 +1,5 @@
# This fragment is used as ee-else-ce
# eslint-disable-next-line @graphql-eslint/unique-fragment-name
fragment ProjectPathLocksFragment on Project {
id
}

View File

@ -1,5 +1,7 @@
#import "./runner_details_shared.fragment.graphql"
# This fragment is used as ee-else-ce
# eslint-disable-next-line @graphql-eslint/unique-fragment-name
fragment RunnerDetails on CiRunner {
...RunnerDetailsShared
}

View File

@ -12,7 +12,7 @@ query groupMilestones($fullPath: ID!, $title: String, $state: MilestoneStateEnum
includeAncestors: true
) {
nodes {
...MilestoneFragment
...SidebarMilestoneFragment
state
}
}

View File

@ -8,7 +8,7 @@ query mergeRequestMilestone($fullPath: ID!, $iid: String!) {
__typename
id
attribute: milestone {
...MilestoneFragment
...SidebarMilestoneFragment
}
}
}

View File

@ -1,4 +1,4 @@
fragment MilestoneFragment on Milestone {
fragment SidebarMilestoneFragment on Milestone {
id
title
webUrl: webPath

View File

@ -8,7 +8,7 @@ query projectIssueMilestone($fullPath: ID!, $iid: String!) {
__typename
id
attribute: milestone {
...MilestoneFragment
...SidebarMilestoneFragment
}
}
}

View File

@ -12,7 +12,7 @@ query projectMilestones($fullPath: ID!, $title: String, $state: MilestoneStateEn
includeAncestors: true
) {
nodes {
...MilestoneFragment
...SidebarMilestoneFragment
state
}
}

View File

@ -4,6 +4,7 @@ class Explore::GroupsController < Explore::ApplicationController
include GroupTree
feature_category :subgroups
urgency :low
def index
render_group_tree GroupsFinder.new(current_user).execute

View File

@ -24,8 +24,9 @@ class Explore::ProjectsController < Explore::ApplicationController
rescue_from PageOutOfBoundsError, with: :page_out_of_bounds
feature_category :projects
# TODO: Set higher urgency after addressing https://gitlab.com/gitlab-org/gitlab/-/issues/357913
# and https://gitlab.com/gitlab-org/gitlab/-/issues/358945
urgency :low, [:index, :trending]
urgency :low, [:index]
def index

View File

@ -7,6 +7,7 @@ module Groups
skip_cross_project_access_check :index
feature_category :subgroups
urgency :low, [:index]
def index
shared_projects = GroupProjectsFinder.new(

View File

@ -59,8 +59,9 @@ class GroupsController < Groups::ApplicationController
feature_category :importers, [:export, :download_export]
urgency :high, [:unfoldered_environment_names]
# TODO: Set #show to higher urgency after resolving https://gitlab.com/gitlab-org/gitlab/-/issues/334795
urgency :low, [:merge_requests, :show]
urgency :low, [:merge_requests, :show, :create, :new, :update]
def index
redirect_to(current_user ? dashboard_groups_path : explore_groups_path)

View File

@ -8,6 +8,7 @@ class Profiles::EmailsController < Profiles::ApplicationController
only: [:resend_confirmation_instructions]
feature_category :users
urgency :low, [:index]
def index
@primary_email = current_user.email

View File

@ -57,7 +57,8 @@ class ProjectsController < Projects::ApplicationController
feature_category :portfolio_management, [:planning_hierarchy]
# TODO: Set high urgency for #show https://gitlab.com/gitlab-org/gitlab/-/issues/334444
urgency :low, [:refs, :show]
urgency :low, [:refs, :show, :destroy]
urgency :high, [:unfoldered_environment_names]
def index

View File

@ -34,7 +34,7 @@ class UsersController < ApplicationController
feature_category :snippets, [:snippets]
# TODO: Set higher urgency after resolving https://gitlab.com/gitlab-org/gitlab/-/issues/357914
urgency :low, [:show]
urgency :low, [:show, :calendar_activities]
def show
respond_to do |format|

View File

@ -1,4 +1,4 @@
fragment PageInfo on PageInfo {
fragment LocalPageInfo on PageInfo {
__typename
hasNextPage
hasPreviousPage
@ -6,7 +6,7 @@ fragment PageInfo on PageInfo {
endCursor
}
fragment TreeEntry on Entry {
fragment LocalTreeEntry on Entry {
__typename
id
sha
@ -34,12 +34,12 @@ query getFiles(
edges {
__typename
node {
...TreeEntry
...LocalTreeEntry
webPath
}
}
pageInfo {
...PageInfo
...LocalPageInfo
}
}
submodules(first: $pageSize, after: $nextPageCursor) {
@ -47,13 +47,13 @@ query getFiles(
edges {
__typename
node {
...TreeEntry
...LocalTreeEntry
webUrl
treeUrl
}
}
pageInfo {
...PageInfo
...LocalPageInfo
}
}
blobs(first: $pageSize, after: $nextPageCursor) {
@ -61,14 +61,14 @@ query getFiles(
edges {
__typename
node {
...TreeEntry
...LocalTreeEntry
mode
webPath
lfsOid
}
}
pageInfo {
...PageInfo
...LocalPageInfo
}
}
}

View File

@ -203,7 +203,7 @@ do this work in a regular migration.
def up
queue_batched_background_migration(
MIGRATION,
:migrations,
:integrations,
:id,
job_interval: DELAY_INTERVAL
)
@ -211,7 +211,7 @@ do this work in a regular migration.
def down
Gitlab::Database::BackgroundMigration::BatchedMigration
.for_configuration(MIGRATION, :migrations, :id, []).delete_all
.for_configuration(MIGRATION, :integrations, :id, []).delete_all
end
end
```

View File

@ -11,11 +11,11 @@ your applications.
## Measure reliability and stability with metrics (DEPRECATED)
> [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/346485) in GitLab 14.7.
> [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/346541) in GitLab 14.7.
WARNING:
This feature is in its end-of-life process. It is [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/346485)
in GitLab 14.7, and is planned for removal in GitLab 15.0.
This feature is in its end-of-life process. It is [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/346541)
for use in GitLab 14.7, and is planned for removal in GitLab 16.0.
Metrics help you understand the health and performance of your infrastructure,
applications, and systems by providing insights into your application's reliability,

View File

@ -6,6 +6,12 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# Embedding metric charts within GitLab Flavored Markdown **(FREE)**
> [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/346541) in GitLab 14.7.
WARNING:
This feature is in its end-of-life process. It is [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/346541)
for use in GitLab 14.7, and is planned for removal in GitLab 16.0.
You can display metrics charts within
[GitLab Flavored Markdown (GLFM)](../../user/markdown.md)
fields such as issue or merge request descriptions. The maximum number of embedded

View File

@ -6,6 +6,12 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# Monitor your environment's metrics **(FREE)**
> [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/346541) in GitLab 14.7.
WARNING:
This feature is in its end-of-life process. It is [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/346541)
for use in GitLab 14.7, and is planned for removal in GitLab 16.0.
GitLab helps your team monitor the health and performance of your applications
and infrastructure by turning statistics and log files into charts and graphs
that are easy to understand, especially when time is short and decisions are

View File

@ -20,7 +20,7 @@ Broadcast messages can be managed using the [broadcast messages API](../../api/b
Banners are shown on the top of a page and in Git remote responses.
![Broadcast Message Banner](img/broadcast_messages_banner_v12_10.png)
![Broadcast Message Banner](img/broadcast_messages_banner_v15_0.png)
```shell
$ git push
@ -66,18 +66,13 @@ To add a broadcast message:
- `padding`
- `margin`
- `text-decoration`
1. Select one of the suggested background colors, or add the hex code of a different color. The default color is orange.
1. Select a **Theme**. The default theme is `indigo`.
1. Select the **Dismissable** checkbox to enable users to dismiss the broadcast message.
1. Optional. Select **Target roles** to only show the broadcast message to users with the selected roles. The message displays on group, subgroup, and project pages, and does not display in Git remote responses.
1. If required, add a **Target Path** to only show the broadcast message on URLs matching that path. You can use the wildcard character `*` to match multiple URLs, for example `mygroup/myproject*`.
1. Select a date for the message to start and end.
1. Select **Add broadcast message**.
NOTE:
The **Background color** field expects the value to be a hexadecimal code because
the form uses the [color_field](https://api.rubyonrails.org/v6.0.3.4/classes/ActionView/Helpers/FormHelper.html#method-i-color_field)
helper method, which generates the proper HTML to render.
When a broadcast message expires, it no longer displays in the user interface but is still listed in the
list of broadcast messages.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -50,19 +50,43 @@ strategies to deploy to your cluster with restricted account access. To do so:
### Migrate from Auto DevOps
To configure your Auto DevOps project to use the GitLab agent:
In your Auto DevOps project, you can use the GitLab agent to connect with your Kubernetes cluster.
1. Follow the steps to [install an agent](../../clusters/agent/install/index.md) in your cluster.
1. Go to the project where you use Auto DevOps.
1. On the left sidebar, select **Settings > CI/CD** and expand **Variables**.
1. Select **Add new variable**.
1. Add `KUBE_CONTEXT` as the key, `path/to/agent/project:agent-name` as the value, and select the environment scope of your choice.
1. [Install an agent](../../clusters/agent/install/index.md) in your cluster.
1. In GitLab, go to the project where you use Auto DevOps.
1. Add three variables. On the left sidebar, select **Settings > CI/CD** and expand **Variables**.
- Add a key called `KUBE_INGRESS_BASE_DOMAIN` with the application deployment domain as the value.
- Add a key called `KUBE_CONTEXT` with a value like `path/to/agent/project:agent-name`.
Select the environment scope of your choice.
If you are not sure what your agents context is, edit your `.gitlab-ci.yml` file and add a job to see the available contexts:
```yaml
deploy:
image:
name: bitnami/kubectl:latest
entrypoint: [""]
script:
- kubectl config get-contexts
```
- Add a key called `KUBE_NAMESPACE` with a value of the Kubernetes namespace for your deployments to target. Set the same environment scope.
1. Select **Add variable**.
1. Repeat the process to add another variable, `KUBE_NAMESPACE`, setting the value for the Kubernetes namespace you want your deployments to target, and set the same environment scope from the previous step.
1. On the left sidebar, select **Infrastructure > Kubernetes clusters**.
1. From the certificate-based clusters section, open the cluster that serves the same environment scope.
1. Select the **Details** tab and disable the cluster.
1. To activate the changes, on the left sidebar, select **CI/CD > Pipelines** and then **Run pipeline**.
1. Edit your `.gitlab-ci.yml` file and ensure it's using the Auto DevOps template. For example:
```yaml
include:
template: Auto-DevOps.gitlab-ci.yml
variables:
KUBE_INGRESS_BASE_DOMAIN: 74.220.23.215.nip.io
KUBE_CONTEXT: "gitlab-examples/ops/gitops-demo/k8s-agents:demo-agent"
KUBE_NAMESPACE: "demo-agent"
```
1. To test your pipeline, on the left sidebar, select **CI/CD > Pipelines** and then **Run pipeline**.
For an example, [view this project](https://gitlab.com/gitlab-examples/ops/gitops-demo/hello-world-service).

View File

@ -72,7 +72,7 @@ module API
params do
requires :badge_id, type: Integer, desc: 'The badge ID'
end
get ":id/badges/:badge_id" do
get ":id/badges/:badge_id", urgency: :default do
source = find_source(source_type, params[:id])
badge = find_badge(source)
@ -88,7 +88,7 @@ module API
requires :image_url, type: String, desc: 'URL of the badge image'
optional :name, type: String, desc: 'Name for the badge'
end
post ":id/badges" do
post ":id/badges", urgency: :default do
source = find_source_if_admin(source_type)
badge = ::Badges::CreateService.new(declared_params(include_missing: false)).execute(source)

View File

@ -28,7 +28,7 @@ module API
optional :tasks_to_be_done, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Tasks the inviter wants the member to do'
optional :tasks_project_id, type: Integer, desc: 'The project ID in which to create the task issues'
end
post ":id/invitations" do
post ":id/invitations", urgency: :low do
::Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/354016')
bad_request!('Must provide either email or user_id as a parameter') if params[:email].blank? && params[:user_id].blank?

View File

@ -342,7 +342,7 @@ module API
desc: 'Include project license data'
end
# TODO: Set higher urgency https://gitlab.com/gitlab-org/gitlab/-/issues/357622
get ":id", feature_category: :projects, urgency: :default do
get ":id", feature_category: :projects, urgency: :low do
options = {
with: current_user ? Entities::ProjectWithAccess : Entities::BasicProjectDetails,
current_user: current_user,

View File

@ -10,6 +10,8 @@ module API
feature_category :users, ['/users/:id/custom_attributes', '/users/:id/custom_attributes/:key']
urgency :high, ['/users/:id/custom_attributes', '/users/:id/custom_attributes/:key']
resource :users, requirements: { uid: /[0-9]*/, id: /[0-9]*/ } do
include CustomAttributesEndpoints
@ -781,7 +783,7 @@ module API
optional :type, type: String, values: %w[Project Namespace]
use :pagination
end
get ":user_id/memberships", feature_category: :users do
get ":user_id/memberships", feature_category: :users, urgency: :high do
authenticated_as_admin!
user = find_user_by_id(params)

View File

@ -231,11 +231,15 @@ module Gitlab
def encode_diff_to_utf8(replace_invalid_utf8_chars)
return unless Feature.enabled?(:convert_diff_to_utf8_with_replacement_symbol, default_enabled: :yaml)
return unless replace_invalid_utf8_chars && !detect_binary?(@diff)
return unless replace_invalid_utf8_chars && diff_should_be_converted?
@diff = Gitlab::EncodingHelper.encode_utf8_with_replacement_character(@diff)
end
def diff_should_be_converted?
!detect_binary?(@diff) || !@diff&.valid_encoding?
end
def init_from_hash(hash)
raw_diff = hash.symbolize_keys

View File

@ -359,11 +359,11 @@ EOF
function verify_deploy() {
echoinfo "Verifying deployment at ${CI_ENVIRONMENT_URL}"
if retry "test_url \"${CI_ENVIRONMENT_URL}\" curl_output.txt"; then
if retry "test_url \"${CI_ENVIRONMENT_URL}\""; then
echoinfo "Review app is deployed to ${CI_ENVIRONMENT_URL}"
return 0
else
echoerr "Review app is not available at ${CI_ENVIRONMENT_URL}. See curl_output.txt artifact for detail."
echoerr "Review app is not available at ${CI_ENVIRONMENT_URL}: see the logs from cURL above for more details"
return 1
fi
}

View File

@ -15,16 +15,18 @@ function retry() {
function test_url() {
local url="${1}"
local curl_output="${2}"
local status
status=$(curl -s -o "${curl_output}" -L -w ''%{http_code}'' "${url}")
status=$(curl --output /dev/null -L -s -w ''%{http_code}'' "${url}")
if [[ $status == "200" ]]; then
return 0
else
# We display the error in the job to allow for better debugging
curl -L --fail --output /dev/null "${url}"
echo -e "\nExpected HTTP status 200: received ${status}\n"
return 1
fi
return 1
}
function bundle_install_script() {

View File

@ -165,17 +165,21 @@ EOT
context 'when diff contains invalid characters' do
let(:bad_string) { [0xae].pack("C*") }
let(:bad_string_two) { [0x89].pack("C*") }
let(:bad_string_three) { "@@ -1,5 +1,6 @@\n \xFF\xFE#\x00l\x00a\x00n\x00g\x00u\x00" }
let(:diff) { described_class.new(@raw_diff_hash.merge({ diff: bad_string })) }
let(:diff_two) { described_class.new(@raw_diff_hash.merge({ diff: bad_string_two })) }
let(:diff_three) { described_class.new(@raw_diff_hash.merge({ diff: bad_string_three })) }
context 'when replace_invalid_utf8_chars is true' do
it 'will convert invalid characters and not cause an encoding error' do
expect(diff.diff).to include(Gitlab::EncodingHelper::UNICODE_REPLACEMENT_CHARACTER)
expect(diff_two.diff).to include(Gitlab::EncodingHelper::UNICODE_REPLACEMENT_CHARACTER)
expect(diff_three.diff).to include(Gitlab::EncodingHelper::UNICODE_REPLACEMENT_CHARACTER)
expect { Oj.dump(diff) }.not_to raise_error(EncodingError)
expect { Oj.dump(diff_two) }.not_to raise_error(EncodingError)
expect { Oj.dump(diff_three) }.not_to raise_error(EncodingError)
end
context 'when the diff is binary' do

View File

@ -543,7 +543,7 @@ RSpec.describe API::Members do
end
it 'returns 409 if member does not exist' do
put api("/#{source_type.pluralize}/#{source.id}/members/123", maintainer),
put api("/#{source_type.pluralize}/#{source.id}/members/#{non_existing_record_id}", maintainer),
params: { access_level: Member::MAINTAINER }
expect(response).to have_gitlab_http_status(:not_found)
@ -618,7 +618,7 @@ RSpec.describe API::Members do
end
it 'returns 404 if member does not exist' do
delete api("/#{source_type.pluralize}/#{source.id}/members/123", maintainer)
delete api("/#{source_type.pluralize}/#{source.id}/members/#{non_existing_record_id}", maintainer)
expect(response).to have_gitlab_http_status(:not_found)
end