summaryrefslogtreecommitdiff
path: root/app/models/ci/build.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-11-17 00:23:05 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2016-11-17 00:23:05 +0100
commitd6e00f5373e24deaa7f143f5445ae9461ef5f615 (patch)
tree59d784dd10d349d54fda8924d00a79946bf1bfdb /app/models/ci/build.rb
parent2b8292cd49dbc68b02f46f865b7115191bf2de07 (diff)
downloadgitlab-ce-d6e00f5373e24deaa7f143f5445ae9461ef5f615.tar.gz
Improve specs and add missing cases that were not supported
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r--app/models/ci/build.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 09bbea1c653..e0e7a8caeea 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -127,8 +127,24 @@ module Ci
!self.pipeline.statuses.latest.include?(self)
end
- def deployable?
- self.environment.present?
+ def expanded_environment_name
+ ExpandVariables.expand(environment, variables) if environment
+ end
+
+ def starts_environment?
+ self.environment.present? && self.environment_action == 'start'
+ end
+
+ def stops_environment?
+ self.environment.present? && self.environment_action == 'stop'
+ end
+
+ def environment_action
+ self.options.fetch(:environment, {}).fetch(:action, 'start')
+ end
+
+ def outdated_deployment?
+ success? && !last_deployment.try(:last?)
end
def last_deployment