summaryrefslogtreecommitdiff
path: root/app/models/concerns/ci
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/concerns/ci')
-rw-r--r--app/models/concerns/ci/contextable.rb16
-rw-r--r--app/models/concerns/ci/has_status.rb6
-rw-r--r--app/models/concerns/ci/has_variable.rb1
3 files changed, 9 insertions, 14 deletions
diff --git a/app/models/concerns/ci/contextable.rb b/app/models/concerns/ci/contextable.rb
index c8b55e7b39f..bdba2d3e251 100644
--- a/app/models/concerns/ci/contextable.rb
+++ b/app/models/concerns/ci/contextable.rb
@@ -20,7 +20,7 @@ module Ci
variables.concat(user_variables)
variables.concat(dependency_variables) if dependencies
variables.concat(secret_instance_variables)
- variables.concat(secret_group_variables)
+ variables.concat(secret_group_variables(environment: environment))
variables.concat(secret_project_variables(environment: environment))
variables.concat(trigger_request.user_variables) if trigger_request
variables.concat(pipeline.variables)
@@ -29,14 +29,6 @@ module Ci
end
##
- # Regular Ruby hash of scoped variables, without duplicates that are
- # possible to be present in an array of hashes returned from `variables`.
- #
- def scoped_variables_hash
- scoped_variables.to_hash
- end
-
- ##
# Variables that do not depend on the environment name.
#
def simple_variables
@@ -93,13 +85,13 @@ module Ci
project.ci_instance_variables_for(ref: git_ref)
end
- def secret_group_variables
+ def secret_group_variables(environment: expanded_environment_name)
return [] unless project.group
- project.group.ci_variables_for(git_ref, project)
+ project.group.ci_variables_for(git_ref, project, environment: environment)
end
- def secret_project_variables(environment: persisted_environment)
+ def secret_project_variables(environment: expanded_environment_name)
project.ci_variables_for(ref: git_ref, environment: environment)
end
diff --git a/app/models/concerns/ci/has_status.rb b/app/models/concerns/ci/has_status.rb
index 1cc2e8a51e3..0412f7a072b 100644
--- a/app/models/concerns/ci/has_status.rb
+++ b/app/models/concerns/ci/has_status.rb
@@ -20,9 +20,11 @@ module Ci
UnknownStatusError = Class.new(StandardError)
class_methods do
- def composite_status
+ # The parameter `project` is only used for the feature flag check, and will be removed with
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/321972
+ def composite_status(project: nil)
Gitlab::Ci::Status::Composite
- .new(all, with_allow_failure: columns_hash.key?('allow_failure'))
+ .new(all, with_allow_failure: columns_hash.key?('allow_failure'), project: project)
.status
end
diff --git a/app/models/concerns/ci/has_variable.rb b/app/models/concerns/ci/has_variable.rb
index 9bf2b409080..7309469c77e 100644
--- a/app/models/concerns/ci/has_variable.rb
+++ b/app/models/concerns/ci/has_variable.rb
@@ -16,6 +16,7 @@ module Ci
format: { with: /\A[a-zA-Z0-9_]+\z/,
message: "can contain only letters, digits and '_'." }
+ scope :by_key, -> (key) { where(key: key) }
scope :order_key_asc, -> { reorder(key: :asc) }
attr_encrypted :value,