diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-09 16:46:36 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-09 16:46:36 +0300 |
commit | 5328e3b1276d8eef15b6636a1d5b1c7a57d31ea6 (patch) | |
tree | 1db340c3585deff3612029c453e9e502b53c249e /app/services | |
parent | 45bd5391d7f20715ae4de7a4a5cd9233ab598c28 (diff) |
Make commit an optional arg for environments search
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/ci/stop_environment_service.rb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/app/services/ci/stop_environment_service.rb b/app/services/ci/stop_environment_service.rb index 2ac0b3d885a..cb49f71c5a3 100644 --- a/app/services/ci/stop_environment_service.rb +++ b/app/services/ci/stop_environment_service.rb @@ -5,7 +5,7 @@ module Ci def execute(branch_name) @ref = branch_name - return unless has_ref_commit_pair? + return unless has_ref? return unless has_environments? environments.each do |environment| @@ -17,12 +17,8 @@ module Ci private - def has_ref_commit_pair? - ref && commit - end - - def commit - @commit ||= project.commit(ref) + def has_ref? + @ref.present? end def has_environments? @@ -30,7 +26,7 @@ module Ci end def environments - @environments ||= project.environments_for(ref, commit) + @environments ||= project.environments_for(@ref) end end end |