Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-04-27 09:09:46 +00:00
parent f3197dab7f
commit 018e39a950
28 changed files with 251 additions and 83 deletions

View File

@ -1,40 +1,17 @@
# include:
# - template: Jobs/Code-Quality.gitlab-ci.yml
include:
- template: Jobs/Code-Quality.gitlab-ci.yml
# - template: Security/SAST.gitlab-ci.yml
# - template: Security/Dependency-Scanning.gitlab-ci.yml
# - template: Security/DAST.gitlab-ci.yml
# We need to duplicate this job's definition because the rules
# defined in the extended jobs rely on local YAML anchors
# (`*if-default-refs`)
code_quality:
extends:
- .default-retry
- .reports:rules:code_quality
- .use-docker-in-docker
stage: test
needs: []
variables:
CODE_QUALITY_IMAGE: "registry.gitlab.com/gitlab-org/ci-cd/codequality:0.85.23"
script:
- |
if ! docker info &>/dev/null; then
if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
export DOCKER_HOST='tcp://localhost:2375'
fi
fi
- docker pull --quiet "$CODE_QUALITY_IMAGE"
- docker run
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"$CODE_QUALITY_IMAGE" /code
artifacts:
reports:
codequality: gl-code-quality-report.json
paths:
- gl-code-quality-report.json # GitLab-specific
expire_in: 1 week # GitLab-specific
rules: !reference [".reports:rules:code_quality", rules]
# We need to duplicate this job's definition because the rules
# defined in the extended jobs rely on local YAML anchors

View File

