Skip to content
Snippets Groups Projects
Commit 6a4ffad4 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 23d23711
No related branches found
No related tags found
No related merge requests found
Showing
with 170 additions and 38 deletions
Loading
Loading
@@ -20,6 +20,7 @@ code_quality:
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
CODE_QUALITY_IMAGE: "registry.gitlab.com/gitlab-org/security-products/codequality:12-5-stable"
script:
- |
if ! docker info &>/dev/null; then
Loading
Loading
@@ -27,11 +28,12 @@ code_quality:
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
"registry.gitlab.com/gitlab-org/security-products/codequality:12-0-stable" /code
"$CODE_QUALITY_IMAGE" /code
artifacts:
reports:
codequality: gl-code-quality-report.json
Loading
Loading
Loading
Loading
@@ -80,6 +80,15 @@ export default {
}
return '';
},
downloadPath() {
const data = JSON.stringify(this.requests);
const blob = new Blob([data], { type: 'text/plain' });
return window.URL.createObjectURL(blob);
},
downloadName() {
const fileName = this.requests[0].truncatedUrl;
return `${fileName}_perf_bar_${Date.now()}.json`;
},
},
mounted() {
this.currentRequest = this.requestId;
Loading
Loading
@@ -121,6 +130,9 @@ export default {
<a :href="currentRequest.details.tracing.tracing_url">{{ s__('PerformanceBar|trace') }}</a>
</div>
<add-request v-on="$listeners" />
<div v-if="currentRequest.details" id="peek-download" class="view">
<a :download="downloadName" :href="downloadPath">{{ s__('PerformanceBar|Download') }}</a>
</div>
<request-selector
v-if="currentRequest"
:current-request="currentRequest"
Loading
Loading
Loading
Loading
@@ -40,16 +40,6 @@ export default {
},
},
methods: {
truncatedUrl(requestUrl) {
const components = requestUrl.replace(/\/$/, '').split('/');
let truncated = components[components.length - 1];
if (truncated.match(/^\d+$/)) {
truncated = `${components[components.length - 2]}/${truncated}`;
}
return truncated;
},
glEmojiTag,
},
};
Loading
Loading
@@ -63,7 +53,7 @@ export default {
:value="request.id"
class="qa-performance-bar-request"
>
{{ truncatedUrl(request.url) }}
{{ request.truncatedUrl }}
<span v-if="request.hasWarnings">(!)</span>
</option>
</select>
Loading
Loading
Loading
Loading
@@ -5,9 +5,12 @@ export default class PerformanceBarStore {
 
addRequest(requestId, requestUrl) {
if (!this.findRequest(requestId)) {
const shortUrl = PerformanceBarStore.truncateUrl(requestUrl);
this.requests.push({
id: requestId,
url: requestUrl,
truncatedUrl: shortUrl,
details: {},
hasWarnings: false,
});
Loading
Loading
@@ -36,4 +39,20 @@ export default class PerformanceBarStore {
canTrackRequest(requestUrl) {
return this.requests.filter(request => request.url === requestUrl).length < 2;
}
static truncateUrl(requestUrl) {
const [rootAndQuery] = requestUrl.split('#');
const [root, query] = rootAndQuery.split('?');
const components = root.replace(/\/$/, '').split('/');
let truncated = components[components.length - 1];
if (truncated.match(/^\d+$/)) {
truncated = `${components[components.length - 2]}/${truncated}`;
}
if (query) {
truncated += `?${query}`;
}
return truncated;
}
}
Loading
Loading
@@ -18,6 +18,7 @@ module ServiceParams
:channels,
:color,
:colorize_messages,
:comment_on_event_enabled,
:confidential_issues_events,
:default_irc_uri,
:description,
Loading
Loading
Loading
Loading
@@ -31,6 +31,26 @@ module ServicesHelper
"#{event}_events"
end
 
def service_event_action_field_name(action)
"#{action}_on_event_enabled"
end
def event_action_title(action)
case action
when "comment"
s_("ProjectService|Comment")
else
action.humanize
end
end
def event_action_description(action)
case action
when "comment"
s_("ProjectService|Comment will be posted on each event")
end
end
def service_save_button(service)
button_tag(class: 'btn btn-success', type: 'submit', disabled: service.deprecated?, data: { qa_selector: 'save_changes_button' }) do
icon('spinner spin', class: 'hidden js-btn-spinner') +
Loading
Loading
Loading
Loading
@@ -32,6 +32,10 @@ class JiraService < IssueTrackerService
%w(commit merge_request)
end
 
def self.supported_event_actions
%w(comment)
end
# {PROJECT-KEY}-{NUMBER} Examples: JIRA-1, PROJECT-1
def self.reference_pattern(only_long: true)
@reference_pattern ||= /(?<issue>\b#{Gitlab::Regex.jira_issue_key_regex})/
Loading
Loading
@@ -268,19 +272,27 @@ class JiraService < IssueTrackerService
return unless client_url.present?
 
jira_request do
remote_link = find_remote_link(issue, remote_link_props[:object][:url])
if remote_link
remote_link.save!(remote_link_props)
elsif issue.comments.build.save!(body: message)
new_remote_link = issue.remotelink.build
new_remote_link.save!(remote_link_props)
end
create_issue_link(issue, remote_link_props)
create_issue_comment(issue, message)
 
log_info("Successfully posted", client_url: client_url)
"SUCCESS: Successfully posted to #{client_url}."
end
end
 
def create_issue_link(issue, remote_link_props)
remote_link = find_remote_link(issue, remote_link_props[:object][:url])
remote_link ||= issue.remotelink.build
remote_link.save!(remote_link_props)
end
def create_issue_comment(issue, message)
return unless comment_on_event_enabled
issue.comments.build.save!(body: message)
end
def find_remote_link(issue, url)
links = jira_request { issue.remotelink.all }
return unless links
Loading
Loading
Loading
Loading
@@ -155,6 +155,14 @@ class Service < ApplicationRecord
end
end
 
def configurable_event_actions
self.class.supported_event_actions
end
def self.supported_event_actions
%w()
end
def supported_events
self.class.supported_events
end
Loading
Loading
Loading
Loading
@@ -4,14 +4,14 @@ module MergeRequests
class PushOptionsHandlerService
LIMIT = 10
 
attr_reader :branches, :changes_by_branch, :current_user, :errors,
attr_reader :current_user, :errors, :changes,
:project, :push_options, :target_project
 
def initialize(project, current_user, changes, push_options)
@project = project
@target_project = @project.default_merge_request_target
@current_user = current_user
@branches = get_branches(changes)
@changes = Gitlab::ChangesList.new(changes)
@push_options = push_options
@errors = []
end
Loading
Loading
@@ -34,8 +34,12 @@ module MergeRequests
 
private
 
def get_branches(raw_changes)
Gitlab::ChangesList.new(raw_changes).map do |changes|
def branches
changes_by_branch.keys
end
def changes_by_branch
@changes_by_branch ||= changes.each_with_object({}) do |changes, result|
next unless Gitlab::Git.branch_ref?(changes[:ref])
 
# Deleted branch
Loading
Loading
@@ -45,8 +49,8 @@ module MergeRequests
branch_name = Gitlab::Git.branch_name(changes[:ref])
next if branch_name == target_project.default_branch
 
branch_name
end.compact.uniq
result[branch_name] = changes
end
end
 
def validate_service
Loading
Loading
@@ -101,7 +105,7 @@ module MergeRequests
project,
current_user,
merge_request.attributes.merge(assignees: merge_request.assignees,
label_ids: merge_request.label_ids)
label_ids: merge_request.label_ids)
).execute
end
 
Loading
Loading
@@ -112,7 +116,7 @@ module MergeRequests
merge_request = ::MergeRequests::UpdateService.new(
target_project,
current_user,
update_params
update_params(merge_request)
).execute(merge_request)
 
collect_errors_from_merge_request(merge_request) unless merge_request.valid?
Loading
Loading
@@ -130,19 +134,22 @@ module MergeRequests
 
params.compact!
 
if push_options.key?(:merge_when_pipeline_succeeds)
params.merge!(
merge_when_pipeline_succeeds: push_options[:merge_when_pipeline_succeeds],
merge_user: current_user
)
end
params[:add_labels] = params.delete(:label).keys if params.has_key?(:label)
params[:remove_labels] = params.delete(:unlabel).keys if params.has_key?(:unlabel)
 
params
end
 
def merge_params(branch)
return {} unless push_options.key?(:merge_when_pipeline_succeeds)
{
merge_when_pipeline_succeeds: push_options[:merge_when_pipeline_succeeds],
merge_user: current_user,
sha: changes_by_branch.dig(branch, :newrev)
}
end
def create_params(branch)
params = base_params
 
Loading
Loading
@@ -153,13 +160,15 @@ module MergeRequests
target_project: target_project
)
 
params.merge!(merge_params(branch))
params[:target_branch] ||= target_project.default_branch
 
params
end
 
def update_params
base_params
def update_params(merge_request)
base_params.merge(merge_params(merge_request.source_branch))
end
 
def collect_errors_from_merge_request(merge_request)
Loading
Loading
Loading
Loading
@@ -14,7 +14,6 @@
= _("To move or copy an entire GitLab project from another GitLab installation to this one, navigate to the original project's settings page, generate an export file, and upload it here.")
.row
.form-group.col-sm-12
= hidden_field_tag :namespace_id, @namespace.id
= label_tag :file, _('GitLab project export'), class: 'label-bold'
.form-group
= file_field_tag :file, class: ''
Loading
Loading
Loading
Loading
@@ -16,7 +16,7 @@
 
- if @service.configurable_events.present?
.form-group.row
.col-sm-2.text-right Trigger
%label.col-form-label.col-sm-2= _('Trigger')
 
.col-sm-10
- @service.configurable_events.each do |event|
Loading
Loading
@@ -35,6 +35,22 @@
%p.text-muted
= @service.class.event_description(event)
 
- if @service.configurable_event_actions.present?
.form-group.row
%label.col-form-label.col-sm-2= _('Event Actions')
.col-sm-10
- @service.configurable_event_actions.each do |action|
.form-group
.form-check
= form.check_box service_event_action_field_name(action), class: 'form-check-input'
= form.label service_event_action_field_name(action), class: 'form-check-label' do
%strong
= event_action_description(action)
%p.text-muted
= event_action_description(action)
- @service.global_fields.each do |field|
- type = field[:type]
 
Loading
Loading
---
title: Add ability to make Jira comments optional
merge_request: 19004
author:
type: added
---
title: Fixed project import from export ignoring namespace selection
merge_request: 20405
author:
type: fixed
---
title: Fix removing of child epics that belong to subgroups
merge_request: 20610
author:
type: fixed
---
title: Fix merging merge requests from push options
merge_request: 20639
author:
type: fixed
---
title: Add 'download' button to Performance Bar
merge_request: 20205
author: Will Chandler
type: changed
# frozen_string_literal: true
class AddCommentActionsToServices < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_column_with_default(:services, :comment_on_event_enabled, :boolean, default: true)
end
def down
remove_column(:services, :comment_on_event_enabled)
end
end
Loading
Loading
@@ -3577,6 +3577,7 @@ ActiveRecord::Schema.define(version: 2019_11_24_150431) do
t.boolean "confidential_note_events", default: true
t.boolean "deployment_events", default: false, null: false
t.string "description", limit: 500
t.boolean "comment_on_event_enabled", default: true, null: false
t.index ["project_id"], name: "index_services_on_project_id"
t.index ["template"], name: "index_services_on_template"
t.index ["type"], name: "index_services_on_type"
Loading
Loading
doc/administration/monitoring/performance/img/performance_bar.png

69.6 KiB | W: 2560px | H: 156px

doc/administration/monitoring/performance/img/performance_bar.png

57.1 KiB | W: 2539px | H: 145px

doc/administration/monitoring/performance/img/performance_bar.png
doc/administration/monitoring/performance/img/performance_bar.png
doc/administration/monitoring/performance/img/performance_bar.png
doc/administration/monitoring/performance/img/performance_bar.png
  • 2-up
  • Swipe
  • Onion skin
Loading
Loading
@@ -19,6 +19,7 @@ It allows you to see (from left to right):
- a link to add a request's details to the performance bar; the request can be
added by its full URL (authenticated as the current user), or by the value of
its `X-Request-Id` header
- a link to download the raw JSON used to generate the Performance Bar reports
 
On the far right is a request selector that allows you to view the same metrics
(excluding the page timing and line profiler) for any requests made while the
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment