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

Add latest changes from gitlab-org/gitlab@master

parent fedf978f
No related branches found
No related tags found
No related merge requests found
Showing
with 274 additions and 59 deletions
# Make sure to update all the similar conditions in other CI config files if you modify these conditions
.if-default: &if-default
if: '$CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME =~ /^[\d-]+-stable(-ee)?$/ || $CI_COMMIT_REF_NAME =~ /^\d+-\d+-auto-deploy-\d+$/ || $CI_COMMIT_REF_NAME =~ /^security\// || $CI_MERGE_REQUEST_IID || $CI_COMMIT_TAG'
.if-not-canonical-namespace: &if-not-canonical-namespace
if: '$CI_PROJECT_NAMESPACE !~ /^gitlab(-org)?($|\/)/'
 
# Make sure to update all the similar conditions in other CI config files if you modify these conditions
.if-default-ee: &if-default-ee
if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME =~ /^[\d-]+-stable(-ee)?$/ || $CI_COMMIT_REF_NAME =~ /^\d+-\d+-auto-deploy-\d+$/ || $CI_COMMIT_REF_NAME =~ /^security\// || $CI_MERGE_REQUEST_IID || $CI_COMMIT_TAG) && $CI_PROJECT_NAME =~ /^gitlab(-ee)?$/'
.if-not-ee: &if-not-ee
if: '$CI_PROJECT_NAME !~ /^gitlab(-ee)?$/'
 
# Make sure to update all the similar conditions in other CI config files if you modify these conditions
.if-master: &if-master
.if-master-refs: &if-master-refs
if: '$CI_COMMIT_REF_NAME == "master"'
 
# Make sure to update all the similar conditions in other CI config files if you modify these conditions
.if-default-refs: &if-default-refs
if: '$CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME =~ /^[\d-]+-stable(-ee)?$/ || $CI_COMMIT_REF_NAME =~ /^\d+-\d+-auto-deploy-\d+$/ || $CI_COMMIT_REF_NAME =~ /^security\// || $CI_MERGE_REQUEST_IID || $CI_COMMIT_TAG'
# Make sure to update all the similar patterns in other CI config files if you modify these patterns
.code-backstage-patterns: &code-backstage-patterns
- ".gitlab/ci/**/*"
Loading
Loading
@@ -33,6 +37,32 @@
- "{,ee/}spec/**/*"
- "doc/README.md" # Some RSpec test rely on this file
 
# Make sure to update all the similar patterns in other CI config files if you modify these patterns
.code-backstage-patterns-qa: &code-backstage-patterns-qa
- ".gitlab/ci/**/*"
- ".{eslintignore,gitattributes,nvmrc,prettierrc,stylelintrc,yamllint}"
- ".{codeclimate,eslintrc,gitlab-ci,haml-lint,haml-lint_todo,rubocop,rubocop_todo,scss-lint}.yml"
- ".csscomb.json"
- "Dockerfile.assets"
- "*_VERSION"
- "Gemfile{,.lock}"
- "Rakefile"
- "{babel.config,jest.config}.js"
- "config.ru"
- "{package.json,yarn.lock}"
- "{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
- "doc/api/graphql/reference/*" # Files in this folder are auto-generated
# Backstage changes
- "Dangerfile"
- "danger/**/*"
- "{,ee/}fixtures/**/*"
- "{,ee/}rubocop/**/*"
- "{,ee/}spec/**/*"
- "doc/README.md" # Some RSpec test rely on this file
# QA changes
- ".dockerignore"
- "qa/**/*"
.assets-compile-cache:
cache:
paths:
Loading
Loading
@@ -46,10 +76,8 @@
extends:
- .default-tags
- .default-retry
- .default-only
- .default-before_script
- .assets-compile-cache
- .only:changes-code-backstage-qa
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-graphicsmagick-1.3.33-docker-19.03.1
stage: prepare
services:
Loading
Loading
@@ -80,24 +108,29 @@
- time scripts/build_assets_image
- scripts/clean-old-cached-assets
- rm -f /etc/apt/sources.list.d/google*.list # We don't need to update Chrome here
only:
variables:
- $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE =~ /^gitlab-org($|\/)/ # Matches the gitlab-org group and its subgroups
- $CI_SERVER_HOST == "dev.gitlab.org"
tags:
- gitlab-org
- docker
 
