diff options
author | Tomasz Maczukin <tomasz@maczukin.pl> | 2017-02-27 16:05:44 +0100 |
---|---|---|
committer | Tomasz Maczukin <tomasz@maczukin.pl> | 2017-03-02 17:45:45 +0100 |
commit | fb8210ad19dcf012ffd1a99a649846d82870b8af (patch) | |
tree | fcf7325c17e56adaff9aa84e5ed74de165622a05 | |
parent | 65564598d90b24766fc4eae79a2203daf77c2ce0 (diff) | |
download | gitlab-ce-fb8210ad19dcf012ffd1a99a649846d82870b8af.tar.gz |
Update step data naming
-rw-r--r-- | lib/api/entities.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/ci/build/response/step.rb | 22 | ||||
-rw-r--r-- | spec/requests/api/runner_spec.rb | 4 |
3 files changed, 13 insertions, 15 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 7e07154600a..f961102b910 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -720,7 +720,7 @@ module API end class Step < Grape::Entity - expose :name, :script, :timeout, :condition, :result + expose :name, :script, :timeout, :when, :allow_failure end class Image < Grape::Entity diff --git a/lib/gitlab/ci/build/response/step.rb b/lib/gitlab/ci/build/response/step.rb index f78cd566940..9b359057b30 100644 --- a/lib/gitlab/ci/build/response/step.rb +++ b/lib/gitlab/ci/build/response/step.rb @@ -3,21 +3,19 @@ module Gitlab module Build module Response class Step - CONDITION_IF_SUCCEEDED = 'run_if_succeeded' - CONDITION_ALWAYS = 'run_always' + CONDITION_ON_FAILURE = 'on_failure' + CONDITION_ON_SUCCESS = 'on_success' + CONDITION_ALWAYS = 'always' - RESULT_FAILS_JOB = 'fails_job' - RESULT_DOESNT_FAIL_JOB = 'doesnt_fail_job' - - attr_reader :name, :script, :condition, :result, :timeout + attr_reader :name, :script, :when, :allow_failure, :timeout class << self def from_commands(build) self.new(:script, build.commands, build.timeout, - CONDITION_IF_SUCCEEDED, - RESULT_FAILS_JOB) + CONDITION_ON_SUCCESS, + false) end def from_after_script(build) @@ -28,16 +26,16 @@ module Gitlab after_script, build.timeout, CONDITION_ALWAYS, - RESULT_DOESNT_FAIL_JOB) + true) end end - def initialize(name, script, timeout, condition = CONDITION_IF_SUCCEEDED, result = RESULT_FAILS_JOB) + def initialize(name, script, timeout, when_condition = CONDITION_ON_SUCCESS, allow_failure = true) @name = name @script = script.split("\n") @timeout = timeout - @condition = condition - @result = result + @when = when_condition + @allow_failure = allow_failure end end end diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb index 479d55d0871..73264eea71d 100644 --- a/spec/requests/api/runner_spec.rb +++ b/spec/requests/api/runner_spec.rb @@ -283,8 +283,8 @@ describe API::Runner do expect(json_response['steps']).to include({ 'name' => 'after_script', 'script' => ['ls', 'date'], 'timeout' => job.timeout, - 'condition' => Gitlab::Ci::Build::Response::Step::CONDITION_ALWAYS, - 'result' => Gitlab::Ci::Build::Response::Step::RESULT_DOESNT_FAIL_JOB }) + 'when' => 'always', + 'allow_failure' => true }) expect(json_response['variables']).to include({ 'key' => 'CI_BUILD_NAME', 'value' => 'spinach', 'public' => true }, { 'key' => 'CI_BUILD_STAGE', 'value' => 'test', 'public' => true }, { 'key' => 'DB_NAME', 'value' => 'postgres', 'public' => true }) |