summaryrefslogtreecommitdiff
path: root/app/models/ci
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-08-15 19:02:48 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-08-15 19:02:48 +0800
commit0ea81ae50a702c7341b1bd6fd15002ee78ac4964 (patch)
tree4b8b9589df10a326b734eaf657185ee12e557999 /app/models/ci
parent5e7d99d3dc3cc7c5cf644f15610ed9813b45cb41 (diff)
parent4d4ef89cdcb9beca66a13ab2b64e9eb45f8d8256 (diff)
downloadgitlab-ce-0ea81ae50a702c7341b1bd6fd15002ee78ac4964.tar.gz
Merge remote-tracking branch 'upstream/pipeline-hooks-without-slack' into wall-clock-time-for-showing-pipeline
* upstream/pipeline-hooks-without-slack: Make explicit call for all event types for ProjectHook factory Capitalise URL on web_hooks/form Remove changes not related to this MR Added documentation for pipeline hooks Rename queue to enqueue in tests Instrument Project.visible_to_user Fix build play failure Update ruby 2.3.1 Improve transition between states for event `enqueue` Use event `enqueue` instead of `queue` Fix test failures Fix bug where destroying a namespace would not always destroy projects Remove unused SpamReport model; this was renamed to SpamLog Corrected links/usernames in performance guide Add gravatars to build history Add deployment ID and gravatar to environments page Format environment history page Add avatar to commit message; environment style updates to match pipelines page Style deploy button
Diffstat (limited to 'app/models/ci')
-rw-r--r--app/models/ci/build.rb4
-rw-r--r--app/models/ci/pipeline.rb22
2 files changed, 10 insertions, 16 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index ca2fd4f7409..4c84f4c21c5 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -59,7 +59,7 @@ module Ci
when: build.when,
user: user,
environment: build.environment,
- status_event: 'queue'
+ status_event: 'enqueue'
)
MergeRequests::AddTodoWhenBuildFailsService.new(build.project, nil).close(new_build)
new_build
@@ -102,7 +102,7 @@ module Ci
def play(current_user = nil)
# Try to queue a current build
- if self.queue
+ if self.enqueue
self.update(user: current_user)
self
else
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 19335ccea57..5b9754b5c37 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -22,9 +22,9 @@ module Ci
delegate :stages, to: :statuses
state_machine :status, initial: :created do
- event :queue do
+ event :enqueue do
transition created: :pending
- transition any - [:created, :pending] => :running
+ transition [:success, :failed, :canceled, :skipped] => :running
end
event :run do
@@ -234,18 +234,12 @@ module Ci
def build_updated
case latest_builds_status
- when 'pending'
- queue
- when 'running'
- run
- when 'success'
- succeed
- when 'failed'
- drop
- when 'canceled'
- cancel
- when 'skipped'
- skip
+ when 'pending' then enqueue
+ when 'running' then run
+ when 'success' then succeed
+ when 'failed' then drop
+ when 'canceled' then cancel
+ when 'skipped' then skip
end
end