summaryrefslogtreecommitdiff
path: root/app/models/deployment.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-05 09:08:00 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-05 09:08:00 +0000
commit17ef30f3df6d3939e41e69efc7cfa3deaa08605d (patch)
tree6852730e03de7e85e7a42952ec85960ab9832fa5 /app/models/deployment.rb
parentcd9bbd8a3e8af73864ca3c7704211309fae8ce0e (diff)
downloadgitlab-ce-17ef30f3df6d3939e41e69efc7cfa3deaa08605d.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/deployment.rb')
-rw-r--r--app/models/deployment.rb9
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