diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-10-12 11:52:54 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-10-12 11:52:54 +0200 |
commit | 419518df675019c3e82e15e287c496a51e06f1e4 (patch) | |
tree | 020080f2f8c870dacb795d0b6939b5c03ab52e20 /app/models/commit_status.rb | |
parent | 6f7afaa8a0b5594b88cb5a4a2fe2a822ee1334a9 (diff) | |
parent | d3a9838065ab4cd4d1519f6d201b43c9a2b12f2c (diff) | |
download | gitlab-ce-419518df675019c3e82e15e287c496a51e06f1e4.tar.gz |
Merge branch 'master' into feature/improve-mrwbs-and-todos-for-pipelines
* master: (221 commits)
Add CHANGELOG entry for 8.12.6
Added 'Download' button to snippet view
Merge branch 'api-fix-project-group-sharing' into 'security'
Add 8.12.5, 8.11.9, and 8.10.12 CHANGELOG entries
FIx JS bug with select2 because of missing `data-field` attribute in select box.
Remove pointless `.vagrant_enabled` file
allow multiple labels commands
Move some CHANGELOG entries to the 8.13.0 part
Move operations/ to new location
Move health check docs under user/admin_area/monitoring
Make guests unable to view MRs
Add examples of fake tokens to be used in docs
Remove duplicate CHANGELOG entry
Allow browsing branches that end with '.atom'
Refactor the SubGit/SVN documentation
Document the new CI_DEBUG_TRACE variable
Remove redundant images
changed the scss for the top line connectors to be exactly centered
Rearrange GitLab basics READMEs
New images for GitLab basics "Create MR" docs
...
Conflicts:
app/models/commit_status.rb
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r-- | app/models/commit_status.rb | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 3b575e5627d..aac5f7a5937 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -1,6 +1,7 @@ class CommitStatus < ActiveRecord::Base include HasStatus include Importable + include AfterCommitQueue self.table_name = 'ci_builds' @@ -85,21 +86,24 @@ class CommitStatus < ActiveRecord::Base end after_transition do |commit_status, transition| - commit_status.pipeline.try do |pipeline| - break if transition.loopback? - - if commit_status.complete? - PipelineProcessWorker.perform_async(pipeline.id) + return if transition.loopback? + + commit_status.run_after_commit do + pipeline.try do |pipeline| + if complete? + PipelineProcessWorker.perform_async(pipeline.id) + else + PipelineUpdateWorker.perform_async(pipeline.id) + end end - - PipelineUpdateWorker.perform_async(pipeline.id) end - - true end after_transition any => :failed do |commit_status| - MergeRequests::AddTodoWhenBuildFailsService.new(commit_status.pipeline.project, nil).execute(commit_status) + commit_status.run_after_commit do + MergeRequests::AddTodoWhenBuildFailsService + .new(pipeline.project, nil).execute(self) + end end end |