diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-11 18:37:36 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-11 19:19:32 +0200 |
commit | d983c5bd4671d989edf3741d0db0a54dcef9c3b6 (patch) | |
tree | ccd22f61b266ef0e0d012368ca8d763ec070ffbc /app | |
parent | 4c29c25497c9a20a5d1f57cd287123cd41edad96 (diff) | |
download | gitlab-ce-d983c5bd4671d989edf3741d0db0a54dcef9c3b6.tar.gz |
Verify the pipeline status after executing events on builds
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/pipeline.rb | 3 | ||||
-rw-r--r-- | app/models/commit_status.rb | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 718fe3290c1..8de799d6088 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -185,6 +185,7 @@ module Ci def process! Ci::ProcessPipelineService.new(project, user).execute(self) + reload_status! end @@ -195,7 +196,7 @@ module Ci end def reload_status! - statuses.reload + reload self.status = if yaml_errors.blank? statuses.latest.status || 'skipped' diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 20713314a25..3ab44461179 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -76,6 +76,12 @@ class CommitStatus < ActiveRecord::Base commit_status.pipeline.process! if commit_status.pipeline end + + around_transition any => [:pending, :running] do |commit_status, block| + block.call + + commit_status.pipeline.reload_status! if commit_status.pipeline + end end delegate :sha, :short_sha, to: :pipeline |