summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-11 15:08:39 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-11 15:08:39 +0000
commit4564f677f8d71e814e89618e81709c86cf50e3d2 (patch)
tree9ba8fffbd8b3ec3d40dc12bfc4132d842f789cfc /lib
parent0b54f87a31c23544ca5917bf772ce9c64a61562c (diff)
downloadgitlab-ce-4564f677f8d71e814e89618e81709c86cf50e3d2.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/entities/project.rb1
-rw-r--r--lib/api/environments.rb15
-rw-r--r--lib/api/metrics/user_starred_dashboards.rb4
-rw-r--r--lib/gitlab/database/load_balancing/service_discovery.rb9
-rw-r--r--lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb20
5 files changed, 13 insertions, 36 deletions
diff --git a/lib/api/entities/project.rb b/lib/api/entities/project.rb
index 06e636d0301..61feacd6586 100644
--- a/lib/api/entities/project.rb
+++ b/lib/api/entities/project.rb
@@ -112,7 +112,6 @@ module API
expose :ci_forward_deployment_enabled, documentation: { type: 'boolean' }
expose(:ci_job_token_scope_enabled, documentation: { type: 'boolean' }) { |p, _| p.ci_outbound_job_token_scope_enabled? }
expose :ci_separated_caches, documentation: { type: 'boolean' }
- expose :ci_opt_in_jwt, documentation: { type: 'boolean' }
expose :ci_allow_fork_pipelines_to_run_in_parent_project, documentation: { type: 'boolean' }
expose :build_git_strategy, documentation: { type: 'string', example: 'fetch' } do |project, options|
project.build_allow_git_fetch ? 'fetch' : 'clone'
diff --git a/lib/api/environments.rb b/lib/api/environments.rb
index 24339a1fe30..bb261079d2a 100644
--- a/lib/api/environments.rb
+++ b/lib/api/environments.rb
@@ -13,13 +13,6 @@ module API
urgency :low
MIN_SEARCH_LENGTH = 3
- # rubocop:disable Gitlab/DocUrl
- ENVIRONMENT_NAME_UPDATE_ERROR = <<~DESC
- Updating environment name was deprecated in GitLab 15.9 and to be removed in GitLab 16.0.
- For workaround, see [the documentation](https://docs.gitlab.com/ee/ci/environments/#rename-an-environment).
- For more information, see [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/338897)
- DESC
- # rubocop:enable Gitlab/DocUrl
params do
requires :id, types: [String, Integer], desc: 'The ID or URL-encoded path of the project owned by the authenticated user'
@@ -108,16 +101,8 @@ module API
update_params = declared_params(include_missing: false).extract!(:external_url, :tier)
- # For the transition period, we implicitly extract `:name` field.
- # This line should be removed when disallow_environment_name_update feature flag is removed.
- update_params[:name] = params[:name] if params[:name].present?
-
environment.assign_attributes(update_params)
- if environment.name_changed? && ::Feature.enabled?(:disallow_environment_name_update, user_project)
- render_api_error!(ENVIRONMENT_NAME_UPDATE_ERROR, 400)
- end
-
if environment.save
present environment, with: Entities::Environment, current_user: current_user
else
diff --git a/lib/api/metrics/user_starred_dashboards.rb b/lib/api/metrics/user_starred_dashboards.rb
index 0a91e914d52..b7fba2b6459 100644
--- a/lib/api/metrics/user_starred_dashboards.rb
+++ b/lib/api/metrics/user_starred_dashboards.rb
@@ -25,6 +25,8 @@ module API
end
post ':id/metrics/user_starred_dashboards' do
+ not_found! if Feature.enabled?(:remove_monitor_metrics)
+
result = ::Metrics::UsersStarredDashboards::CreateService.new(current_user, user_project, params[:dashboard_path]).execute
if result.success?
@@ -50,6 +52,8 @@ module API
end
delete ':id/metrics/user_starred_dashboards' do
+ not_found! if Feature.enabled?(:remove_monitor_metrics)
+
result = ::Metrics::UsersStarredDashboards::DeleteService.new(current_user, user_project, params[:dashboard_path]).execute
if result.success?
diff --git a/lib/gitlab/database/load_balancing/service_discovery.rb b/lib/gitlab/database/load_balancing/service_discovery.rb
index 5059b3b5c93..57a588db8a8 100644
--- a/lib/gitlab/database/load_balancing/service_discovery.rb
+++ b/lib/gitlab/database/load_balancing/service_discovery.rb
@@ -103,6 +103,15 @@ module Gitlab
# Slightly randomize the retry delay so that, in the case of a total
# dns outage, all starting services do not pressure the dns server at the same time.
sleep(rand(RETRY_DELAY_RANGE))
+ rescue Exception => error # rubocop:disable Lint/RescueException
+ # All exceptions are logged to find any pattern and solve https://gitlab.com/gitlab-org/gitlab/-/issues/364370
+ # This will be removed in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/120173
+ Gitlab::Database::LoadBalancing::Logger.error(
+ event: :service_discovery_unexpected_exception,
+ message: "Service discovery encountered an uncaught error: #{error.message}"
+ )
+
+ raise
end
interval
diff --git a/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb b/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb
index 2ca8cca363c..bb87104630c 100644
--- a/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb
+++ b/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb
@@ -159,8 +159,6 @@ module Gitlab
end
def options
- # Remove line below when FF `ci_pipeline_process_worker_dedup_until_executed` is removed
- return job_deduplication[:options] if job_deduplication[:options]
return {} unless worker_klass
return {} unless worker_klass.respond_to?(:get_deduplication_options)
@@ -202,8 +200,6 @@ module Gitlab
end
def strategy
- # Remove line below when FF `ci_pipeline_process_worker_dedup_until_executed` is removed
- return job_deduplication[:strategy] if job_deduplication[:strategy]
return DEFAULT_STRATEGY unless worker_klass
return DEFAULT_STRATEGY unless worker_klass.respond_to?(:idempotent?)
return STRATEGY_NONE unless worker_klass.deduplication_enabled?
@@ -211,22 +207,6 @@ module Gitlab
worker_klass.get_deduplicate_strategy
end
- # Returns the deduplicate settings stored in the job itself; remove this method
- # when FF `ci_pipeline_process_worker_dedup_until_executed` is removed
- def job_deduplication
- return {} unless job['deduplicate']
-
- # Sometimes this setting is returned with all string keys/values; we need
- # to ensure the keys and values of the hash are fully symbolized or numeric
- job['deduplicate'].deep_symbolize_keys.tap do |hash|
- hash[:strategy] = hash[:strategy]&.to_sym
- hash[:options]&.each do |k, v|
- hash[:options][k] = k == :ttl ? v.to_i : v.to_sym
- end
- end.compact
- end
- strong_memoize_attr :job_deduplication
-
def worker_class_name
job['class']
end