gitlab:assets:compile pull-push-cache:
extends: .gitlab:assets:compile-metadata
only:
refs:
- master
rules:
- <<: *if-not-canonical-namespace
when: never
- <<: *if-master-refs
changes: *code-backstage-patterns-qa
when: on_success
cache:
policy: pull-push
 
gitlab:assets:compile pull-cache:
extends: .gitlab:assets:compile-metadata
rules:
- <<: *if-not-canonical-namespace
when: never
- <<: *if-default-refs
changes: *code-backstage-patterns-qa
when: on_success
cache:
policy: pull
 
Loading
Loading
@@ -105,10 +138,8 @@ gitlab:assets:compile pull-cache:
extends:
- .default-tags
- .default-retry
- .default-only
- .default-before_script
- .assets-compile-cache
- .only:changes-code-backstage-qa
stage: prepare
script:
- node --version
Loading
Loading
@@ -130,28 +161,46 @@ gitlab:assets:compile pull-cache:
 
compile-assets pull-push-cache:
extends: .compile-assets-metadata
only:
refs:
- master
rules:
- <<: *if-master-refs
changes: *code-backstage-patterns-qa
when: on_success
cache:
policy: pull-push
 
compile-assets pull-push-cache foss:
extends: [".compile-assets-metadata", ".only-ee-as-if-foss"]
only:
refs:
- master
extends:
- .compile-assets-metadata
- .as-if-foss
rules:
- <<: *if-not-ee
when: never
- <<: *if-master-refs
changes: *code-backstage-patterns-qa
when: on_success
cache:
policy: pull-push
key: "assets-compile:v8:foss"
 
compile-assets pull-cache:
extends: .compile-assets-metadata
rules:
- <<: *if-default-refs
changes: *code-backstage-patterns-qa
when: on_success
cache:
policy: pull
 
compile-assets pull-cache foss:
extends: [".compile-assets-metadata", ".only-ee-as-if-foss"]
extends:
- .compile-assets-metadata
- .as-if-foss
rules:
- <<: *if-not-ee
when: never
- <<: *if-default-refs
changes: *code-backstage-patterns-qa
when: on_success
cache:
policy: pull
key: "assets-compile:v8:foss"
Loading
Loading
@@ -240,7 +289,7 @@ jest-foss:
- .default-cache
stage: test
rules:
- <<: *if-master
- <<: *if-master-refs
when: on_success
dependencies: []
cache:
Loading
Loading
@@ -274,7 +323,7 @@ webpack-dev-server:
- .default-cache
stage: test
rules:
- <<: *if-default
- <<: *if-default-refs
changes: *code-backstage-patterns
when: on_success
needs: ["setup-test-env", "compile-assets pull-cache"]
Loading
Loading
Loading
Loading
@@ -230,7 +230,11 @@
- $CI_PROJECT_NAME == "gitlab"
- $CI_PROJECT_NAME == "gitlab-ee" # Support former project name for forks/mirrors
 
.only-ee-as-if-foss:
extends: .only-ee
.as-if-foss:
variables:
FOSS_ONLY: '1'
.only-ee-as-if-foss:
extends:
- .only-ee
- .as-if-foss
import Cookies from 'js-cookie';
const handleOnDismiss = ({ currentTarget }) => {
currentTarget.removeEventListener('click', handleOnDismiss);
const {
dataset: { id },
} = currentTarget;
Cookies.set(`hide_broadcast_notification_message_${id}`, true);
const notification = document.querySelector(`.js-broadcast-notification-${id}`);
notification.parentNode.removeChild(notification);
};
export default () => {
const dismissButton = document.querySelector('.js-dismiss-current-broadcast-notification');
if (dismissButton) {
dismissButton.addEventListener('click', handleOnDismiss);
}
};
Loading
Loading
@@ -35,6 +35,7 @@ import initPerformanceBar from './performance_bar';
import initSearchAutocomplete from './search_autocomplete';
import GlFieldErrors from './gl_field_errors';
import initUserPopovers from './user_popovers';
import initBroadcastNotifications from './broadcast_notification';
import { initUserTracking } from './tracking';
import { __ } from './locale';
 