@ -0,0 +1,48 @@
## Experiment summary
We believe that... {describe your hypothesis in one sentence}
To verify that, we will... {describe your test in one sentence}
And well measure the impact on... {metrics}
## Hypothesis
<!-- The hypothesis represents the high-level thought process in creating the experiment but does not need to be proven in one experiment. For example, you could have a hypothesis that “users would benefit from more easily being able to start a trial” and your first experiment could fail, that doesnt void your hypothesis only indicates you may need to think of a new iterative experiment that would still align with your hypothesis. -->
## Business problem
<!-- Where the hypothesis is focused on the user/customer, the business problem represents why/how an experiment in this area could positively impact the business. For example, trials represent a significant way for GitLab to produce valuable leads for the sales team. -->
## Supporting data
<!-- Why should we run this experiment? Whats the potential impact? Show supporting data thats both qualitative and quantitative. Quantitative example, we generate 30,000 sign ups a month and 900 trails within 90 days (3%) with a close rate of 10% and an IACV of $400. If were able to increase our trial volume by 10% percent (990 trials a month) we will generate an additional $3,600 IACV if our close rates remain constant. Qualitative example, in searching Zendesk I was able to find 10 support tickets in the last 30 days that referenced difficulties with starting a trial due to the user not being an admin. (all numbers are hypothetical and only listed for the purpose of having an example) -->
## Expected outcome
<!-- What is the expected outcome of this experiment, what metric are we trying to move? Are there any metrics we know we do not want to impact? For example, we want to impact IACV by increasing the rate at which users start trials within 30 days but we also want to ensure we don't increase the churn rate for users who've recently purchased. -->
## Experiment design & implementation
<!-- What is the experiment were going to run? How long do you believe it will need to run to reach significance? For example, our experiment would be to allow non-admins to request a trial through their admin, to detect a 10% change from our baseline conversion rate well need a sample size of 57,000 (source Optimizely), with our current sign up rate of 30,000 a month this experiment will need to run for ~2 months. (all numbers are hypothetical and only listed for the purpose of having an example) -->
## ICE score
<!-- See https://about.gitlab.com/handbook/product/growth/#growth-ideation-and-prioritization -->
| Impact | Confidence | Ease | Score |
| ------ | ------ | ------ | ------ |
| value 1 | value 2 | value 3 | Average(1:3) |
## Known assumptions
<!-- This is an area to call out known assumptions in the experiment, this is especially helpful for any future colleagues that join the team so they understand other potential influences and how they were accounted for. This section is also helpful in framing possible scenarios and to keep the door open for the next steps. For example, were hoping our experiment will increase the number of people that start a trial but were assuming the conversion rate to paid and IACV will remain the same. This is a known assumption and depending on the results of the experiment could impact the direction we take on any future iterations. -->
## Results, lessons learned, next steps
<!-- What were the results of the experiment? Was the experiment a success or a failure? Based on the results should we remove the code or advocate that it become a permanent part of the experience for all users? Are there future experiments the team is going to run based off these results (include a link to new issue)? For example, our trial experiment was successful we increased the trial create rate by 10% but we saw a 1% drop in our close rate which means our net impact on IACV was negative $360 (990 * 0.09 * 400 compared tot he control of 900 * 0.1 * 400). Our next experiment (link) will focus on increasing the value once a user starts a trial. (all numbers are hypothetical and only listed for the purpose of having an example) -->
## Checklist
* [ ] Fill in the experiment summary and write more about the details of the experiment in the rest of the issue description. Some of these may be filled in through time (the "Result, learnings, next steps" section for example) but at least the experiment summary should be filled in right from the start.
* [ ] Add the label of the `group::` that will work on this experiment (if known).
* [ ] Mention the Product Manager, Engineering Manager, and at least one Product Designer from the group that owns the part of the product that the experiment will affect.
* [ ] Fill in the values in the [ICE score table](#ice-score) ping other team members for the values you arent confident about (i.e. engineering should almost always fill out the ease section). Add the ~"ICE Score Needed" label to indicate that the score is incomplete.
* [ ] Replace the ~"ICE Score Needed" with an ICE low/medium/high score label once all values in the ICE table have been added.
* [ ] Mention the [at]gitlab-core-team team and ask for their feedback.
/label ~"workflow::validation backlog" ~"experiment idea"

View File

@ -1,4 +1,4 @@
image: registry.gitlab.com/gitlab-org/gitlab-development-kit/gitpod-workspace:gitpod-workspace-image
image: registry.gitlab.com/gitlab-org/gitlab-development-kit/gitpod-workspace:stable
tasks:
@ -7,8 +7,6 @@ tasks:
- init: |
echo "$(date) Copying GDK" | tee -a /workspace/startup.log
rm -r /workspace/.rvm
mv $HOME/.rvm-workspace /workspace/.rvm
cp -r $HOME/gitlab-development-kit /workspace/
(
set -e

View File

@ -6,6 +6,7 @@ import BlobContentError from './blob_content_error.vue';
import { BLOB_RENDER_EVENT_LOAD, BLOB_RENDER_EVENT_SHOW_SOURCE } from './constants';
export default {
name: 'BlobContent',
components: {
GlLoadingIcon,
BlobContentError,

View File

@ -1,6 +1,12 @@
import $ from 'jquery';
import '~/behaviors/markdown/render_gfm';
import { __ } from '~/locale';
import {
REPO_BLOB_LOAD_VIEWER_START,
REPO_BLOB_LOAD_VIEWER_FINISH,
REPO_BLOB_LOAD_VIEWER,
} from '~/performance/constants';
import { performanceMarkAndMeasure } from '~/performance/utils';
import { fixTitle } from '~/tooltips';
import { deprecatedCreateFlash as Flash } from '../../flash';
import axios from '../../lib/utils/axios_utils';
@ -130,6 +136,9 @@ export default class BlobViewer {
}
switchToViewer(name) {
performanceMarkAndMeasure({
mark: REPO_BLOB_LOAD_VIEWER_START,
});
const newViewer = this.$fileHolder[0].querySelector(`.blob-viewer[data-type='${name}']`);
if (this.activeViewer === newViewer) return;
@ -163,6 +172,15 @@ export default class BlobViewer {
handleLocationHash();
this.toggleCopyButtonState();
performanceMarkAndMeasure({
mark: REPO_BLOB_LOAD_VIEWER_FINISH,
measures: [
{
name: REPO_BLOB_LOAD_VIEWER,
start: REPO_BLOB_LOAD_VIEWER_START,
},
],
});
})
.catch(() => new Flash(__('Error loading viewer')));
}

View File

@ -43,6 +43,7 @@ export const WEBIDE_MEASURE_FETCH_FILES = 'WebIDE: Fetch Files';
//
// MR Diffs namespace
//
// Marks
export const MR_DIFFS_MARK_FILE_TREE_START = 'mr-diffs-mark-file-tree-start';
@ -75,3 +76,14 @@ export const PIPELINES_DETAIL_LINKS_MEASURE_CALCULATION =
export const PIPELINES_DETAIL_LINK_DURATION = 'pipeline_graph_link_calculation_duration_seconds';
export const PIPELINES_DETAIL_LINKS_TOTAL = 'pipeline_graph_links_total';
export const PIPELINES_DETAIL_LINKS_JOB_RATIO = 'pipeline_graph_links_per_job_ratio';
//
// REPO BROWSER NAMESPACE
//
// Marks
export const REPO_BLOB_LOAD_VIEWER_START = 'blobviewer-load-viewer-start';
export const REPO_BLOB_LOAD_VIEWER_FINISH = 'blobviewer-load-viewer-finish';
// Measures
export const REPO_BLOB_LOAD_VIEWER = 'Repository File Viewer: loading the content';

View File

@ -130,7 +130,7 @@ export default {
:disabled="deleteButtonDisabled"
@click="$emit('delete')"
>
{{ __('Delete') }}
{{ __('Delete image repository') }}
</gl-button>
</template>
</title-area>

View File

@ -31,7 +31,7 @@ export const CONFIGURATION_DETAILS_ROW_TEST = s__(
);
export const REMOVE_TAG_BUTTON_TITLE = s__('ContainerRegistry|Remove tag');
export const REMOVE_TAGS_BUTTON_TITLE = s__('ContainerRegistry|Delete selected');
export const REMOVE_TAGS_BUTTON_TITLE = s__('ContainerRegistry|Delete selected tags');
export const REMOVE_TAG_CONFIRMATION_TEXT = s__(
`ContainerRegistry|You are about to remove %{item}. Are you sure?`,

View File

@ -4,6 +4,7 @@ import { parseBoolean } from '~/lib/utils/common_utils';
import { escapeFileUrl } from '~/lib/utils/url_utility';
import { __ } from '~/locale';
import initWebIdeLink from '~/pages/projects/shared/web_ide_link';
import PerformancePlugin from '~/performance/vue_performance_plugin';
import App from './components/app.vue';
import Breadcrumbs from './components/breadcrumbs.vue';
import DirectoryDownloadLinks from './components/directory_download_links.vue';
@ -17,6 +18,10 @@ import createRouter from './router';
import { updateFormAction } from './utils/dom';
import { setTitle } from './utils/title';
Vue.use(PerformancePlugin, {
components: ['SimpleViewer', 'BlobContent'],
});
export default function setupVueRepositoryList() {
const el = document.getElementById('js-tree-list');
const { dataset } = el;

View File

@ -6,6 +6,7 @@ import { HIGHLIGHT_CLASS_NAME } from './constants';
import ViewerMixin from './mixins';
export default {
name: 'SimpleViewer',
components: {
GlIcon,
EditorLite: () =>

View File

@ -7,3 +7,25 @@
padding: 0.25rem;
}
}
.gl-order-1 {
order: 1;
}
.gl-sm-order-init {
@media (min-width: $breakpoint-sm) {
order: initial;
}
}
.gl-xs-ml-3 {
@media (max-width: $breakpoint-sm) {
@include gl-ml-3;
}
}
.gl-sm-mr-3 {
@media (min-width: $breakpoint-sm) {
@include gl-mr-3;
}
}

View File

@ -66,6 +66,12 @@ class ApplicationRecord < ActiveRecord::Base
end
end
def create_or_load_association(association_name)
association(association_name).create unless association(association_name).loaded?
rescue ActiveRecord::RecordNotUnique, PG::UniqueViolation
association(association_name).reader
end
def self.underscore
Gitlab::SafeRequestStore.fetch("model:#{self}:underscore") { self.to_s.underscore }
end

View File

@ -62,6 +62,9 @@ module Ci
delegate :gitlab_deploy_token, to: :project
delegate :trigger_short_token, to: :trigger_request, allow_nil: true
ignore_columns :id_convert_to_bigint, remove_with: '14.1', remove_after: '2021-07-22'
ignore_columns :stage_id_convert_to_bigint, remove_with: '14.1', remove_after: '2021-07-22'
##
# Since Gitlab 11.5, deployments records started being created right after
# `ci_builds` creation. We can look up a relevant `environment` through

View File

@ -104,16 +104,13 @@ class Project < ApplicationRecord
after_save :create_import_state, if: ->(project) { project.import? && project.import_state.nil? }
after_create :create_project_feature, unless: :project_feature
after_create -> { create_or_load_association(:project_feature) }
after_create :create_ci_cd_settings,
unless: :ci_cd_settings
after_create -> { create_or_load_association(:ci_cd_settings) }
after_create :create_container_expiration_policy,
unless: :container_expiration_policy
after_create -> { create_or_load_association(:container_expiration_policy) }
after_create :create_pages_metadatum,
unless: :pages_metadatum
after_create -> { create_or_load_association(:pages_metadatum) }
after_create :set_timestamps_for_create
after_update :update_forks_visibility_level

View File

@ -40,7 +40,7 @@ module Projects
if namespace_id
# Find matching namespace and check if it allowed
# for current user if namespace_id passed.
unless allowed_namespace?(current_user, namespace_id)
unless current_user.can?(:create_projects, project_namespace)
@project.namespace_id = nil
deny_namespace
return @project
@ -83,13 +83,6 @@ module Projects
@project.errors.add(:namespace, "is not valid")
end
# rubocop: disable CodeReuse/ActiveRecord
def allowed_namespace?(user, namespace_id)
namespace = Namespace.find_by(id: namespace_id)
current_user.can?(:create_projects, namespace)
end
# rubocop: enable CodeReuse/ActiveRecord
def after_create_actions
log_info("#{@project.owner.name} created a new project \"#{@project.full_name}\"")

View File

@ -0,0 +1,5 @@
---
title: Initialize int8 migration for ci_builds
merge_request: 60265
author:
type: other

View File

@ -0,0 +1,5 @@
---
title: Move license history to gl-table utility class
merge_request: 58531
author: Yogi (@yo)
type: changed

View File

@ -0,0 +1,5 @@
---
title: Clarify image repository delete actions
merge_request: 60154
author:
type: changed

View File

@ -20,7 +20,7 @@ CATEGORIES = YAML
.freeze
def check_changelog_trailer(commit)
trailer = commit.message.match(/^Changelog:\s*(?<category>\w+)/)
trailer = commit.message.match(/^Changelog:\s*(?<category>.+)$/)
return :missing if trailer.nil? || trailer[:category].nil?

View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
class InitializeConversionOfCiBuildsToBigint < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
TABLE = :ci_builds
COLUMNS = %i(id stage_id)
TARGET_COLUMNS = COLUMNS.map { |col| "#{col}_convert_to_bigint" }
def up
initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
class BackfillCiBuildsForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
TABLE = :ci_builds
COLUMNS = %i(id stage_id).freeze
def up
return unless should_run?
backfill_conversion_of_integer_to_bigint TABLE, COLUMNS, batch_size: 15000, sub_batch_size: 100
end
def down
return unless should_run?
revert_backfill_conversion_of_integer_to_bigint TABLE, COLUMNS
end
private
def should_run?
Gitlab.dev_or_test_env? || Gitlab.com?
end
end

View File

@ -0,0 +1 @@
46de2e905a591c14ce18acf041bac6fb48ec19ad9f40fababcbf27ae02f7fa75

View File

@ -0,0 +1 @@
12ad8f05a4d864d9986d6ca400a687c40b2de1acb461b134a8103f9a882921e7

View File

@ -115,6 +115,16 @@ BEGIN
END;
$$;
CREATE FUNCTION trigger_3f6129be01d2() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."id_convert_to_bigint" := NEW."id";
NEW."stage_id_convert_to_bigint" := NEW."stage_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_69523443cc10() RETURNS trigger
LANGUAGE plpgsql
AS $$
@ -10433,6 +10443,8 @@ CREATE TABLE ci_builds (
waiting_for_resource_at timestamp with time zone,
processed boolean,
scheduling_type smallint,
id_convert_to_bigint bigint DEFAULT 0 NOT NULL,
stage_id_convert_to_bigint bigint,
CONSTRAINT check_1e2fbd1b39 CHECK ((lock_version IS NOT NULL))
);
@ -24754,6 +24766,8 @@ CREATE TRIGGER trigger_07c94931164e BEFORE INSERT OR UPDATE ON push_event_payloa
CREATE TRIGGER trigger_21e7a2602957 BEFORE INSERT OR UPDATE ON ci_build_needs FOR EACH ROW EXECUTE PROCEDURE trigger_21e7a2602957();
CREATE TRIGGER trigger_3f6129be01d2 BEFORE INSERT OR UPDATE ON ci_builds FOR EACH ROW EXECUTE PROCEDURE trigger_3f6129be01d2();
CREATE TRIGGER trigger_69523443cc10 BEFORE INSERT OR UPDATE ON events FOR EACH ROW EXECUTE PROCEDURE trigger_69523443cc10();
CREATE TRIGGER trigger_8485e97c00e3 BEFORE INSERT OR UPDATE ON ci_sources_pipelines FOR EACH ROW EXECUTE PROCEDURE trigger_8485e97c00e3();

View File

@ -261,6 +261,8 @@ excluded_attributes:
- :resource_group_id
- :waiting_for_resource_at
- :processed
- :id_convert_to_bigint
- :stage_id_convert_to_bigint
sentry_issue:
- :issue_id
push_event_payload:

View File

@ -4027,9 +4027,6 @@ msgstr ""
msgid "Applying suggestions..."
msgstr ""
msgid "Approval Gate"
msgstr ""
msgid "Approval Status"
msgstr ""
@ -4047,15 +4044,6 @@ msgid_plural "ApprovalRuleRemove|%d members"
msgstr[0] ""
msgstr[1] ""
msgid "ApprovalRuleRemove|Remove approval gate"
msgstr ""
msgid "ApprovalRuleRemove|Remove approval gate?"
msgstr ""
msgid "ApprovalRuleRemove|You are about to remove the %{name} approval gate. Approval from this service is not revoked."
msgstr ""
msgid "ApprovalRuleRemove|You are about to remove the %{name} approver group which has %{strongStart}%{count} member%{strongEnd}. Approvals from this member are not revoked."
msgid_plural "ApprovalRuleRemove|You are about to remove the %{name} approver group which has %{strongStart}%{count} members%{strongEnd}. Approvals from these members are not revoked."
msgstr[0] ""
@ -4071,24 +4059,15 @@ msgid_plural "ApprovalRuleSummary|%{count} approvals required from %{membersCoun
msgstr[0] ""
msgstr[1] ""
msgid "ApprovalRule|Add approvel gate"
msgstr ""
msgid "ApprovalRule|Add approvers"
msgstr ""
msgid "ApprovalRule|Approval rules"
msgstr ""
msgid "ApprovalRule|Approval service API"
msgstr ""
msgid "ApprovalRule|Approvals required"
msgstr ""
msgid "ApprovalRule|Approvel gate"
msgstr ""
msgid "ApprovalRule|Approver Type"
msgstr ""
@ -4098,15 +4077,15 @@ msgstr ""
msgid "ApprovalRule|Examples: QA, Security."
msgstr ""
msgid "ApprovalRule|Invoke an external API as part of the approvals"
msgstr ""
msgid "ApprovalRule|Name"
msgstr ""
msgid "ApprovalRule|Rule name"
msgstr ""
msgid "ApprovalRule|Status check"
msgstr ""
msgid "ApprovalRule|Target branch"
msgstr ""
@ -8582,7 +8561,7 @@ msgstr ""
msgid "ContainerRegistry|Delete image repository?"
msgstr ""
msgid "ContainerRegistry|Delete selected"
msgid "ContainerRegistry|Delete selected tags"
msgstr ""
msgid "ContainerRegistry|Deleting the image repository will delete all images and tags inside. This action cannot be undone."
@ -10552,6 +10531,9 @@ msgstr ""
msgid "Delete domain"
msgstr ""
msgid "Delete image repository"
msgstr ""
msgid "Delete label"
msgstr ""
@ -30452,6 +30434,24 @@ msgstr ""
msgid "Status: %{title}"
msgstr ""
msgid "StatusCheck|API to check"
msgstr ""
msgid "StatusCheck|Invoke an external API as part of the approvals"
msgstr ""
msgid "StatusCheck|Remove status check"
msgstr ""
msgid "StatusCheck|Remove status check?"
msgstr ""
msgid "StatusCheck|Status to check"
msgstr ""
msgid "StatusCheck|You are about to remove the %{name} status check."
msgstr ""
msgid "StatusPage|AWS %{docsLink}"
msgstr ""

View File

@ -120,7 +120,7 @@ describe('Details Header', () => {
it('has the correct text', () => {
mountComponent();
expect(findDeleteButton().text()).toBe('Delete');
expect(findDeleteButton().text()).toBe('Delete image repository');
});
it('has the correct props', () => {

View File

@ -65,6 +65,15 @@ RSpec.describe Gitlab::Usage::Metrics::Aggregates::Aggregate, :clean_gitlab_redi
end
context 'there are aggregated metrics defined' do
let(:aggregated_metrics) do
[
aggregated_metric(name: "gmau_1", source: datasource, time_frame: time_frame, operator: operator)
]
end
let(:results) { { 'gmau_1' => 5 } }
let(:params) { { start_date: start_date, end_date: end_date, recorded_at: recorded_at } }
before do
allow_next_instance_of(described_class) do |instance|
allow(instance).to receive(:aggregated_metrics).and_return(aggregated_metrics)
@ -72,23 +81,23 @@ RSpec.describe Gitlab::Usage::Metrics::Aggregates::Aggregate, :clean_gitlab_redi
end
context 'with OR operator' do
let(:aggregated_metrics) do
[
aggregated_metric(name: "gmau_1", source: datasource, time_frame: time_frame, operator: "OR")
]
end
let(:operator) { Gitlab::Usage::Metrics::Aggregates::UNION_OF_AGGREGATED_METRICS }
it 'returns the number of unique events occurred for any metric in aggregate', :aggregate_failures do
results = {
'gmau_1' => 5
}
params = { start_date: start_date, end_date: end_date, recorded_at: recorded_at }
expect(namespace::SOURCES[datasource]).to receive(:calculate_metrics_union).with(params.merge(metric_names: %w[event1 event2 event3])).and_return(5)
expect(aggregated_metrics_data).to eq(results)
end
end
context 'with AND operator' do
let(:operator) { Gitlab::Usage::Metrics::Aggregates::INTERSECTION_OF_AGGREGATED_METRICS }
it 'returns the number of unique events that occurred for all of metrics in the aggregate', :aggregate_failures do
expect(namespace::SOURCES[datasource]).to receive(:calculate_metrics_intersections).with(params.merge(metric_names: %w[event1 event2 event3])).and_return(5)
expect(aggregated_metrics_data).to eq(results)
end
end
context 'hidden behind feature flag' do
let(:enabled_feature_flag) { 'test_ff_enabled' }
let(:disabled_feature_flag) { 'test_ff_disabled' }