diff options
Diffstat (limited to 'app/models/deployment.rb')
-rw-r--r-- | app/models/deployment.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/models/deployment.rb b/app/models/deployment.rb index 65f5cbf69c6..994e69912b6 100644 --- a/app/models/deployment.rb +++ b/app/models/deployment.rb @@ -217,6 +217,23 @@ class Deployment < ApplicationRecord SQL end + # Changes the status of a deployment and triggers the correspinding state + # machine events. + def update_status(status) + case status + when 'running' + run + when 'success' + succeed + when 'failed' + drop + when 'canceled' + cancel + else + raise ArgumentError, "The status #{status.inspect} is invalid" + end + end + private def ref_path |