summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 960795b73cb..7a5e980b783 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1828,11 +1828,16 @@ class Project < ApplicationRecord
end
def ci_variables_for(ref:, environment: nil)
- # EE would use the environment
- if protected_for?(ref)
- variables
+ result = if protected_for?(ref)
+ variables
+ else
+ variables.unprotected
+ end
+
+ if environment
+ result.on_environment(environment)
else
- variables.unprotected
+ result.where(environment_scope: '*')
end
end