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
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-15 00:09:08 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-15 00:09:08 +0300
commit866ca4e49ff74ffadf8e6f6ff663a168489c2aba (patch)
treecc3135b1bae11dbd1cb3a30cb547473ad89a5551 /lib
parent26a50872e9da9509c52c70f74dc21698fec906db (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/group_export.rb2
-rw-r--r--lib/api/group_import.rb2
-rw-r--r--lib/api/pipeline_schedules.rb2
-rw-r--r--lib/api/project_container_repositories.rb4
-rw-r--r--lib/api/releases.rb4
-rw-r--r--lib/gitlab/background_migration/link_lfs_objects.rb48
-rw-r--r--lib/gitlab/ci/templates/Managed-Cluster-Applications.gitlab-ci.yml4
-rw-r--r--lib/gitlab/import_export/group_object_builder.rb9
8 files changed, 68 insertions, 7 deletions
diff --git a/lib/api/group_export.rb b/lib/api/group_export.rb
index 4d32212b8eb..6fe72458da2 100644
--- a/lib/api/group_export.rb
+++ b/lib/api/group_export.rb
@@ -27,7 +27,7 @@ module API
detail 'This feature was introduced in GitLab 12.5.'
end
post ':id/export' do
- GroupExportWorker.perform_async(current_user.id, user_group.id, params)
+ GroupExportWorker.perform_async(current_user.id, user_group.id, params) # rubocop:disable CodeReuse/Worker
accepted!
end
diff --git a/lib/api/group_import.rb b/lib/api/group_import.rb
index 3531abb2604..ed52506de14 100644
--- a/lib/api/group_import.rb
+++ b/lib/api/group_import.rb
@@ -76,7 +76,7 @@ module API
group = ::Groups::CreateService.new(current_user, group_params).execute
if group.persisted?
- GroupImportWorker.perform_async(current_user.id, group.id)
+ GroupImportWorker.perform_async(current_user.id, group.id) # rubocop:disable CodeReuse/Worker
accepted!
else
diff --git a/lib/api/pipeline_schedules.rb b/lib/api/pipeline_schedules.rb
index 61c40c54d69..445a37a70c0 100644
--- a/lib/api/pipeline_schedules.rb
+++ b/lib/api/pipeline_schedules.rb
@@ -120,7 +120,7 @@ module API
post ':id/pipeline_schedules/:pipeline_schedule_id/play' do
authorize! :play_pipeline_schedule, pipeline_schedule
- job_id = RunPipelineScheduleWorker
+ job_id = RunPipelineScheduleWorker # rubocop:disable CodeReuse/Worker
.perform_async(pipeline_schedule.id, current_user.id)
if job_id
diff --git a/lib/api/project_container_repositories.rb b/lib/api/project_container_repositories.rb
index e2963c0de22..70c913bea98 100644
--- a/lib/api/project_container_repositories.rb
+++ b/lib/api/project_container_repositories.rb
@@ -41,7 +41,7 @@ module API
delete ':id/registry/repositories/:repository_id', requirements: REPOSITORY_ENDPOINT_REQUIREMENTS do
authorize_admin_container_image!
- DeleteContainerRepositoryWorker.perform_async(current_user.id, repository.id)
+ DeleteContainerRepositoryWorker.perform_async(current_user.id, repository.id) # rubocop:disable CodeReuse/Worker
track_event('delete_repository')
status :accepted
@@ -79,8 +79,10 @@ module API
message = 'This request has already been made. You can run this at most once an hour for a given container repository'
render_api_error!(message, 400) unless obtain_new_cleanup_container_lease
+ # rubocop:disable CodeReuse/Worker
CleanupContainerRepositoryWorker.perform_async(current_user.id, repository.id,
declared_params.except(:repository_id).merge(container_expiration_policy: false))
+ # rubocop:enable CodeReuse/Worker
track_event('delete_tag_bulk')
diff --git a/lib/api/releases.rb b/lib/api/releases.rb
index b1f23d9837f..6e7a99bf0bb 100644
--- a/lib/api/releases.rb
+++ b/lib/api/releases.rb
@@ -170,9 +170,9 @@ module API
return if release.historical_release?
if release.upcoming_release?
- CreateEvidenceWorker.perform_at(release.released_at, release.id)
+ CreateEvidenceWorker.perform_at(release.released_at, release.id) # rubocop:disable CodeReuse/Worker
else
- CreateEvidenceWorker.perform_async(release.id)
+ CreateEvidenceWorker.perform_async(release.id) # rubocop:disable CodeReuse/Worker
end
end
end
diff --git a/lib/gitlab/background_migration/link_lfs_objects.rb b/lib/gitlab/background_migration/link_lfs_objects.rb
new file mode 100644
index 00000000000..014bebc4258
--- /dev/null
+++ b/lib/gitlab/background_migration/link_lfs_objects.rb
@@ -0,0 +1,48 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module BackgroundMigration
+ # Create missing LfsObjectsProject records for forks
+ class LinkLfsObjects
+ # Model definition used for migration
+ class ForkNetworkMember < ActiveRecord::Base
+ self.table_name = 'fork_network_members'
+
+ def self.with_non_existing_lfs_objects
+ joins('JOIN lfs_objects_projects lop ON fork_network_members.forked_from_project_id = lop.project_id')
+ .where(
+ <<~SQL
+ NOT EXISTS (
+ SELECT 1
+ FROM lfs_objects_projects
+ WHERE lfs_objects_projects.project_id = fork_network_members.project_id
+ AND lfs_objects_projects.lfs_object_id = lop.lfs_object_id
+ )
+ SQL
+ )
+ end
+ end
+
+ def perform(start_id, end_id)
+ select_query =
+ ForkNetworkMember
+ .select('lop.lfs_object_id, fork_network_members.project_id')
+ .with_non_existing_lfs_objects
+ .where(project_id: start_id..end_id)
+
+ return if select_query.empty?
+
+ execute <<-SQL
+ INSERT INTO lfs_objects_projects (lfs_object_id, project_id)
+ #{select_query.to_sql}
+ SQL
+ end
+
+ private
+
+ def execute(sql)
+ ::ActiveRecord::Base.connection.execute(sql)
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/ci/templates/Managed-Cluster-Applications.gitlab-ci.yml b/lib/gitlab/ci/templates/Managed-Cluster-Applications.gitlab-ci.yml
index a133c5e0485..73ae63c3092 100644
--- a/lib/gitlab/ci/templates/Managed-Cluster-Applications.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Managed-Cluster-Applications.gitlab-ci.yml
@@ -1,6 +1,6 @@
apply:
stage: deploy
- image: "registry.gitlab.com/gitlab-org/cluster-integration/cluster-applications:v0.7.0"
+ image: "registry.gitlab.com/gitlab-org/cluster-integration/cluster-applications:v0.8.0"
environment:
name: production
variables:
@@ -12,6 +12,8 @@ apply:
GITLAB_RUNNER_VALUES_FILE: $CI_PROJECT_DIR/.gitlab/managed-apps/gitlab-runner/values.yaml
CILIUM_VALUES_FILE: $CI_PROJECT_DIR/.gitlab/managed-apps/cilium/values.yaml
JUPYTERHUB_VALUES_FILE: $CI_PROJECT_DIR/.gitlab/managed-apps/jupyterhub/values.yaml
+ PROMETHEUS_VALUES_FILE: $CI_PROJECT_DIR/.gitlab/managed-apps/prometheus/values.yaml
+ ELASTIC_STACK_VALUES_FILE: $CI_PROJECT_DIR/.gitlab/managed-apps/elastic-stack/values.yaml
script:
- gitlab-managed-apps /usr/local/share/gitlab-managed-apps/helmfile.yaml
only:
diff --git a/lib/gitlab/import_export/group_object_builder.rb b/lib/gitlab/import_export/group_object_builder.rb
index fa426e32b60..9796bfa07d4 100644
--- a/lib/gitlab/import_export/group_object_builder.rb
+++ b/lib/gitlab/import_export/group_object_builder.rb
@@ -18,12 +18,21 @@ module Gitlab
super
@group = @attributes['group']
+
+ update_description
end
private
attr_reader :group
+ # Convert description empty string to nil
+ # due to existing object being saved with description: nil
+ # Which makes object lookup to fail since nil != ''
+ def update_description
+ attributes['description'] = nil if attributes['description'] == ''
+ end
+
def where_clauses
[
where_clause_base,