Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-02-18 00:09:31 +00:00
parent 3e308768fd
commit e70cf9a659
25 changed files with 149 additions and 129 deletions

View File

@ -101,6 +101,7 @@
/doc/api/repository_files.md @aqualls
/doc/api/repository_submodules.md @aqualls
/doc/api/search.md @aqualls
/doc/api/services.md @aqualls
/doc/api/snippets.md @aqualls
/doc/api/suggestions.md @aqualls
/doc/api/tags.md @aqualls
@ -110,6 +111,7 @@
/doc/topics/gitlab_flow.md @aqualls
/doc/user/admin_area/settings/account_and_limit_settings.md @aqualls
/doc/user/admin_area/settings/instance_template_repository.md @aqualls
/doc/user/admin_area/settings/project_integration_management.md @aqualls
/doc/user/admin_area/settings/push_event_activities_limit.md @aqualls
/doc/user/admin_area/settings/visibility_and_access_controls.md @aqualls
/doc/user/asciidoc.md @aqualls

View File

@ -2,7 +2,7 @@
import { GlAlert, GlLoadingIcon } from '@gitlab/ui';
import getPipelineDetails from 'shared_queries/pipelines/get_pipeline_details.query.graphql';
import { __ } from '~/locale';
import { DEFAULT, LOAD_FAILURE } from '../../constants';
import { DEFAULT, DRAW_FAILURE, LOAD_FAILURE } from '../../constants';
import PipelineGraph from './graph_component.vue';
import { unwrapPipelineData, toggleQueryPollingByVisibility, reportToSentry } from './utils';
@ -29,6 +29,7 @@ export default {
};
},
errorTexts: {
[DRAW_FAILURE]: __('An error ocurred while drawing job relationship links.'),
[LOAD_FAILURE]: __('We are currently unable to fetch data for this pipeline.'),
[DEFAULT]: __('An unknown error occurred while loading this graph.'),
},
@ -53,6 +54,11 @@ export default {
computed: {
alert() {
switch (this.alertType) {
case DRAW_FAILURE:
return {
text: this.$options.errorTexts[DRAW_FAILURE],
variant: 'danger',
};
case LOAD_FAILURE:
return {
text: this.$options.errorTexts[LOAD_FAILURE],
@ -88,8 +94,8 @@ export default {
},
reportFailure(type) {
this.showAlert = true;
this.failureType = type;
reportToSentry(this.$options.name, this.failureType);
this.alertType = type;
reportToSentry(this.$options.name, this.alertType);
},
},
};

View File

@ -2,6 +2,7 @@
import { isEmpty } from 'lodash';
import { DRAW_FAILURE } from '../../constants';
import { createJobsHash, generateJobNeedsDict } from '../../utils';
import { reportToSentry } from '../graph/utils';
import { parseData } from '../parsing_utils';
import { generateLinksData } from './drawing_utils';
@ -87,6 +88,9 @@ export default {
this.$emit('highlightedJobsChange', jobs);
},
},
errorCaptured(err, _vm, info) {
reportToSentry(this.$options.name, `error: ${err}, info: ${info}`);
},
mounted() {
if (!isEmpty(this.pipelineData)) {
this.prepareLinkData();
@ -101,8 +105,9 @@ export default {
const arrayOfJobs = this.pipelineData.flatMap(({ groups }) => groups);
const parsedData = parseData(arrayOfJobs);
this.links = generateLinksData(parsedData, this.containerId, `-${this.pipelineId}`);
} catch {
} catch (err) {
this.$emit('error', DRAW_FAILURE);
reportToSentry(this.$options.name, err);
}
},
getLinkClasses(link) {

View File

@ -1,6 +1,7 @@
<script>
import { GlAlert } from '@gitlab/ui';
import { __ } from '~/locale';
import { reportToSentry } from '../graph/utils';
import LinksInner from './links_inner.vue';
export default {
@ -50,6 +51,9 @@ export default {
);
},
},
errorCaptured(err, _vm, info) {
reportToSentry(this.$options.name, `error: ${err}, info: ${info}`);
},
methods: {
dismissAlert() {
this.alertDismissed = true;

View File

@ -1,6 +1,7 @@
.atwho-view {
overflow-y: auto;
overflow-x: hidden;
max-width: calc(100% - 6px);
.name,
small.aliases,
@ -80,10 +81,6 @@
}
@include media-breakpoint-down(xs) {
.atwho-view-ul {
width: 350px;
}
.atwho-view ul li {
overflow: hidden;
text-overflow: ellipsis;

View File

@ -564,7 +564,10 @@ module Ci
end
def features
{ trace_sections: true }
{
trace_sections: true,
failure_reasons: self.class.failure_reasons.keys
}
end
def merge_request

View File

@ -11,7 +11,7 @@ module Packages
end
def root
path = api_v4_group___packages_composer_package_name_path({ id: @group.id, package_name: '%package%$%hash%', format: '.json' }, true)
path = expose_path(api_v4_group___packages_composer_package_name_path({ id: @group.id, package_name: '%package%$%hash%', format: '.json' }, true))
{ 'packages' => [], 'provider-includes' => { 'p/%hash%.json' => { 'sha256' => provider_sha } }, 'providers-url' => path }
end

View File

@ -0,0 +1,5 @@
---
title: Expose `failure_reasons` in `Build#features`
merge_request: 53964
author:
type: added

View File

@ -0,0 +1,5 @@
---
title: Fix overflowing width - at mention container
merge_request: 54377
author:
type: fixed

View File

@ -0,0 +1,5 @@
---
title: Fix relative URL with composer package
merge_request: 53918
author:
type: fixed

View File

@ -0,0 +1,5 @@
---
title: Add environment to custom CI_JOB_JWT claims
merge_request: 54168
author:
type: added

View File

@ -1,8 +0,0 @@
---
name: ci_jwt_include_environment
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/53431
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/321206
milestone: '13.9'
type: development
group: group::configure
default_enabled: false

View File

@ -42,7 +42,7 @@ The following resources will help you get started with Git:
- [Git stash](../../university/training/topics/stash.md)
- [Git file blame](../../user/project/repository/git_blame.md)
- [Git file history](../../user/project/repository/git_history.md)
- [Git tags](../../university/training/user_training.md#tags)
- [Git tags](tags.md)
### Concepts

41
doc/topics/git/tags.md Normal file
View File

@ -0,0 +1,41 @@
---
stage: Create
group: Source Code
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Tags
Tags are useful for marking certain deployments and releases for later
reference. Git supports two types of tags:
- Annotated tags: An unchangeable part of Git history.
- Lightweight (soft) tags: Tags that can be set and removed as needed.
Many projects combine an annotated release tag with a stable branch. Consider
setting deployment or release tags automatically.
## Tags sample workflow
1. Create a lightweight tag.
1. Create an annotated tag.
1. Push the tags to the remote repository.
```shell
git checkout master
# Lightweight tag
git tag my_lightweight_tag
# Annotated tag
git tag -a v1.0 -m Version 1.0
# Show list of the existing tags
git tag
git push origin --tags
```
## Additional resources
- [Tagging](https://git-scm.com/book/en/v2/Git-Basics-Tagging) Git reference page

View File

@ -34,7 +34,6 @@ This section contains the following topics:
- [Merge conflicts](topics/merge_conflicts.md).
- [Rollback commits](topics/rollback_commits.md).
- [Subtree](topics/subtree.md).
- [Tags](topics/tags.md).
- [Unstage](topics/unstage.md).
## Additional Resources

View File

@ -1,52 +1,8 @@
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
comments: false
type: reference
redirect_to: '../../../topics/git/tags.md'
---
# Tags
This document was moved to [another location](../../../topics/git/tags.md).
- Useful for marking deployments and releases
- Annotated tags are an unchangeable part of Git history
- Soft/lightweight tags can be set and removed at will
- Many projects combine an annotated release tag with a stable branch
- Consider setting deployment/release tags automatically
## Tags sample workflow
- Create a lightweight tag
- Create an annotated tag
- Push the tags to the remote repository
```shell
git checkout master
# Lightweight tag
git tag my_lightweight_tag
# Annotated tag
git tag -a v1.0 -m Version 1.0
# Show list of the existing tags
git tag
git push origin --tags
```
**Additional resources**
<https://git-scm.com/book/en/Git-Basics-Tagging>
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
one might have when setting this up, or when something is changed, or on upgrading, it's
important to describe those, too. Think of things that may go wrong and include them here.
This is important to minimize requests for support, and to avoid doc comments with
questions that you know someone might ask.
Each scenario can be a third-level heading, e.g. `### Getting error message X`.
If you have none to add when creating a doc, leave this section in place
but commented out to help encourage others to add to it in the future. -->
<!-- This redirect file can be deleted after <YYYY-MM-DD>. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->

View File

@ -132,7 +132,7 @@ To request it, open the **Reviewers** drop-down box to search for the user you w
#### Approval Rule information for Reviewers **(PREMIUM)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/233736) in GitLab 13.8. For this version only, GitLab administrators can opt to [enable it](#enable-or-disable-approval-rule-information).
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/233736) in GitLab 13.8.
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/293742) in GitLab 13.9.
When editing the **Reviewers** field in a new or existing merge request, GitLab
@ -231,33 +231,6 @@ forks are not retargeted.
reviews are faster and your changes are less prone to errors.
- Do not use capital letters nor special chars in branch names.
## Enable or disable Approval Rule information **(PREMIUM SELF)**
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/293742) in GitLab 13.9.
Merge Request Reviewers is under development and ready for production use.
It is deployed behind a feature flag that is **enabled by default**.
[GitLab administrators with access to the GitLab Rails console](../../../administration/feature_flags.md)
can opt to disable it.
To enable it:
```ruby
# For the instance
Feature.enable(:reviewer_approval_rules)
# For a single project
Feature.enable(:reviewer_approval_rules, Project.find(<project id>))
```
To disable it:
```ruby
# For the instance
Feature.disable(:reviewer_approval_rules)
# For a single project
Feature.disable(:reviewer_approval_rules, Project.find(<project id>))
```
### Enable or disable branch retargeting on merge **(FREE SELF)**
Automatically retargeting merge requests is under development but ready for production use.

View File

@ -16,6 +16,7 @@
class CsvBuilder
DEFAULT_ORDER_BY = 'id'.freeze
DEFAULT_BATCH_SIZE = 1000
PREFIX_REGEX = /^[=\+\-@;]/.freeze
attr_reader :rows_written
@ -114,8 +115,8 @@ class CsvBuilder
def excel_sanitize(line)
return if line.nil?
return line unless line.is_a?(String) && line.match?(PREFIX_REGEX)
line = ["'", line].join if line =~ /^[=\+\-@;]/
line
["'", line].join
end
end

View File

@ -60,7 +60,7 @@ module Gitlab
ref_protected: build.protected.to_s
}
if include_environment_claims?
if environment.present?
fields.merge!(
environment: environment.name,
environment_protected: environment_protected?.to_s
@ -119,10 +119,6 @@ module Gitlab
def environment_protected?
false # Overridden in EE
end
def include_environment_claims?
Feature.enabled?(:ci_jwt_include_environment) && environment.present?
end
end
end
end

View File

@ -9,6 +9,7 @@ module Gitlab
IGNORABLE_SQL = %w{BEGIN COMMIT}.freeze
DB_COUNTERS = %i{db_count db_write_count db_cached_count}.freeze
SQL_COMMANDS_WITH_COMMENTS_REGEX = /\A(\/\*.*\*\/\s)?((?!(.*[^\w'"](DELETE|UPDATE|INSERT INTO)[^\w'"])))(WITH.*)?(SELECT)((?!(FOR UPDATE|FOR SHARE)).)*$/i.freeze
def sql(event)
# Mark this thread as requiring a database connection. This is used
@ -37,7 +38,7 @@ module Gitlab
private
def select_sql_command?(payload)
payload[:sql].match(/\A((?!(.*[^\w'"](DELETE|UPDATE|INSERT INTO)[^\w'"])))(WITH.*)?(SELECT)((?!(FOR UPDATE|FOR SHARE)).)*$/i)
payload[:sql].match(SQL_COMMANDS_WITH_COMMENTS_REGEX)
end
def increment_db_counters(payload)

View File

@ -3517,6 +3517,9 @@ msgstr ""
msgid "An error occurred. Please try again."
msgstr ""
msgid "An error ocurred while drawing job relationship links."
msgstr ""
msgid "An error ocurred while loading your content. Please try again."
msgstr ""

View File

@ -114,17 +114,6 @@ RSpec.describe Gitlab::Ci::Jwt do
expect(payload[:environment]).to eq('production')
expect(payload[:environment_protected]).to eq('false')
end
context ':ci_jwt_include_environment feature flag is disabled' do
before do
stub_feature_flags(ci_jwt_include_environment: false)
end
it 'does not include environment attributes' do
expect(payload).not_to have_key(:environment)
expect(payload).not_to have_key(:environment_protected)
end
end
end
end

View File

@ -17,6 +17,15 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
)
end
# Emulate Marginalia pre-pending comments
def sql(query, comments: true)
if comments
"/*application:web,controller:badges,action:pipeline,correlation_id:01EYN39K9VMJC56Z7808N7RSRH*/ #{query}"
else
query
end
end
describe '#sql' do
shared_examples 'track query in metrics' do
before do
@ -101,7 +110,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
expect { subscriber.sql(event) }.to change { Thread.current[:uses_db_connection] }.from(nil).to(true)
end
context 'with read query' do
shared_examples 'read queries' do
let(:expected_counters) do
{
db_count: 1,
@ -114,14 +123,14 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
it_behaves_like 'track query in RequestStore'
context 'with only select' do
let(:payload) { { sql: 'WITH active_milestones AS (SELECT COUNT(*), state FROM milestones GROUP BY state) SELECT * FROM active_milestones' } }
let(:payload) { { sql: sql('WITH active_milestones AS (SELECT COUNT(*), state FROM milestones GROUP BY state) SELECT * FROM active_milestones', comments: comments) } }
it_behaves_like 'track query in metrics'
it_behaves_like 'track query in RequestStore'
end
end
context 'write query' do
shared_examples 'write queries' do
let(:expected_counters) do
{
db_count: 1,
@ -131,7 +140,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
end
context 'with select for update sql event' do
let(:payload) { { sql: 'SELECT * FROM users WHERE id = 10 FOR UPDATE' } }
let(:payload) { { sql: sql('SELECT * FROM users WHERE id = 10 FOR UPDATE', comments: comments) } }
it_behaves_like 'track query in metrics'
it_behaves_like 'track query in RequestStore'
@ -139,7 +148,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
context 'with common table expression' do
context 'with insert' do
let(:payload) { { sql: 'WITH archived_rows AS (SELECT * FROM users WHERE archived = true) INSERT INTO products_log SELECT * FROM archived_rows' } }
let(:payload) { { sql: sql('WITH archived_rows AS (SELECT * FROM users WHERE archived = true) INSERT INTO products_log SELECT * FROM archived_rows', comments: comments) } }
it_behaves_like 'track query in metrics'
it_behaves_like 'track query in RequestStore'
@ -147,27 +156,41 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
end
context 'with delete sql event' do
let(:payload) { { sql: 'DELETE FROM users where id = 10' } }
let(:payload) { { sql: sql('DELETE FROM users where id = 10', comments: comments) } }
it_behaves_like 'track query in metrics'
it_behaves_like 'track query in RequestStore'
end
context 'with insert sql event' do
let(:payload) { { sql: 'INSERT INTO project_ci_cd_settings (project_id) SELECT id FROM projects' } }
let(:payload) { { sql: sql('INSERT INTO project_ci_cd_settings (project_id) SELECT id FROM projects', comments: comments) } }
it_behaves_like 'track query in metrics'
it_behaves_like 'track query in RequestStore'
end
context 'with update sql event' do
let(:payload) { { sql: 'UPDATE users SET admin = true WHERE id = 10' } }
let(:payload) { { sql: sql('UPDATE users SET admin = true WHERE id = 10', comments: comments) } }
it_behaves_like 'track query in metrics'
it_behaves_like 'track query in RequestStore'
end
end
context 'without Marginalia comments' do
let(:comments) { false }
it_behaves_like 'write queries'
it_behaves_like 'read queries'
end
context 'with Marginalia comments' do
let(:comments) { true }
it_behaves_like 'write queries'
it_behaves_like 'read queries'
end
context 'with cached query' do
let(:expected_counters) do
{
@ -180,7 +203,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
context 'with cached payload ' do
let(:payload) do
{
sql: 'SELECT * FROM users WHERE id = 10',
sql: sql('SELECT * FROM users WHERE id = 10'),
cached: true
}
end
@ -192,7 +215,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
context 'with cached payload name' do
let(:payload) do
{
sql: 'SELECT * FROM users WHERE id = 10',
sql: sql('SELECT * FROM users WHERE id = 10'),
name: 'CACHE'
}
end
@ -208,7 +231,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
:event,
name: 'sql.active_record',
payload: {
sql: "SELECT attr.attname FROM pg_attribute attr INNER JOIN pg_constraint cons ON attr.attrelid = cons.conrelid AND attr.attnum = any(cons.conkey) WHERE cons.contype = 'p' AND cons.conrelid = '\"projects\"'::regclass",
sql: sql("SELECT attr.attname FROM pg_attribute attr INNER JOIN pg_constraint cons ON attr.attrelid = cons.conrelid AND attr.attnum = any(cons.conkey) WHERE cons.contype = 'p' AND cons.conrelid = '\"projects\"'::regclass"),
name: 'SCHEMA',
connection_id: 135,
statement_name: nil,

View File

@ -67,10 +67,14 @@ RSpec.describe ::Packages::Composer::PackagesPresenter do
{
'packages' => [],
'provider-includes' => { 'p/%hash%.json' => { 'sha256' => /^\h+$/ } },
'providers-url' => "/api/v4/group/#{group.id}/-/packages/composer/%package%$%hash%.json"
'providers-url' => "prefix/api/v4/group/#{group.id}/-/packages/composer/%package%$%hash%.json"
}
end
before do
stub_config(gitlab: { relative_url_root: 'prefix' })
end
it 'returns the provider json' do
expect(subject).to match(expected_json)
end

View File

@ -198,7 +198,12 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
'when' => 'on_success' }]
end
let(:expected_features) { { 'trace_sections' => true } }
let(:expected_features) do
{
'trace_sections' => true,
'failure_reasons' => include('script_failure')
}
end
it 'picks a job' do
request_job info: { platform: :darwin }
@ -220,7 +225,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
expect(json_response['artifacts']).to eq(expected_artifacts)
expect(json_response['cache']).to eq(expected_cache)
expect(json_response['variables']).to include(*expected_variables)
expect(json_response['features']).to eq(expected_features)
expect(json_response['features']).to match(expected_features)
end
it 'creates persistent ref' do