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:
authorFilipa Lacerda <filipa@gitlab.com>2018-07-04 20:10:37 +0300
committerFilipa Lacerda <filipa@gitlab.com>2018-07-04 20:10:37 +0300
commit116955c4533497e68abbddbace2eae0a07c98569 (patch)
tree8a3d10e7f6ac265d31da47ffe0c69f09c65c2f6b /app/models/project.rb
parentc0e50fdfc296777871f3cc2d417252f599f5fcfb (diff)
parent01248876d2a74e3a5eee5a55908c687da3b9600e (diff)
Merge branch '45739-add-metrics-to-operations-tab' into 'master'
Resolve "Add Metrics to Operations Tab" Closes #45739 See merge request gitlab-org/gitlab-ce!20025
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 7304ab7b909..8f40470de82 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1774,6 +1774,15 @@ class Project < ActiveRecord::Base
end
end
+ def default_environment
+ production_first = "(CASE WHEN name = 'production' THEN 0 ELSE 1 END), id ASC"
+
+ environments
+ .with_state(:available)
+ .reorder(production_first)
+ .first
+ end
+
def secret_variables_for(ref:, environment: nil)
# EE would use the environment
if protected_for?(ref)