Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-27 15:06:30 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-27 15:06:30 +0300
commit3269a20692c5b1f32862072d7897a4e753bae9ef (patch)
tree9dfc6e7ccb857b323dc8b12259d339b76b8b90bf
parentc02f53288a838166a28518983fae3b80ca5936d8 (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/assets/javascripts/environments/folder/environments_folder_view.vue12
-rw-r--r--app/assets/stylesheets/pages/environments.scss1
-rw-r--r--app/models/ci/build_trace_section.rb3
-rw-r--r--app/models/merge_request.rb9
-rw-r--r--app/models/merge_request_diff.rb11
-rw-r--r--app/models/project.rb23
-rw-r--r--app/services/merge_requests/refresh_service.rb2
-rw-r--r--app/services/metrics/dashboard/base_embed_service.rb2
-rw-r--r--app/services/metrics/dashboard/custom_metric_embed_service.rb2
-rw-r--r--app/services/metrics/dashboard/predefined_dashboard_service.rb45
-rw-r--r--app/services/metrics/dashboard/system_dashboard_service.rb37
-rw-r--r--app/views/projects/environments/folder.html.haml4
-rw-r--r--changelogs/unreleased/32470-ui-degradation-on-environment-folder-view.yml5
-rw-r--r--changelogs/unreleased/expose_moved_to_in_issues_api.yml5
-rw-r--r--changelogs/unreleased/remove_build_badge_path_from_route.yml5
-rw-r--r--config/routes/project.rb2
-rw-r--r--danger/changes_size/Dangerfile2
-rw-r--r--danger/database/Dangerfile2
-rw-r--r--danger/roulette/Dangerfile4
-rw-r--r--doc/api/issues.md1
-rw-r--r--doc/user/project/releases/index.md4
-rw-r--r--lib/api/entities.rb2
-rw-r--r--lib/gitlab/danger/helper.rb5
-rw-r--r--lib/gitlab/metrics/dashboard/service_selector.rb2
-rw-r--r--locale/gitlab.pot6
-rw-r--r--scripts/review_apps/base-config.yaml2
-rwxr-xr-xscripts/review_apps/review-apps.sh57
-rw-r--r--spec/features/projects/badges/pipeline_badge_spec.rb11
-rw-r--r--spec/models/merge_request_diff_spec.rb38
-rw-r--r--spec/models/merge_request_spec.rb30
-rw-r--r--spec/requests/api/issues/get_project_issues_spec.rb18
-rw-r--r--spec/requests/api/issues/issues_spec.rb2
-rw-r--r--spec/services/metrics/dashboard/system_dashboard_service_spec.rb16
-rw-r--r--spec/support/helpers/metrics_dashboard_helpers.rb11
34 files changed, 202 insertions, 179 deletions
diff --git a/app/assets/javascripts/environments/folder/environments_folder_view.vue b/app/assets/javascripts/environments/folder/environments_folder_view.vue
index 6fd0561f682..d60c2efd618 100644
--- a/app/assets/javascripts/environments/folder/environments_folder_view.vue
+++ b/app/assets/javascripts/environments/folder/environments_folder_view.vue
@@ -40,13 +40,13 @@ export default {
<div :class="cssContainerClass">
<stop-environment-modal :environment="environmentInStopModal" />
- <div v-if="!isLoading" class="top-area">
- <h4 class="js-folder-name environments-folder-name">
- {{ s__('Environments|Environments') }} /
- <b>{{ folderName }}</b>
- </h4>
+ <h4 class="js-folder-name environments-folder-name">
+ {{ s__('Environments|Environments') }} /
+ <b>{{ folderName }}</b>
+ </h4>
- <tabs :tabs="tabs" scope="environments" @onChangeTab="onChangeTab" />
+ <div class="top-area">
+ <tabs v-if="!isLoading" :tabs="tabs" scope="environments" @onChangeTab="onChangeTab" />
</div>
<container
diff --git a/app/assets/stylesheets/pages/environments.scss b/app/assets/stylesheets/pages/environments.scss
index 93dffb5ff09..3892d9dbd07 100644
--- a/app/assets/stylesheets/pages/environments.scss
+++ b/app/assets/stylesheets/pages/environments.scss
@@ -7,7 +7,6 @@
.environments-folder-name {
font-weight: $gl-font-weight-normal;
- padding-top: 20px;
}
.environments-container {
diff --git a/app/models/ci/build_trace_section.rb b/app/models/ci/build_trace_section.rb
index 7fe6b753da1..8be42eb48d6 100644
--- a/app/models/ci/build_trace_section.rb
+++ b/app/models/ci/build_trace_section.rb
@@ -4,9 +4,6 @@ module Ci
class BuildTraceSection < ApplicationRecord
extend Gitlab::Ci::Model
- # Only remove > 2019-11-22 and > 12.5
- self.ignored_columns += %i[id]
-
belongs_to :build, class_name: 'Ci::Build'
belongs_to :project
belongs_to :section_name, class_name: 'Ci::BuildTraceSectionName'
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 93234cbdfe1..16d36d42eac 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -420,15 +420,6 @@ class MergeRequest < ApplicationRecord
limit ? shas.take(limit) : shas
end
- # Returns true if there are commits that match at least one commit SHA.
- def includes_any_commits?(shas)
- if persisted?
- merge_request_diff.commits_by_shas(shas).exists?
- else
- (commit_shas & shas).present?
- end
- end
-
def supports_suggestion?
true
end
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb
index e91a529fecc..06a9a6ee873 100644
--- a/app/models/merge_request_diff.rb
+++ b/app/models/merge_request_diff.rb
@@ -10,6 +10,7 @@ class MergeRequestDiff < ApplicationRecord
# Don't display more than 100 commits at once
COMMITS_SAFE_SIZE = 100
+ BATCH_SIZE = 1000
# Applies to closed or merged MRs when determining whether to migrate their
# diffs to external storage
@@ -254,10 +255,14 @@ class MergeRequestDiff < ApplicationRecord
merge_request_diff_commits.limit(limit).pluck(:sha)
end
- def commits_by_shas(shas)
- return MergeRequestDiffCommit.none unless shas.present?
+ def includes_any_commits?(shas)
+ return false if shas.blank?
- merge_request_diff_commits.where(sha: shas)
+ # when the number of shas is huge (1000+) we don't want
+ # to pass them all as an SQL param, let's pass them in batches
+ shas.each_slice(BATCH_SIZE).any? do |batched_shas|
+ merge_request_diff_commits.where(sha: batched_shas).exists?
+ end
end
def diff_refs=(new_diff_refs)
diff --git a/app/models/project.rb b/app/models/project.rb
index 0887e742d96..67225d7fb78 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -62,20 +62,6 @@ class Project < ApplicationRecord
cache_markdown_field :description, pipeline: :description
- delegate :feature_available?, :builds_enabled?, :wiki_enabled?, :merge_requests_enabled?,
- :issues_enabled?, :pages_enabled?, :public_pages?, :private_pages?,
- :merge_requests_access_level, :issues_access_level, :wiki_access_level,
- :snippets_access_level, :builds_access_level, :repository_access_level,
- to: :project_feature, allow_nil: true
-
- delegate :base_dir, :disk_path, to: :storage
-
- delegate :scheduled?, :started?, :in_progress?,
- :failed?, :finished?,
- prefix: :import, to: :import_state, allow_nil: true
-
- delegate :no_import?, to: :import_state, allow_nil: true
-
# TODO: remove once GitLab 12.5 is released
# https://gitlab.com/gitlab-org/gitlab/issues/34638
self.ignored_columns += %i[merge_requests_require_code_owner_approval]
@@ -323,6 +309,15 @@ class Project < ApplicationRecord
accepts_nested_attributes_for :metrics_setting, update_only: true, allow_destroy: true
accepts_nested_attributes_for :grafana_integration, update_only: true, allow_destroy: true
+ delegate :feature_available?, :builds_enabled?, :wiki_enabled?, :merge_requests_enabled?,
+ :issues_enabled?, :pages_enabled?, :public_pages?, :private_pages?,
+ :merge_requests_access_level, :issues_access_level, :wiki_access_level,
+ :snippets_access_level, :builds_access_level, :repository_access_level,
+ to: :project_feature, allow_nil: true
+ delegate :scheduled?, :started?, :in_progress?, :failed?, :finished?,
+ prefix: :import, to: :import_state, allow_nil: true
+ delegate :base_dir, :disk_path, to: :storage
+ delegate :no_import?, to: :import_state, allow_nil: true
delegate :name, to: :owner, allow_nil: true, prefix: true
delegate :members, to: :team, prefix: true
delegate :add_user, :add_users, to: :team
diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb
index bd3fcf85a62..396ddec6383 100644
--- a/app/services/merge_requests/refresh_service.rb
+++ b/app/services/merge_requests/refresh_service.rb
@@ -106,7 +106,7 @@ module MergeRequests
filter_merge_requests(merge_requests).each do |merge_request|
if branch_and_project_match?(merge_request) || @push.force_push?
merge_request.reload_diff(current_user)
- elsif merge_request.includes_any_commits?(push_commit_ids)
+ elsif merge_request.merge_request_diff.includes_any_commits?(push_commit_ids)
merge_request.reload_diff(current_user)
end
diff --git a/app/services/metrics/dashboard/base_embed_service.rb b/app/services/metrics/dashboard/base_embed_service.rb
index 8bb5f4892cb..8aef9873ac1 100644
--- a/app/services/metrics/dashboard/base_embed_service.rb
+++ b/app/services/metrics/dashboard/base_embed_service.rb
@@ -13,7 +13,7 @@ module Metrics
def dashboard_path
params[:dashboard_path].presence ||
- ::Metrics::Dashboard::SystemDashboardService::SYSTEM_DASHBOARD_PATH
+ ::Metrics::Dashboard::SystemDashboardService::DASHBOARD_PATH
end
def group
diff --git a/app/services/metrics/dashboard/custom_metric_embed_service.rb b/app/services/metrics/dashboard/custom_metric_embed_service.rb
index 79a556b1695..9e616f4e379 100644
--- a/app/services/metrics/dashboard/custom_metric_embed_service.rb
+++ b/app/services/metrics/dashboard/custom_metric_embed_service.rb
@@ -40,7 +40,7 @@ module Metrics
# All custom metrics are displayed on the system dashboard.
# Nil is acceptable as we'll default to the system dashboard.
def valid_dashboard?(dashboard)
- dashboard.nil? || ::Metrics::Dashboard::SystemDashboardService.system_dashboard?(dashboard)
+ dashboard.nil? || ::Metrics::Dashboard::SystemDashboardService.matching_dashboard?(dashboard)
end
end
diff --git a/app/services/metrics/dashboard/predefined_dashboard_service.rb b/app/services/metrics/dashboard/predefined_dashboard_service.rb
new file mode 100644
index 00000000000..1be1a000854
--- /dev/null
+++ b/app/services/metrics/dashboard/predefined_dashboard_service.rb
@@ -0,0 +1,45 @@
+# frozen_string_literal: true
+
+module Metrics
+ module Dashboard
+ class PredefinedDashboardService < ::Metrics::Dashboard::BaseService
+ # These constants should be overridden in the inheriting class. For Ex:
+ # DASHBOARD_PATH = 'config/prometheus/common_metrics.yml'
+ # DASHBOARD_NAME = 'Default'
+ DASHBOARD_PATH = nil
+ DASHBOARD_NAME = nil
+
+ SEQUENCE = [
+ STAGES::EndpointInserter,
+ STAGES::Sorter
+ ].freeze
+
+ class << self
+ def matching_dashboard?(filepath)
+ filepath == self::DASHBOARD_PATH
+ end
+ end
+
+ private
+
+ def cache_key
+ "metrics_dashboard_#{dashboard_path}"
+ end
+
+ def dashboard_path
+ self.class::DASHBOARD_PATH
+ end
+
+ # Returns the base metrics shipped with every GitLab service.
+ def get_raw_dashboard
+ yml = File.read(Rails.root.join(dashboard_path))
+
+ YAML.safe_load(yml)
+ end
+
+ def sequence
+ self.class::SEQUENCE
+ end
+ end
+ end
+end
diff --git a/app/services/metrics/dashboard/system_dashboard_service.rb b/app/services/metrics/dashboard/system_dashboard_service.rb
index f8dbb8a705c..bef65dbe1c2 100644
--- a/app/services/metrics/dashboard/system_dashboard_service.rb
+++ b/app/services/metrics/dashboard/system_dashboard_service.rb
@@ -1,12 +1,12 @@
# frozen_string_literal: true
# Fetches the system metrics dashboard and formats the output.
-# Use Gitlab::Metrics::Dashboard::Finder to retrive dashboards.
+# Use Gitlab::Metrics::Dashboard::Finder to retrieve dashboards.
module Metrics
module Dashboard
- class SystemDashboardService < ::Metrics::Dashboard::BaseService
- SYSTEM_DASHBOARD_PATH = 'config/prometheus/common_metrics.yml'
- SYSTEM_DASHBOARD_NAME = 'Default'
+ class SystemDashboardService < ::Metrics::Dashboard::PredefinedDashboardService
+ DASHBOARD_PATH = 'config/prometheus/common_metrics.yml'
+ DASHBOARD_NAME = 'Default'
SEQUENCE = [
STAGES::CommonMetricsInserter,
@@ -18,37 +18,12 @@ module Metrics
class << self
def all_dashboard_paths(_project)
[{
- path: SYSTEM_DASHBOARD_PATH,
- display_name: SYSTEM_DASHBOARD_NAME,
+ path: DASHBOARD_PATH,
+ display_name: DASHBOARD_NAME,
default: true,
system_dashboard: true
}]
end
-
- def system_dashboard?(filepath)
- filepath == SYSTEM_DASHBOARD_PATH
- end
- end
-
- private
-
- def cache_key
- "metrics_dashboard_#{dashboard_path}"
- end
-
- def dashboard_path
- SYSTEM_DASHBOARD_PATH
- end
-
- # Returns the base metrics shipped with every GitLab service.
- def get_raw_dashboard
- yml = File.read(Rails.root.join(dashboard_path))
-
- YAML.safe_load(yml)
- end
-
- def sequence
- SEQUENCE
end
end
end
diff --git a/app/views/projects/environments/folder.html.haml b/app/views/projects/environments/folder.html.haml
index f85c57d9aa1..cd24c30e46f 100644
--- a/app/views/projects/environments/folder.html.haml
+++ b/app/views/projects/environments/folder.html.haml
@@ -1,3 +1,5 @@
-- page_title _("Environments")
+- add_to_breadcrumbs _("Environments"), project_environments_path(@project)
+- breadcrumb_title _("Folder/%{name}") % { name: @folder }
+- page_title _("Environments in %{name}") % { name: @folder }
#environments-folder-list-view{ data: { environments_data: environments_folder_list_view_data } }
diff --git a/changelogs/unreleased/32470-ui-degradation-on-environment-folder-view.yml b/changelogs/unreleased/32470-ui-degradation-on-environment-folder-view.yml
new file mode 100644
index 00000000000..63482f7be68
--- /dev/null
+++ b/changelogs/unreleased/32470-ui-degradation-on-environment-folder-view.yml
@@ -0,0 +1,5 @@
+---
+title: Fix broken UI on Environment folder
+merge_request: 17427
+author: Takuya Noguchi
+type: fixed
diff --git a/changelogs/unreleased/expose_moved_to_in_issues_api.yml b/changelogs/unreleased/expose_moved_to_in_issues_api.yml
new file mode 100644
index 00000000000..fc2881532c4
--- /dev/null
+++ b/changelogs/unreleased/expose_moved_to_in_issues_api.yml
@@ -0,0 +1,5 @@
+---
+title: Expose moved_to_id in issues API
+merge_request: 20083
+author: Lee Tickett
+type: added
diff --git a/changelogs/unreleased/remove_build_badge_path_from_route.yml b/changelogs/unreleased/remove_build_badge_path_from_route.yml
new file mode 100644
index 00000000000..9624c2d432b
--- /dev/null
+++ b/changelogs/unreleased/remove_build_badge_path_from_route.yml
@@ -0,0 +1,5 @@
+---
+title: Remove build badge path from route
+merge_request: 20188
+author: Lee Tickett
+type: other
diff --git a/config/routes/project.rb b/config/routes/project.rb
index 00d674575c4..5b1a0d2bb7a 100644
--- a/config/routes/project.rb
+++ b/config/routes/project.rb
@@ -494,8 +494,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
collection do
scope '*ref', constraints: { ref: Gitlab::PathRegex.git_reference_regex } do
constraints format: /svg/ do
- # Keep around until 10.0, see gitlab-org/gitlab-ce#35307
- get :build, to: "badges#pipeline"
get :pipeline
get :coverage
end
diff --git a/danger/changes_size/Dangerfile b/danger/changes_size/Dangerfile
index 941afeeba64..2c1d59427af 100644
--- a/danger/changes_size/Dangerfile
+++ b/danger/changes_size/Dangerfile
@@ -1,7 +1,7 @@
# FIXME: git.info_for_file raises the following error
# /usr/local/bundle/gems/git-1.4.0/lib/git/lib.rb:956:in `command': (Danger::DSLError)
# [!] Invalid `Dangerfile` file:
-# [!] Invalid `Dangerfile` file: git '--git-dir=/builds/gitlab-org/gitlab-foss/.git' '--work-tree=/builds/gitlab-org/gitlab-foss' cat-file '-t' '' 2>&1:fatal: Not a valid object name
+# [!] Invalid `Dangerfile` file: git '--git-dir=/builds/gitlab-org/gitlab/.git' '--work-tree=/builds/gitlab-org/gitlab' cat-file '-t' '' 2>&1:fatal: Not a valid object name
# This seems to be the same as https://github.com/danger/danger/issues/535.
# locale_files_updated = git.modified_files.select { |path| path.start_with?('locale') }
diff --git a/danger/database/Dangerfile b/danger/database/Dangerfile
index fc6c5130fdc..56624c0b897 100644
--- a/danger/database/Dangerfile
+++ b/danger/database/Dangerfile
@@ -20,7 +20,7 @@ changes are reviewed, take the following steps:
1. Ensure the merge request has ~database and ~"database::review pending" labels.
If the merge request modifies database files, Danger will do this for you.
-1. Use the [Database changes checklist](https://gitlab.com/gitlab-org/gitlab-foss/blob/master/.gitlab/merge_request_templates/Database%20changes.md)
+1. Use the [Database changes checklist](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/merge_request_templates/Database%20changes.md)
template or add the appropriate items to the MR description.
1. Assign and mention the database reviewer suggested by Reviewer Roulette.
MSG
diff --git a/danger/roulette/Dangerfile b/danger/roulette/Dangerfile
index 42fc3831c14..173cf4e0ea2 100644
--- a/danger/roulette/Dangerfile
+++ b/danger/roulette/Dangerfile
@@ -27,7 +27,7 @@ UNKNOWN_FILES_MESSAGE = <<MARKDOWN
These files couldn't be categorised, so Danger was unable to suggest a reviewer.
Please consider creating a merge request to
-[add support](https://gitlab.com/gitlab-org/gitlab-foss/blob/master/lib/gitlab/danger/helper.rb)
+[add support](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/danger/helper.rb)
for them.
MARKDOWN
@@ -46,7 +46,7 @@ def spin_for_category(team, project, category, branch_name)
end
# TODO: take CODEOWNERS into account?
- # https://gitlab.com/gitlab-org/gitlab-foss/issues/57653
+ # https://gitlab.com/gitlab-org/gitlab/issues/26723
# Make traintainers have triple the chance to be picked as a reviewer
reviewer = roulette.spin_for_person(reviewers + traintainers + traintainers, random: random)
diff --git a/doc/api/issues.md b/doc/api/issues.md
index 54b27370741..29f9cb40e41 100644
--- a/doc/api/issues.md
+++ b/doc/api/issues.md
@@ -113,6 +113,7 @@ Example response:
"id" : 76,
"title" : "Consequatur vero maxime deserunt laboriosam est voluptas dolorem.",
"created_at" : "2016-01-04T15:31:51.081Z",
+ "moved_to_id" : null,
"iid" : 6,
"labels" : ["foo", "bar"],
"upvotes": 4,
diff --git a/doc/user/project/releases/index.md b/doc/user/project/releases/index.md
index 8372aefc94c..9b7b20be98f 100644
--- a/doc/user/project/releases/index.md
+++ b/doc/user/project/releases/index.md
@@ -147,7 +147,7 @@ You can also edit an existing tag to add release notes:
## Release Evidence
-> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/26019) in GitLab 12.5.
+> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/26019) in GitLab 12.6.
Each time a new release is created, specific related data is collected in
parallel. This dataset will be a snapshot this new release (including linked
@@ -155,7 +155,7 @@ milestones and issues) at moment of creation. Such collection of data will
provide a chain of custody and facilitate processes like external audits, for example.
The gathered Evidence data is stored in the database upon creation of a new
-release as a JSON object. In GitLab 12.5, a link to
+release as a JSON object. In GitLab 12.6, a link to
the Evidence data is provided for [each Release](#releases-list).
Here's what this object can look like:
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 21648b0f59a..6ca1d8bd483 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -660,6 +660,8 @@ module API
expose :subscribed, if: -> (_, options) { options.fetch(:include_subscribed, true) } do |issue, options|
issue.subscribed?(options[:current_user], options[:project] || issue.project)
end
+
+ expose :moved_to_id
end
class IssuableTimeStats < Grape::Entity
diff --git a/lib/gitlab/danger/helper.rb b/lib/gitlab/danger/helper.rb
index 0e7e0c40a8a..cd7d617509b 100644
--- a/lib/gitlab/danger/helper.rb
+++ b/lib/gitlab/danger/helper.rb
@@ -153,7 +153,10 @@ module Gitlab
# Fallbacks in case the above patterns miss anything
%r{\.rb\z} => :backend,
- %r{\.(md|txt)\z} => :none, # To reinstate roulette for documentation, set to `:docs`.
+ %r{(
+ \.(md|txt)\z |
+ \.markdownlint\.json
+ )}x => :none, # To reinstate roulette for documentation, set to `:docs`.
%r{\.js\z} => :frontend
}.freeze
diff --git a/lib/gitlab/metrics/dashboard/service_selector.rb b/lib/gitlab/metrics/dashboard/service_selector.rb
index aee7f6685ad..22314c2a0ee 100644
--- a/lib/gitlab/metrics/dashboard/service_selector.rb
+++ b/lib/gitlab/metrics/dashboard/service_selector.rb
@@ -34,7 +34,7 @@ module Gitlab
end
def system_dashboard?(filepath)
- SERVICES::SystemDashboardService.system_dashboard?(filepath)
+ SERVICES::SystemDashboardService.matching_dashboard?(filepath)
end
def custom_metric_embed?(params)
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 37209f0054e..3ff2257d2e5 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -6500,6 +6500,9 @@ msgstr ""
msgid "Environments allow you to track deployments of your application %{link_to_read_more}."
msgstr ""
+msgid "Environments in %{name}"
+msgstr ""
+
msgid "EnvironmentsDashboard|Add a project to the dashboard"
msgstr ""
@@ -7651,6 +7654,9 @@ msgstr ""
msgid "FogBugz import"
msgstr ""
+msgid "Folder/%{name}"
+msgstr ""
+
msgid "Follow the steps below to export your Google Code project data."
msgstr ""
diff --git a/scripts/review_apps/base-config.yaml b/scripts/review_apps/base-config.yaml
index 7aaa7544c19..407014858b4 100644
--- a/scripts/review_apps/base-config.yaml
+++ b/scripts/review_apps/base-config.yaml
@@ -26,6 +26,8 @@ gitlab:
mailroom:
enabled: false
migrations:
+ initialRootPassword:
+ secret: shared-gitlab-initial-root-password
resources:
requests:
cpu: 350m
diff --git a/scripts/review_apps/review-apps.sh b/scripts/review_apps/review-apps.sh
index 1d87b64168c..1c33bff719d 100755
--- a/scripts/review_apps/review-apps.sh
+++ b/scripts/review_apps/review-apps.sh
@@ -197,39 +197,33 @@ function install_external_dns() {
function create_application_secret() {
local namespace="${KUBE_NAMESPACE}"
local release="${CI_ENVIRONMENT_SLUG}"
-
- echoinfo "Creating the ${release}-gitlab-initial-root-password secret in the ${namespace} namespace..." true
-
- kubectl create secret generic --namespace "${namespace}" \
- "${release}-gitlab-initial-root-password" \
- --from-literal="password=${REVIEW_APPS_ROOT_PASSWORD}" \
- --dry-run -o json | kubectl apply -f -
+ local initial_root_password_shared_secret
+ local gitlab_license_shared_secret
+
+ initial_root_password_shared_secret=$(kubectl get secret --namespace ${namespace} --no-headers -o=custom-columns=NAME:.metadata.name shared-gitlab-initial-root-password | tail -n 1)
+ if [[ "${initial_root_password_shared_secret}" == "" ]]; then
+ echoinfo "Creating the 'shared-gitlab-initial-root-password' secret in the ${namespace} namespace..." true
+ kubectl create secret generic --namespace "${namespace}" \
+ "shared-gitlab-initial-root-password" \
+ --from-literal="password=${REVIEW_APPS_ROOT_PASSWORD}" \
+ --dry-run -o json | kubectl apply -f -
+ else
+ echoinfo "The 'shared-gitlab-initial-root-password' secret already exists in the ${namespace} namespace."
+ fi
if [ -z "${REVIEW_APPS_EE_LICENSE}" ]; then echo "License not found" && return; fi
- echoinfo "Creating the ${release}-gitlab-license secret in the ${namespace} namespace..." true
-
- echo "${REVIEW_APPS_EE_LICENSE}" > /tmp/license.gitlab
-
- kubectl create secret generic --namespace "${namespace}" \
- "${release}-gitlab-license" \
- --from-file=license=/tmp/license.gitlab \
- --dry-run -o json | kubectl apply -f -
-}
-
-function label_application_secret() {
- local namespace="${KUBE_NAMESPACE}"
- local release="${CI_ENVIRONMENT_SLUG}"
-
- echoinfo "Labeling the ${release}-gitlab-initial-root-password and ${release}-gitlab-license secrets in the ${namespace} namespace..." true
-
- kubectl label secret --namespace "${namespace}" \
- "${release}-gitlab-initial-root-password" \
- release="${release}"
-
- kubectl label secret --namespace "${namespace}" \
- "${release}-gitlab-license" \
- release="${release}"
+ gitlab_license_shared_secret=$(kubectl get secret --namespace ${namespace} --no-headers -o=custom-columns=NAME:.metadata.name shared-gitlab-license | tail -n 1)
+ if [[ "${gitlab_license_shared_secret}" == "" ]]; then
+ echoinfo "Creating the 'shared-gitlab-license' secret in the ${namespace} namespace..." true
+ echo "${REVIEW_APPS_EE_LICENSE}" > /tmp/license.gitlab
+ kubectl create secret generic --namespace "${namespace}" \
+ "shared-gitlab-license" \
+ --from-file=license=/tmp/license.gitlab \
+ --dry-run -o json | kubectl apply -f -
+ else
+ echoinfo "The 'shared-gitlab-license' secret already exists in the ${namespace} namespace."
+ fi
}
function download_chart() {
@@ -272,7 +266,6 @@ function deploy() {
gitlab_workhorse_image_repository="${IMAGE_REPOSITORY}/gitlab-workhorse-${edition}"
create_application_secret
- label_application_secret
HELM_CMD=$(cat << EOF
helm upgrade \
@@ -308,7 +301,7 @@ EOF
if [ -n "${REVIEW_APPS_EE_LICENSE}" ]; then
HELM_CMD=$(cat << EOF
${HELM_CMD} \
- --set global.gitlab.license.secret="${release}-gitlab-license"
+ --set global.gitlab.license.secret="shared-gitlab-license"
EOF
)
fi
diff --git a/spec/features/projects/badges/pipeline_badge_spec.rb b/spec/features/projects/badges/pipeline_badge_spec.rb
index af936c80886..5ddaf1e1591 100644
--- a/spec/features/projects/badges/pipeline_badge_spec.rb
+++ b/spec/features/projects/badges/pipeline_badge_spec.rb
@@ -6,17 +6,6 @@ describe 'Pipeline Badge' do
set(:project) { create(:project, :repository, :public) }
let(:ref) { project.default_branch }
- # this can't be tested in the controller, as it bypasses the rails router
- # and constructs a route based on the controller being tested
- # Keep around until 10.0, see gitlab-org/gitlab-ce#35307
- context 'when the deprecated badge is requested' do
- it 'displays the badge' do
- visit build_project_badges_path(project, ref: ref, format: :svg)
-
- expect(page.status_code).to eq(200)
- end
- end
-
context 'when the project has a pipeline' do
let!(:pipeline) { create(:ci_empty_pipeline, project: project, ref: ref, sha: project.commit(ref).sha) }
let!(:job) { create(:ci_build, pipeline: pipeline) }
diff --git a/spec/models/merge_request_diff_spec.rb b/spec/models/merge_request_diff_spec.rb
index b5404658a69..0fbe4903b6d 100644
--- a/spec/models/merge_request_diff_spec.rb
+++ b/spec/models/merge_request_diff_spec.rb
@@ -426,24 +426,38 @@ describe MergeRequestDiff do
end
end
- describe '#commits_by_shas' do
- let(:commit_shas) { diff_with_commits.commit_shas }
-
- it 'returns empty if no SHAs were provided' do
- expect(diff_with_commits.commits_by_shas([])).to be_empty
+ describe '#includes_any_commits?' do
+ let(:non_existent_shas) do
+ Array.new(30) { Digest::SHA1.hexdigest(SecureRandom.hex) }
end
- it 'returns one SHA' do
- commits = diff_with_commits.commits_by_shas([commit_shas.first, Gitlab::Git::BLANK_SHA])
+ subject { diff_with_commits }
+
+ context 'processes the passed shas in batches' do
+ context 'number of existing commits is greater than batch size' do
+ it 'performs a separate request for each batch' do
+ stub_const('MergeRequestDiff::BATCH_SIZE', 5)
+
+ commit_shas = subject.commit_shas
+
+ query_count = ActiveRecord::QueryRecorder.new do
+ subject.includes_any_commits?(non_existent_shas + commit_shas)
+ end.count
+
+ expect(query_count).to eq(7)
+ end
+ end
+ end
- expect(commits.count).to eq(1)
+ it 'returns false if passed commits do not exist' do
+ expect(subject.includes_any_commits?([])).to eq(false)
+ expect(subject.includes_any_commits?([Gitlab::Git::BLANK_SHA])).to eq(false)
end
- it 'returns all matching SHAs' do
- commits = diff_with_commits.commits_by_shas(commit_shas)
+ it 'returns true if passed commits exists' do
+ args_with_existing_commits = non_existent_shas << subject.head_commit_sha
- expect(commits.count).to eq(commit_shas.count)
- expect(commits.map(&:sha)).to match_array(commit_shas)
+ expect(subject.includes_any_commits?(args_with_existing_commits)).to eq(true)
end
end
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index 53d67113f9e..79ea29c84a4 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -3134,36 +3134,6 @@ describe MergeRequest do
end
end
- describe '#includes_any_commits?' do
- it 'returns false' do
- expect(subject.includes_any_commits?([])).to be_falsey
- end
-
- it 'returns false' do
- expect(subject.includes_any_commits?([Gitlab::Git::BLANK_SHA])).to be_falsey
- end
-
- it 'returns true' do
- expect(subject.includes_any_commits?([subject.merge_request_diff.head_commit_sha])).to be_truthy
- end
-
- it 'returns true even when there is a non-existent comit' do
- expect(subject.includes_any_commits?([Gitlab::Git::BLANK_SHA, subject.merge_request_diff.head_commit_sha])).to be_truthy
- end
-
- context 'unpersisted merge request' do
- let(:new_mr) { build(:merge_request) }
-
- it 'returns false' do
- expect(new_mr.includes_any_commits?([Gitlab::Git::BLANK_SHA])).to be_falsey
- end
-
- it 'returns true' do
- expect(new_mr.includes_any_commits?([subject.merge_request_diff.head_commit_sha])).to be_truthy
- end
- end
- end
-
describe '#can_allow_collaboration?' do
let(:target_project) { create(:project, :public) }
let(:source_project) { fork_project(target_project) }
diff --git a/spec/requests/api/issues/get_project_issues_spec.rb b/spec/requests/api/issues/get_project_issues_spec.rb
index 06a43ea6b02..59aeb91edd2 100644
--- a/spec/requests/api/issues/get_project_issues_spec.rb
+++ b/spec/requests/api/issues/get_project_issues_spec.rb
@@ -589,6 +589,24 @@ describe API::Issues do
expect(json_response['subscribed']).to be_truthy
end
+ context "moved_to_id" do
+ let(:moved_issue) do
+ create(:closed_issue, project: project, moved_to: issue)
+ end
+
+ it 'returns null when not moved' do
+ get api("/projects/#{project.id}/issues/#{issue.iid}", user)
+
+ expect(json_response['moved_to_id']).to be_nil
+ end
+
+ it 'returns issue id when moved' do
+ get api("/projects/#{project.id}/issues/#{moved_issue.iid}", user)
+
+ expect(json_response['moved_to_id']).to eq(issue.id)
+ end
+ end
+
it 'exposes the closed_at attribute' do
get api("/projects/#{project.id}/issues/#{closed_issue.iid}", user)
diff --git a/spec/requests/api/issues/issues_spec.rb b/spec/requests/api/issues/issues_spec.rb
index 61a94b682be..50a0a80b542 100644
--- a/spec/requests/api/issues/issues_spec.rb
+++ b/spec/requests/api/issues/issues_spec.rb
@@ -832,7 +832,7 @@ describe API::Issues do
end
context 'when issue does not exist' do
- it 'returns 404 when trying to move an issue' do
+ it 'returns 404 when trying to delete an issue' do
delete api("/projects/#{project.id}/issues/123", user)
expect(response).to have_gitlab_http_status(404)
diff --git a/spec/services/metrics/dashboard/system_dashboard_service_spec.rb b/spec/services/metrics/dashboard/system_dashboard_service_spec.rb
index ec861465662..95c5a1479a4 100644
--- a/spec/services/metrics/dashboard/system_dashboard_service_spec.rb
+++ b/spec/services/metrics/dashboard/system_dashboard_service_spec.rb
@@ -14,24 +14,18 @@ describe Metrics::Dashboard::SystemDashboardService, :use_clean_rails_memory_sto
end
describe 'get_dashboard' do
- let(:dashboard_path) { described_class::SYSTEM_DASHBOARD_PATH }
+ let(:dashboard_path) { described_class::DASHBOARD_PATH }
let(:service_params) { [project, user, { environment: environment, dashboard_path: dashboard_path }] }
let(:service_call) { described_class.new(*service_params).get_dashboard }
it_behaves_like 'valid dashboard service response'
it_behaves_like 'raises error for users with insufficient permissions'
-
- it 'caches the unprocessed dashboard for subsequent calls' do
- expect(YAML).to receive(:safe_load).once.and_call_original
-
- described_class.new(*service_params).get_dashboard
- described_class.new(*service_params).get_dashboard
- end
+ it_behaves_like 'caches the unprocessed dashboard for subsequent calls'
context 'when called with a non-system dashboard' do
let(:dashboard_path) { 'garbage/dashboard/path' }
- # We want to alwaus return the system dashboard.
+ # We want to always return the system dashboard.
it_behaves_like 'valid dashboard service response'
end
end
@@ -42,8 +36,8 @@ describe Metrics::Dashboard::SystemDashboardService, :use_clean_rails_memory_sto
expect(all_dashboards).to eq(
[{
- path: described_class::SYSTEM_DASHBOARD_PATH,
- display_name: described_class::SYSTEM_DASHBOARD_NAME,
+ path: described_class::DASHBOARD_PATH,
+ display_name: described_class::DASHBOARD_NAME,
default: true,
system_dashboard: true
}]
diff --git a/spec/support/helpers/metrics_dashboard_helpers.rb b/spec/support/helpers/metrics_dashboard_helpers.rb
index 0e86b6dfda7..98f235bdac4 100644
--- a/spec/support/helpers/metrics_dashboard_helpers.rb
+++ b/spec/support/helpers/metrics_dashboard_helpers.rb
@@ -19,7 +19,7 @@ module MetricsDashboardHelpers
end
def system_dashboard_path
- Metrics::Dashboard::SystemDashboardService::SYSTEM_DASHBOARD_PATH
+ Metrics::Dashboard::SystemDashboardService::DASHBOARD_PATH
end
def business_metric_title
@@ -53,6 +53,15 @@ module MetricsDashboardHelpers
it_behaves_like 'valid dashboard service response for schema'
end
+ shared_examples_for 'caches the unprocessed dashboard for subsequent calls' do
+ it do
+ expect(YAML).to receive(:safe_load).once.and_call_original
+
+ described_class.new(*service_params).get_dashboard
+ described_class.new(*service_params).get_dashboard
+ end
+ end
+
shared_examples_for 'valid embedded dashboard service response' do
let(:dashboard_schema) { JSON.parse(fixture_file('lib/gitlab/metrics/dashboard/schemas/embedded_dashboard.json')) }