Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-01-06 18:10:52 +00:00
parent 04a42f5e03
commit 653048c5ee
28 changed files with 100 additions and 79 deletions

View file

@ -6,7 +6,6 @@ import JobPill from './job_pill.vue';
import StagePill from './stage_pill.vue';
import { generateLinksData } from './drawing_utils';
import { parseData } from '../parsing_utils';
import { unwrapArrayOfJobs } from '../unwrapping_utils';
import { DRAW_FAILURE, DEFAULT, INVALID_CI_CONFIG, EMPTY_PIPELINE_DATA } from '../../constants';
import { createJobsHash, generateJobNeedsDict } from '../../utils';
import { CI_CONFIG_STATUS_INVALID } from '~/pipeline_editor/constants';
@ -136,7 +135,7 @@ export default {
methods: {
prepareLinkData() {
try {
const arrayOfJobs = unwrapArrayOfJobs(this.pipelineStages);
const arrayOfJobs = this.pipelineStages.flatMap(({ groups }) => groups);
const parsedData = parseData(arrayOfJobs);
this.links = generateLinksData(parsedData, this.$options.CONTAINER_ID);
} catch {

View file

@ -1,20 +1,3 @@
/**
* This function takes the stages and add the stage name
* at the group level as `category` to have an easier
* implementation while constructions nodes with D3
* @param {Array} stages
* @returns {Array} - Array of stages with stage name at the group level as `category`
*/
export const unwrapArrayOfJobs = (stages = []) => {
return stages
.map(({ name, groups }) => {
return groups.map((group) => {
return { category: name, ...group };
});
})
.flat(2);
};
const unwrapGroups = (stages) => {
return stages.map((stage) => {
const {

View file

@ -10,7 +10,8 @@ module IssueAvailableFeatures
# EE only features are listed on EE::IssueAvailableFeatures
def available_features_for_issue_types
{
assignee: %w(issue incident)
assignee: %w(issue incident),
confidentiality: %(issue incident)
}.with_indifferent_access
end
end

View file

@ -10,6 +10,8 @@
.sidebar-context-title
= @group.name
%ul.sidebar-top-level-items.qa-group-sidebar
= render_if_exists 'layouts/nav/sidebar/group_trial_status_widget', group: @group
- if group_sidebar_link?(:overview)
- paths = group_overview_nav_link_paths
= nav_link(path: paths, unless: -> { current_path?('groups/contribution_analytics#show') }, html_options: { class: 'home' }) do

View file

@ -0,0 +1,5 @@
---
title: Drop temporary index on ci_builds
merge_request: 50961
author:
type: other

View file

@ -0,0 +1,19 @@
# frozen_string_literal: true
class DropTemporaryIndexOnCiBuilds < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
INDEX = 'tmp_build_stage_position_index'.freeze
def up
remove_concurrent_index_by_name :ci_builds, INDEX
end
def down
add_concurrent_index :ci_builds, [:stage_id, :stage_idx], where: 'stage_idx IS NOT NULL', name: INDEX
end
end

View file

@ -0,0 +1 @@
d15dc3e57f050f037dd6b6b2b1efdafee49bf411580e35a7b4dbe14868c41e13

View file

@ -23105,8 +23105,6 @@ CREATE INDEX temporary_index_vulnerabilities_on_id ON vulnerabilities USING btre
CREATE UNIQUE INDEX term_agreements_unique_index ON term_agreements USING btree (user_id, term_id);
CREATE INDEX tmp_build_stage_position_index ON ci_builds USING btree (stage_id, stage_idx) WHERE (stage_idx IS NOT NULL);
CREATE INDEX tmp_index_for_email_unconfirmation_migration ON emails USING btree (id) WHERE (confirmed_at IS NOT NULL);
CREATE INDEX tmp_index_on_vulnerabilities_non_dismissed ON vulnerabilities USING btree (id) WHERE (state <> 2);

View file

@ -121,9 +121,9 @@ DRIs:
| Role | Who
|------------------------------|------------------------|
| Product | Jackie Porter |
| Product | Orit Golowinski |
| Leadership | Daniel Croft |
| Engineering | Kamil Trzciński |
| Engineering | Vladimir Shushlin |
Domain Experts:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

View file

@ -842,6 +842,41 @@ Example:
expect(response).to have_gitlab_http_status(:ok)
```
#### `match_schema` and `match_response_schema`
The `match_schema` matcher allows validating that the subject matches a
[JSON schema](https://json-schema.org/). The item inside `expect` can be
a JSON string or a JSON-compatible data structure.
`match_response_schema` is a convenience matcher for using with a
response object. from a [request
spec](testing_levels.md#integration-tests).
Examples:
```ruby
# Matches against spec/fixtures/api/schemas/prometheus/additional_metrics_query_result.json
expect(data).to match_schema('prometheus/additional_metrics_query_result')
# Matches against ee/spec/fixtures/api/schemas/board.json
expect(data).to match_schema('board', dir: 'ee')
# Matches against a schema made up of Ruby data structures
expect(data).to match_schema(Atlassian::Schemata.build_info)
```
#### `be_valid_json`
`be_valid_json` allows validating that a string parses as JSON and gives
a non-empty result. To combine it with the schema matching above, use
`and`:
```ruby
expect(json_string).to be_valid_json
expect(json_string).to be_valid_json.and match_schema(schema)
```
### Testing query performance
Testing query performance allows us to:

View file

@ -53,10 +53,10 @@ Otherwise, you can:
![Upload license](img/license_upload_v13_8.png)
- *If you've received your license as plain text:*
1. Select **Enter license key**.
1. Copy the license and paste it into the **License key** field.
1. Check the **Subscription Agreement** checkbox.
1. Select **Upload License**.
1. Select **Enter license key**.
1. Copy the license and paste it into the **License key** field.
1. Check the **Subscription Agreement** checkbox.
1. Select **Upload License**.
## Add your license at install time

View file

@ -72,10 +72,10 @@ To manually configure a GitLab Terraform Report artifact requires the following
terraform: $PLAN_JSON
```
For a full example using the pre-built image, see [Example `.gitlab-ci.yaml`
file](#example-gitlab-ciyaml-file).
For a full example using the pre-built image, see [Example `.gitlab-ci.yml`
file](#example-gitlab-ciyml-file).
For an example displaying multiple reports, see [`.gitlab-ci.yaml` multiple reports file](#multiple-terraform-plan-reports).
For an example displaying multiple reports, see [`.gitlab-ci.yml` multiple reports file](#multiple-terraform-plan-reports).
1. Running the pipeline displays the widget in the merge request, like this:
@ -86,7 +86,7 @@ To manually configure a GitLab Terraform Report artifact requires the following
![Terraform plan logs](img/terraform_plan_log_v13_0.png)
### Example `.gitlab-ci.yaml` file
### Example `.gitlab-ci.yml` file
```yaml
default:

View file

@ -200,7 +200,7 @@ If the job that's executing is within a freeze period, GitLab CI/CD creates an e
variable named `$CI_DEPLOY_FREEZE`.
To prevent the deployment job from executing, create a `rules` entry in your
`gitlab-ci.yaml`, for example:
`gitlab-ci.yml`, for example:
```yaml
deploy_to_production:

View file

@ -100,6 +100,9 @@ module Gitlab
invite_members_new_dropdown: {
tracking_category: 'Growth::Expansion::Experiment::InviteMembersNewDropdown'
},
show_trial_status_in_sidebar: {
tracking_category: 'Growth::Conversion::Experiment::ShowTrialStatusInSidebar'
},
trial_onboarding_issues: {
tracking_category: 'Growth::Conversion::Experiment::TrialOnboardingIssues'
}

View file

@ -170,7 +170,8 @@ module Gitlab
end
types Issue
condition do
!quick_action_target.confidential? &&
quick_action_target.issue_type_supports?(:confidentiality) &&
!quick_action_target.confidential? &&
current_user.can?(:"admin_#{quick_action_target.to_ability_name}", quick_action_target)
end
command :confidential do

View file

@ -29638,6 +29638,11 @@ msgstr ""
msgid "Trending"
msgstr ""
msgid "Trials|%{plan} Trial %{en_dash} %{num} day left"
msgid_plural "Trials|%{plan} Trial %{en_dash} %{num} days left"
msgstr[0] ""
msgstr[1] ""
msgid "Trials|Create a new group to start your GitLab Gold trial."
msgstr ""

View file

@ -1,5 +1,4 @@
import {
unwrapArrayOfJobs,
unwrapGroups,
unwrapNodesWithName,
unwrapStagesWithNeeds,
@ -95,29 +94,6 @@ const completeMock = [
];
describe('Shared pipeline unwrapping utils', () => {
describe('unwrapArrayOfJobs', () => {
it('returns an empty array if the input is an empty undefined', () => {
expect(unwrapArrayOfJobs(undefined)).toEqual([]);
});
it('returns an empty array if the input is an empty array', () => {
expect(unwrapArrayOfJobs([])).toEqual([]);
});
it('returns a flatten array of each job with their data and stage name', () => {
expect(
unwrapArrayOfJobs([
{ name: 'build', groups: [{ name: 'job_a_1' }, { name: 'job_a_2' }] },
{ name: 'test', groups: [{ name: 'job_b' }] },
]),
).toMatchObject([
{ category: 'build', name: 'job_a_1' },
{ category: 'build', name: 'job_a_2' },
{ category: 'test', name: 'job_b' },
]);
});
});
describe('unwrapGroups', () => {
it('takes stages without nodes and returns the unwrapped groups', () => {
expect(unwrapGroups(stagesAndGroups)[0].groups).toEqual(groupsArray);

View file

@ -114,7 +114,7 @@ RSpec.describe Atlassian::JiraConnect::Client do
end
let(:body) do
matcher = be_valid_json.according_to_schema(schema)
matcher = be_valid_json.and match_schema(schema)
->(text) { matcher.matches?(text) }
end
@ -164,7 +164,7 @@ RSpec.describe Atlassian::JiraConnect::Client do
end
let(:body) do
matcher = be_valid_json.according_to_schema(build_info_payload_schema)
matcher = be_valid_json.and match_schema(build_info_payload_schema)
->(text) { matcher.matches?(text) }
end

View file

@ -23,7 +23,7 @@ RSpec.describe Atlassian::JiraConnect::Serializers::BuildEntity do
end
it 'is invalid, since it has no issue keys' do
expect(subject.to_json).not_to be_valid_json.according_to_schema(Atlassian::Schemata.build_info)
expect(subject.to_json).not_to match_schema(Atlassian::Schemata.build_info)
end
end
end
@ -43,7 +43,7 @@ RSpec.describe Atlassian::JiraConnect::Serializers::BuildEntity do
describe '#to_json' do
it 'is valid according to the build info schema' do
expect(subject.to_json).to be_valid_json.according_to_schema(Atlassian::Schemata.build_info)
expect(subject.to_json).to be_valid_json.and match_schema(Atlassian::Schemata.build_info)
end
end
end

View file

@ -23,7 +23,7 @@ RSpec.describe Atlassian::JiraConnect::Serializers::DeploymentEntity do
end
it 'is invalid, since it has no issue keys' do
expect(subject.to_json).not_to be_valid_json.according_to_schema(Atlassian::Schemata.deployment_info)
expect(subject.to_json).not_to match_schema(Atlassian::Schemata.deployment_info)
end
end
end
@ -86,7 +86,7 @@ RSpec.describe Atlassian::JiraConnect::Serializers::DeploymentEntity do
describe '#to_json' do
it 'is valid according to the deployment info schema' do
expect(subject.to_json).to be_valid_json.according_to_schema(Atlassian::Schemata.deployment_info)
expect(subject.to_json).to be_valid_json.and match_schema(Atlassian::Schemata.deployment_info)
end
end
end

View file

@ -1142,6 +1142,11 @@ RSpec.describe QuickActions::InterpretService do
let(:issuable) { issue }
end
it_behaves_like 'confidential command' do
let(:content) { '/confidential' }
let(:issuable) { create(:incident, project: project) }
end
it_behaves_like 'lock command' do
let(:content) { '/lock' }
let(:issuable) { issue }

View file

@ -1,20 +1,8 @@
# frozen_string_literal: true
RSpec::Matchers.define :be_valid_json do
def according_to_schema(schema)
@schema = schema
self
end
match do |actual|
data = Gitlab::Json.parse(actual)
if @schema.present?
@validation_errors = JSON::Validator.fully_validate(@schema, data)
@validation_errors.empty?
else
data.present?
end
Gitlab::Json.parse(actual).present?
rescue JSON::ParserError => e
@error = e
false
@ -23,8 +11,6 @@ RSpec::Matchers.define :be_valid_json do
def failure_message
if @error
"Parse failed with error: #{@error}"
elsif @validation_errors.present?
"Validation failed because #{@validation_errors.join(', and ')}"
else
"Parsing did not return any data"
end

View file

@ -2,6 +2,8 @@
module SchemaPath
def self.expand(schema, dir = nil)
return schema unless schema.is_a?(String)
if Gitlab.ee? && dir.nil?
ee_path = expand(schema, 'ee')