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

Add latest changes from gitlab-org/gitlab@master

parent b4ded0ba
No related branches found
No related tags found
No related merge requests found
Showing
with 158 additions and 34 deletions
Loading
Loading
@@ -21,6 +21,9 @@ const MAX_CHAR_LIMIT = 5000;
export default function renderMermaid($els) {
if (!$els.length) return;
 
// A diagram may have been truncated in search results which will cause errors, so abort the render.
if (document.querySelector('body').dataset.page === 'search:show') return;
import(/* webpackChunkName: 'mermaid' */ 'mermaid')
.then(mermaid => {
mermaid.initialize({
Loading
Loading
Loading
Loading
@@ -18,7 +18,7 @@ const firstDayOfWeekChoices = Object.freeze({
 
const LOADING_HTML = `
<div class="text-center">
<i class="fa fa-spinner fa-spin user-calendar-activities-loading"></i>
<div class="spinner spinner-md"></div>
</div>
`;
 
Loading
Loading
Loading
Loading
@@ -57,10 +57,8 @@ import UserOverviewBlock from './user_overview_block';
* </div>
* </div>
*
* <div class="loading-status">
* <div class="loading">
* Loading Animation
* </div>
* <div class="loading">
* Loading Animation
* </div>
*/
 
Loading
Loading
@@ -242,7 +240,7 @@ export default class UserTabs {
}
 
toggleLoading(status) {
return this.$parentEl.find('.loading-status .loading').toggleClass('hide', !status);
return this.$parentEl.find('.loading').toggleClass('hide', !status);
}
 
setCurrentAction(source) {
Loading
Loading
Loading
Loading
@@ -581,6 +581,7 @@ img.emoji {
.gl-line-height-24 { line-height: $gl-line-height-24; }
.gl-line-height-14 { line-height: $gl-line-height-14; }
 
.gl-font-size-0 { font-size: 0; }
.gl-font-size-12 { font-size: $gl-font-size-12; }
.gl-font-size-14 { font-size: $gl-font-size-14; }
.gl-font-size-16 { font-size: $gl-font-size-16; }
Loading
Loading
Loading
Loading
@@ -17,7 +17,9 @@
.tree-controls {
text-align: right;
 
.btn {
> .btn,
.project-action-button > .btn,
.git-clone-holder > .btn {
margin-left: 8px;
}
 
Loading
Loading
Loading
Loading
@@ -37,10 +37,6 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
define_method(action) { perform_update if submitted? }
end
 
def show
render :general
end
def update
perform_update
end
Loading
Loading
@@ -73,7 +69,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
RepositoryCheck::ClearWorker.perform_async
 
redirect_to(
admin_application_settings_path,
general_admin_application_settings_path,
notice: _('Started asynchronous removal of all repository check states.')
)
end
Loading
Loading
@@ -256,7 +252,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
session[:ask_for_usage_stats_consent] = current_user.requires_usage_stats_consent?
end
 
redirect_path = referer_path(request) || admin_application_settings_path
redirect_path = referer_path(request) || general_admin_application_settings_path
 
respond_to do |format|
if successful
Loading
Loading
Loading
Loading
@@ -25,6 +25,14 @@ module Ci
# rubocop:enable Cop/ActiveRecordSerialize
 
state_machine :status do
after_transition created: :pending do |bridge|
next unless bridge.downstream_project
bridge.run_after_commit do
bridge.schedule_downstream_pipeline!
end
end
event :manual do
transition all => :manual
end
Loading
Loading
@@ -38,6 +46,12 @@ module Ci
raise NotImplementedError
end
 
def schedule_downstream_pipeline!
raise InvalidBridgeTypeError unless downstream_project
::Ci::CreateCrossProjectPipelineWorker.perform_async(self.id)
end
def inherit_status_from_downstream!(pipeline)
case pipeline.status
when 'success'
Loading
Loading
Loading
Loading
@@ -31,6 +31,7 @@ module Clusters
has_many :cluster_projects, class_name: 'Clusters::Project'
has_many :projects, through: :cluster_projects, class_name: '::Project'
has_one :cluster_project, -> { order(id: :desc) }, class_name: 'Clusters::Project'
has_many :deployment_clusters
 
has_many :cluster_groups, class_name: 'Clusters::Group'
has_many :groups, through: :cluster_groups, class_name: '::Group'
Loading
Loading
Loading
Loading
@@ -17,7 +17,12 @@ module CommitStatusEnums
archived_failure: 9,
unmet_prerequisites: 10,
scheduler_failure: 11,
data_integrity_failure: 12
data_integrity_failure: 12,
insufficient_bridge_permissions: 1_001,
downstream_bridge_project_not_found: 1_002,
invalid_bridge_trigger: 1_003,
bridge_pipeline_is_child_pipeline: 1_006,
downstream_pipeline_creation_failed: 1_007
}
end
end
Loading
Loading
Loading
Loading
@@ -18,6 +18,8 @@ class Deployment < ApplicationRecord
has_many :merge_requests,
through: :deployment_merge_requests
 
has_one :deployment_cluster
has_internal_id :iid, scope: :project, track_if: -> { !importing? }, init: ->(s) do
Deployment.where(project: s.project).maximum(:iid) if s&.project
end
Loading
Loading
# frozen_string_literal: true
class DeploymentCluster < ApplicationRecord
belongs_to :deployment, optional: false
belongs_to :cluster, optional: false, class_name: 'Clusters::Cluster'
end
Loading
Loading
@@ -190,6 +190,7 @@ class Project < ApplicationRecord
has_one :error_tracking_setting, inverse_of: :project, class_name: 'ErrorTracking::ProjectErrorTrackingSetting'
has_one :metrics_setting, inverse_of: :project, class_name: 'ProjectMetricsSetting'
has_one :grafana_integration, inverse_of: :project
has_one :project_setting, ->(project) { where_or_create_by(project: project) }, inverse_of: :project
 
# Merge Requests for target project should be removed with it
has_many :merge_requests, foreign_key: 'target_project_id', inverse_of: :target_project
Loading
Loading
# frozen_string_literal: true
class ProjectSetting < ApplicationRecord
belongs_to :project, inverse_of: :project_setting
self.primary_key = :project_id
def self.where_or_create_by(attrs)
where(primary_key => safe_find_or_create_by(attrs))
end
end
Loading
Loading
@@ -13,7 +13,12 @@ class CommitStatusPresenter < Gitlab::View::Presenter::Delegated
archived_failure: 'The job is archived and cannot be run',
unmet_prerequisites: 'The job failed to complete prerequisite tasks',
scheduler_failure: 'The scheduler failed to assign job to the runner, please try again or contact system administrator',
data_integrity_failure: 'There has been a structural integrity problem detected, please contact system administrator'
data_integrity_failure: 'There has been a structural integrity problem detected, please contact system administrator',
invalid_bridge_trigger: 'This job could not be executed because downstream pipeline trigger definition is invalid',
downstream_bridge_project_not_found: 'This job could not be executed because downstream bridge project could not be found',
insufficient_bridge_permissions: 'This job could not be executed because of insufficient permissions to create a downstream pipeline',
bridge_pipeline_is_child_pipeline: 'This job belongs to a child pipeline and cannot create further child pipelines',
downstream_pipeline_creation_failed: 'The downstream pipeline could not be created'
}.freeze
 
private_constant :CALLOUT_FAILURE_MESSAGES
Loading
Loading
# frozen_string_literal: true
module Ci
# TODO: rename this (and worker) to CreateDownstreamPipelineService
class CreateCrossProjectPipelineService < ::BaseService
include Gitlab::Utils::StrongMemoize
def execute(bridge)
@bridge = bridge
pipeline_params = @bridge.downstream_pipeline_params
target_ref = pipeline_params.dig(:target_revision, :ref)
return unless ensure_preconditions!(target_ref)
service = ::Ci::CreatePipelineService.new(
pipeline_params.fetch(:project),
current_user,
pipeline_params.fetch(:target_revision))
downstream_pipeline = service.execute(
pipeline_params.fetch(:source), pipeline_params[:execute_params]) do |pipeline|
@bridge.sourced_pipelines.build(
source_pipeline: @bridge.pipeline,
source_project: @bridge.project,
project: @bridge.downstream_project,
pipeline: pipeline)
pipeline.variables.build(@bridge.downstream_variables)
end
downstream_pipeline.tap do |pipeline|
@bridge.drop!(:downstream_pipeline_creation_failed) if pipeline.has_yaml_errors?
end
end
private
def ensure_preconditions!(target_ref)
unless downstream_project_accessible?
@bridge.drop!(:downstream_bridge_project_not_found)
return false
end
# TODO: Remove this condition if favour of model validation
# https://gitlab.com/gitlab-org/gitlab/issues/38338
if downstream_project == project && !@bridge.triggers_child_pipeline?
@bridge.drop!(:invalid_bridge_trigger)
return false
end
# TODO: Remove this condition if favour of model validation
# https://gitlab.com/gitlab-org/gitlab/issues/38338
if @bridge.triggers_child_pipeline? && @bridge.pipeline.parent_pipeline.present?
@bridge.drop!(:bridge_pipeline_is_child_pipeline)
return false
end
unless can_create_downstream_pipeline?(target_ref)
@bridge.drop!(:insufficient_bridge_permissions)
return false
end
true
end
def downstream_project_accessible?
downstream_project.present? &&
can?(current_user, :read_project, downstream_project)
end
def can_create_downstream_pipeline?(target_ref)
can?(current_user, :update_pipeline, project) &&
can?(current_user, :create_pipeline, downstream_project) &&
can_update_branch?(target_ref)
end
def can_update_branch?(target_ref)
::Gitlab::UserAccess.new(current_user, project: downstream_project).can_update_branch?(target_ref)
end
def downstream_project
strong_memoize(:downstream_project) do
@bridge.downstream_project
end
end
end
end
Loading
Loading
@@ -79,6 +79,8 @@ module MergeRequests
end
 
merge_request.update!(merge_commit_sha: commit_id)
ensure
merge_request.update_column(:in_progress_merge_commit_sha, nil)
end
 
def try_merge
Loading
Loading
@@ -89,8 +91,6 @@ module MergeRequests
rescue => e
handle_merge_error(log_message: e.message)
raise_error('Something went wrong during merge')
ensure
merge_request.update!(in_progress_merge_commit_sha: nil)
end
 
def after_merge
Loading
Loading
Loading
Loading
@@ -90,6 +90,7 @@ module Projects
end
 
@project.track_project_repository
@project.create_project_setting unless @project.project_setting
 
event_service.create_project(@project, current_user)
system_hook_service.execute_hooks_for(@project, :create)
Loading
Loading
Loading
Loading
@@ -42,7 +42,7 @@
.well-segment.admin-well.admin-well-features
%h4 Features
= feature_entry(_('Sign up'),
href: admin_application_settings_path(anchor: 'js-signup-settings'),
href: general_admin_application_settings_path(anchor: 'js-signup-settings'),
enabled: allow_signup?)
 
= feature_entry(_('LDAP'),
Loading
Loading
@@ -50,11 +50,11 @@
doc_href: help_page_path('administration/auth/ldap'))
 
= feature_entry(_('Gravatar'),
href: admin_application_settings_path(anchor: 'js-account-settings'),
href: general_admin_application_settings_path(anchor: 'js-account-settings'),
enabled: gravatar_enabled?)
 
= feature_entry(_('OmniAuth'),
href: admin_application_settings_path(anchor: 'js-signin-settings'),
href: general_admin_application_settings_path(anchor: 'js-signin-settings'),
enabled: Gitlab::Auth.omniauth_enabled?,
doc_href: help_page_path('integration/omniauth'))
 
Loading
Loading
@@ -85,7 +85,7 @@
.float-right
= version_status_badge
%p
%a{ href: admin_application_settings_path }
%a{ href: general_admin_application_settings_path }
GitLab
%span.float-right
= Gitlab::VERSION
Loading
Loading
%h2#usage-ping Usage ping
.bs-callout.clearfix
%p
User cohorts are shown because the usage ping is enabled. The data sent with
this is shown below. To disable this, visit
= succeed '.' do
= link_to 'application settings', admin_application_settings_path(anchor: 'usage-statistics')
%pre.usage-data.js-syntax-highlight.code.highlight{ data: { endpoint: usage_data_admin_application_settings_path(format: :html) } }
Loading
Loading
@@ -221,7 +221,7 @@
= _('Appearance')
 
= nav_link(controller: :application_settings) do
= link_to admin_application_settings_path do
= link_to general_admin_application_settings_path do
.nav-icon-container
= sprite_icon('settings')
%span.nav-item-name.qa-admin-settings-item
Loading
Loading
@@ -229,11 +229,11 @@
 
%ul.sidebar-sub-level-items.qa-admin-sidebar-settings-submenu
= nav_link(controller: :application_settings, html_options: { class: "fly-out-top-item" } ) do
= link_to admin_application_settings_path do
= link_to general_admin_application_settings_path do
%strong.fly-out-top-item-name
= _('Settings')
%li.divider.fly-out-top-item
= nav_link(path: 'application_settings#show') do
= nav_link(path: 'application_settings#general') do
= link_to general_admin_application_settings_path, title: _('General'), class: 'qa-admin-settings-general-item' do
%span
= _('General')
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