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>2022-06-20 14:10:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 14:10:13 +0300
commit0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch)
tree7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /app/models/clusters
parent72123183a20411a36d607d70b12d57c484394c8e (diff)
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'app/models/clusters')
-rw-r--r--app/models/clusters/agent.rb8
-rw-r--r--app/models/clusters/applications/runner.rb2
-rw-r--r--app/models/clusters/cluster_enabled_grant.rb9
-rw-r--r--app/models/clusters/integrations/prometheus.rb18
4 files changed, 30 insertions, 7 deletions
diff --git a/app/models/clusters/agent.rb b/app/models/clusters/agent.rb
index 79fc2b58237..fb12ce7d292 100644
--- a/app/models/clusters/agent.rb
+++ b/app/models/clusters/agent.rb
@@ -10,8 +10,7 @@ module Clusters
belongs_to :created_by_user, class_name: 'User', optional: true
belongs_to :project, class_name: '::Project' # Otherwise, it will load ::Clusters::Project
- has_many :agent_tokens, class_name: 'Clusters::AgentToken'
- has_many :last_used_agent_tokens, -> { order_last_used_at_desc }, class_name: 'Clusters::AgentToken', inverse_of: :agent
+ has_many :agent_tokens, -> { order_last_used_at_desc }, class_name: 'Clusters::AgentToken', inverse_of: :agent
has_many :group_authorizations, class_name: 'Clusters::Agents::GroupAuthorization'
has_many :authorized_groups, class_name: '::Group', through: :group_authorizations, source: :group
@@ -23,6 +22,7 @@ module Clusters
scope :ordered_by_name, -> { order(:name) }
scope :with_name, -> (name) { where(name: name) }
+ scope :has_vulnerabilities, -> (value = true) { where(has_vulnerabilities: value) }
validates :name,
presence: true,
@@ -47,5 +47,9 @@ module Clusters
.offset(ACTIVITY_EVENT_LIMIT - 1)
.pick(:recorded_at)
end
+
+ def to_ability_name
+ :cluster
+ end
end
end
diff --git a/app/models/clusters/applications/runner.rb b/app/models/clusters/applications/runner.rb
index e62b6fa5fc5..bed0eab5a58 100644
--- a/app/models/clusters/applications/runner.rb
+++ b/app/models/clusters/applications/runner.rb
@@ -3,7 +3,7 @@
module Clusters
module Applications
class Runner < ApplicationRecord
- VERSION = '0.39.0'
+ VERSION = '0.41.0'
self.table_name = 'clusters_applications_runners'
diff --git a/app/models/clusters/cluster_enabled_grant.rb b/app/models/clusters/cluster_enabled_grant.rb
new file mode 100644
index 00000000000..4dca6a78759
--- /dev/null
+++ b/app/models/clusters/cluster_enabled_grant.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+module Clusters
+ class ClusterEnabledGrant < ApplicationRecord
+ self.table_name = 'cluster_enabled_grants'
+
+ belongs_to :namespace
+ end
+end
diff --git a/app/models/clusters/integrations/prometheus.rb b/app/models/clusters/integrations/prometheus.rb
index 8b21fa351a3..0d6177beae7 100644
--- a/app/models/clusters/integrations/prometheus.rb
+++ b/app/models/clusters/integrations/prometheus.rb
@@ -55,13 +55,23 @@ module Clusters
private
def activate_project_integrations
- ::Clusters::Applications::ActivateServiceWorker
- .perform_async(cluster_id, ::Integrations::Prometheus.to_param)
+ if Feature.enabled?(:rename_integrations_workers)
+ ::Clusters::Applications::ActivateIntegrationWorker
+ .perform_async(cluster_id, ::Integrations::Prometheus.to_param)
+ else
+ ::Clusters::Applications::ActivateServiceWorker
+ .perform_async(cluster_id, ::Integrations::Prometheus.to_param)
+ end
end
def deactivate_project_integrations
- ::Clusters::Applications::DeactivateServiceWorker
- .perform_async(cluster_id, ::Integrations::Prometheus.to_param)
+ if Feature.enabled?(:rename_integrations_workers)
+ ::Clusters::Applications::DeactivateIntegrationWorker
+ .perform_async(cluster_id, ::Integrations::Prometheus.to_param)
+ else
+ ::Clusters::Applications::DeactivateServiceWorker
+ .perform_async(cluster_id, ::Integrations::Prometheus.to_param)
+ end
end
end
end