diff options
Diffstat (limited to 'app/models/deployment.rb')
-rw-r--r-- | app/models/deployment.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/deployment.rb b/app/models/deployment.rb index 63d531d82c3..4204ad707b2 100644 --- a/app/models/deployment.rb +++ b/app/models/deployment.rb @@ -70,6 +70,11 @@ class Deployment < ApplicationRecord transition created: :blocked end + # This transition is possible when we have manual jobs. + event :create do + transition skipped: :created + end + event :unblock do transition blocked: :created end @@ -348,7 +353,7 @@ class Deployment < ApplicationRecord def sync_status_with(build) return false unless ::Deployment.statuses.include?(build.status) - return false if build.created? || build.status == self.status + return false if build.status == self.status update_status!(build.status) rescue StandardError => e @@ -403,6 +408,8 @@ class Deployment < ApplicationRecord skip! when 'blocked' block! + when 'created' + create! else raise ArgumentError, "The status #{status.inspect} is invalid" end |