Loading
Loading
@@ -105,6 +106,7 @@ function deferredInitialisation() {
initUsagePingConsent();
initUserPopovers();
initUserTracking();
initBroadcastNotifications();
 
if (document.querySelector('.search')) initSearchAutocomplete();
 
Loading
Loading
Loading
Loading
@@ -6,19 +6,16 @@ module BroadcastMessagesHelper
end
 
def current_broadcast_notification_message
BroadcastMessage.current_notification_messages(request.path).last
not_hidden_messages = BroadcastMessage.current_notification_messages(request.path).select do |message|
cookies["hide_broadcast_notification_message_#{message.id}"].blank?
end
not_hidden_messages.last
end
 
def broadcast_message(message, opts = {})
return unless message.present?
 
classes = "broadcast-#{message.broadcast_type}-message #{opts[:preview] && 'preview'}"
content_tag :div, dir: 'auto', class: classes, style: broadcast_message_style(message) do
concat sprite_icon('bullhorn', size: 16, css_class: 'vertical-align-text-top')
concat ' '
concat render_broadcast_message(message)
end
render "shared/broadcast_message", { message: message, opts: opts }
end
 
def broadcast_message_style(broadcast_message)
Loading
Loading
Loading
Loading
@@ -27,7 +27,8 @@ module Ci
license_management: 'gl-license-management-report.json',
license_scanning: 'gl-license-scanning-report.json',
performance: 'performance.json',
metrics: 'metrics.txt'
metrics: 'metrics.txt',
lsif: 'lsif.sqlite3'
}.freeze
 
INTERNAL_TYPES = {
Loading
Loading
@@ -52,7 +53,8 @@ module Ci
dast: :raw,
license_management: :raw,
license_scanning: :raw,
performance: :raw
performance: :raw,
lsif: :raw
}.freeze
 
TYPE_AND_FORMAT_PAIRS = INTERNAL_TYPES.merge(REPORT_TYPES).freeze
Loading
Loading
@@ -114,7 +116,8 @@ module Ci
performance: 11, ## EE-specific
metrics: 12, ## EE-specific
metrics_referee: 13, ## runner referees
network_referee: 14 ## runner referees
network_referee: 14, ## runner referees
lsif: 15 # LSIF dump for code navigation
}
 
