diff options
author | Robert Speicher <robert@gitlab.com> | 2015-11-24 00:51:51 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-11-24 00:53:19 +0300 |
commit | 3017037fc7267705b9667f1690fa26558f17f31d (patch) | |
tree | 6dd270022a49bc53c304d6caa361cca93fc8fc79 /app | |
parent | 6c280423fbdda243ea67e17e161de13066c6efbf (diff) |
Merge branch 'ci-fix-500' into 'master'
Fix 500 when using CI
- Fix for Ci::Build state machine, allowing to process builds without the project
- Forcefully update builds that didn't want to update with state machine
- Fix saving GitLabCiService as Admin Template
Fixes #3556
See merge request !1873
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/build.rb | 2 | ||||
-rw-r--r-- | app/models/project_services/gitlab_ci_service.rb | 1 | ||||
-rw-r--r-- | app/workers/stuck_ci_builds_worker.rb | 3 |
3 files changed, 6 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index e78b154084b..52ce1b920fa 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -97,6 +97,8 @@ module Ci state_machine :status, initial: :pending do after_transition any => [:success, :failed, :canceled] do |build, transition| + return unless build.gl_project + project = build.project if project.web_hooks? diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb index 095d04e0df4..c5657b5070e 100644 --- a/app/models/project_services/gitlab_ci_service.rb +++ b/app/models/project_services/gitlab_ci_service.rb @@ -30,6 +30,7 @@ class GitlabCiService < CiService end def ensure_gitlab_ci_project + return unless project project.ensure_gitlab_ci_project end diff --git a/app/workers/stuck_ci_builds_worker.rb b/app/workers/stuck_ci_builds_worker.rb index ad02a3b16d9..4e5eddbaba1 100644 --- a/app/workers/stuck_ci_builds_worker.rb +++ b/app/workers/stuck_ci_builds_worker.rb @@ -14,5 +14,8 @@ class StuckCiBuildsWorker Rails.logger.debug "Dropping stuck #{build.status} build #{build.id} for runner #{build.runner_id}" build.drop end + + # Update builds that failed to drop + builds.update_all(status: 'failed') end end |