summaryrefslogtreecommitdiff
path: root/app/models/ci
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-12-21 12:09:06 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-12-21 12:09:06 +0100
commit3deaf1342ec6bfe2122319329db8a8d4c8122e7e (patch)
tree452388bb0542452f7b7864fe849059875766b2b2 /app/models/ci
parent0dc5a21c9a7b78845c4e2ad1297a8a77c3dfb3e3 (diff)
parent09b622f84c83ea65c773ca4eb53d6899dc1c4956 (diff)
downloadgitlab-ce-3deaf1342ec6bfe2122319329db8a8d4c8122e7e.tar.gz
Merge branch 'master' into auto-pipelines-vue
* master: (367 commits) Set “Remove branch” button to default size remove unused helper method reduce common code even further to satisfy rake flay remove button class size alteration from revert and cherry pick links factor out common code to satisfy rake flay homogenize revert and cherry-pick button styles generated by commits_helper apply margin on alert banners only when there is one or more alerts Rename MattermostNotificationService back to MattermostService Rename SlackNotificationService back to SlackService Fix stage and pipeline specs and rubocop offenses Added QueryRecorder to test N+1 fix on Milestone#show Use gitlab-workhorse 1.2.1 Make 'unmarked as WIP' message more consistent Improve specs for Files API Allow unauthenticated access to Repositories Files API GET endpoints Add isolated view spec for pipeline stage partial Move test for HTML stage endpoint to controller specs Fix sizing of avatar circles; add border Fix broken test Fix broken test Changes after review ... Conflicts: app/assets/stylesheets/pages/pipelines.scss app/controllers/projects/pipelines_controller.rb app/views/projects/pipelines/index.html.haml spec/features/projects/pipelines/pipelines_spec.rb
Diffstat (limited to 'app/models/ci')
-rw-r--r--app/models/ci/build.rb5
-rw-r--r--app/models/ci/pipeline.rb5
-rw-r--r--app/models/ci/stage.rb4
3 files changed, 12 insertions, 2 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index fdbf28a1d68..cb76cdf5981 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -18,7 +18,7 @@ module Ci
end
serialize :options
- serialize :yaml_variables
+ serialize :yaml_variables, Gitlab::Serialize::Ci::Variables
validates :coverage, numericality: true, allow_blank: true
validates_presence_of :ref
@@ -155,7 +155,7 @@ module Ci
end
def has_environment?
- self.environment.present?
+ environment.present?
end
def starts_environment?
@@ -221,6 +221,7 @@ module Ci
variables += pipeline.predefined_variables
variables += runner.predefined_variables if runner
variables += project.container_registry_variables
+ variables += project.deployment_variables if has_environment?
variables += yaml_variables
variables += user_variables
variables += project.secret_variables
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 8d1ffdb76ee..44b737d7a69 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -116,6 +116,11 @@ module Ci
where.not(duration: nil).sum(:duration)
end
+ def stage(name)
+ stage = Ci::Stage.new(self, name: name)
+ stage unless stage.statuses_count.zero?
+ end
+
def stages_count
statuses.select(:stage).distinct.count
end
diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb
index 7ef59445d77..d035eda6df5 100644
--- a/app/models/ci/stage.rb
+++ b/app/models/ci/stage.rb
@@ -18,6 +18,10 @@ module Ci
name
end
+ def statuses_count
+ @statuses_count ||= statuses.count
+ end
+
def status
@status ||= statuses.latest.status
end