enum file_format: {
Loading
Loading
Loading
Loading
@@ -27,7 +27,7 @@ module AtomicInternalId
extend ActiveSupport::Concern
 
class_methods do
def has_internal_id(column, scope:, init:, ensure_if: nil, track_if: nil, presence: true) # rubocop:disable Naming/PredicateName
def has_internal_id(column, scope:, init:, ensure_if: nil, track_if: nil, presence: true, backfill: false) # rubocop:disable Naming/PredicateName
# We require init here to retain the ability to recalculate in the absence of a
# InternalId record (we may delete records in `internal_ids` for example).
raise "has_internal_id requires a init block, none given." unless init
Loading
Loading
@@ -38,6 +38,8 @@ module AtomicInternalId
validates column, presence: presence
 
define_method("ensure_#{scope}_#{column}!") do
return if backfill && self.class.where(column => nil).exists?
scope_value = internal_id_read_scope(scope)
value = read_attribute(column)
return value unless scope_value
Loading
Loading
Loading
Loading
@@ -21,7 +21,7 @@ class InternalId < ApplicationRecord
belongs_to :project
belongs_to :namespace
 
enum usage: { issues: 0, merge_requests: 1, deployments: 2, milestones: 3, epics: 4, ci_pipelines: 5 }
enum usage: { issues: 0, merge_requests: 1, deployments: 2, milestones: 3, epics: 4, ci_pipelines: 5, operations_feature_flags: 6 }
 
validates :usage, presence: true
 
Loading
Loading
# frozen_string_literal: true
module PerformanceMonitoring
class PrometheusDashboard
include ActiveModel::Model
attr_accessor :dashboard, :panel_groups
validates :dashboard, presence: true
validates :panel_groups, presence: true
def self.from_json(json_content)
dashboard = new(
dashboard: json_content['dashboard'],
panel_groups: json_content['panel_groups'].map { |group| PrometheusPanelGroup.from_json(group) }
)
dashboard.tap(&:validate!)
end
def to_yaml
self.as_json(only: valid_attributes).to_yaml
end
private
def valid_attributes
%w(panel_groups panels metrics group priority type title y_label weight id unit label query query_range dashboard)
end
end
end
# frozen_string_literal: true
module PerformanceMonitoring
class PrometheusMetric
include ActiveModel::Model
attr_accessor :id, :unit, :label, :query, :query_range
validates :unit, presence: true
validates :query, presence: true, unless: :query_range
validates :query_range, presence: true, unless: :query
def self.from_json(json_content)
metric = PrometheusMetric.new(
id: json_content['id'],
unit: json_content['unit'],
label: json_content['label'],
query: json_content['query'],
query_range: json_content['query_range']
)
metric.tap(&:validate!)
end
end
end
# frozen_string_literal: true
module PerformanceMonitoring
class PrometheusPanel
include ActiveModel::Model
attr_accessor :type, :title, :y_label, :weight, :metrics
validates :title, presence: true
validates :metrics, presence: true
def self.from_json(json_content)
panel = new(
type: json_content['type'],
title: json_content['title'],
y_label: json_content['y_label'],
weight: json_content['weight'],
metrics: json_content['metrics'].map { |metric| PrometheusMetric.from_json(metric) }
)
panel.tap(&:validate!)
end
end
end
# frozen_string_literal: true
module PerformanceMonitoring
class PrometheusPanelGroup
include ActiveModel::Model
attr_accessor :group, :priority, :panels
validates :group, presence: true
validates :panels, presence: true
def self.from_json(json_content)
panel_group = new(
group: json_content['group'],
priority: json_content['priority'],
panels: json_content['panels'].map { |panel| PrometheusPanel.from_json(panel) }
)
panel_group.tap(&:validate!)
end
end
end
Loading
Loading
@@ -927,22 +927,12 @@ class Repository
def ancestor?(ancestor_id, descendant_id)
return false if ancestor_id.nil? || descendant_id.nil?
 
counter = Gitlab::Metrics.counter(
:repository_ancestor_calls_total,
'The number of times we call Repository#ancestor with valid arguments')
cache_hit = true
cache_key = "ancestor:#{ancestor_id}:#{descendant_id}"
result = request_store_cache.fetch(cache_key) do
request_store_cache.fetch(cache_key) do
cache.fetch(cache_key) do
cache_hit = false
raw_repository.ancestor?(ancestor_id, descendant_id)
end
end
counter.increment(cache_hit: cache_hit.to_s)
result
end
 
def fetch_as_mirror(url, forced: false, refmap: :all_refs, remote_name: nil, prune: true)
Loading
Loading
%div{ class: "broadcast-#{message.broadcast_type}-message #{opts[:preview] && 'preview'} js-broadcast-notification-#{message.id} d-flex",
style: broadcast_message_style(message), dir: 'auto' }
%div
= sprite_icon('bullhorn', size: 16, css_class: 'vertical-align-text-top')
= render_broadcast_message(message)
- if message.notification? && opts[:preview].blank?
%button.js-dismiss-current-broadcast-notification.btn.btn-link.text-dark.pl-2.pr-2{ 'aria-label' => _('Close'), :type => 'button', data: { id: message.id } }
%i.fa.fa-times
---
title: Migrate epic, epic notes mentions to respective DB table
merge_request: 22333
author:
type: changed
---
title: Add validation for custom PrometheusDashboard
merge_request: 22893
author:
type: added
---
title: Add support for lsif artifact report
merge_request: 23672
author:
type: added
---
title: Add iid to operations_feature_flags and backfill
merge_request: 22175
author:
type: added
---
title: Eliminate statement timeouts when namespace is blank
merge_request: 23839
author:
type: fixed
Loading
Loading
@@ -120,9 +120,7 @@ Rails.application.routes.draw do
draw :country
draw :country_state
draw :subscription
end
 
Gitlab.ee do
constraints(-> (*) { Gitlab::Analytics.any_features_enabled? }) do
draw :analytics
end
Loading
Loading
@@ -168,11 +166,6 @@ Rails.application.routes.draw do
end
end
 
draw :api
draw :sidekiq
draw :help
draw :snippets
# Invites
resources :invites, only: [:show], constraints: { id: /[A-Za-z0-9_-]+/ } do
member do
Loading
Loading
@@ -193,6 +186,25 @@ Rails.application.routes.draw do
# Notification settings
resources :notification_settings, only: [:create, :update]
 
resources :groups, only: [:index, :new, :create] do
post :preview_markdown
end
resources :projects, only: [:index, :new, :create]
get '/projects/:id' => 'projects#resolve'
Gitlab.ee do
scope '/-/push_from_secondary/:geo_node_id' do
draw :git_http
end
end
draw :git_http
draw :api
draw :sidekiq
draw :help
draw :snippets
draw :google_api
draw :import
draw :uploads
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