diff --git a/lib/api/helpers/runner.rb b/lib/api/helpers/runner.rb index 8db0fc117c6..8204adbcfe5 100644 --- a/lib/api/helpers/runner.rb +++ b/lib/api/helpers/runner.rb @@ -36,7 +36,7 @@ module API contacted_at_max_age = UPDATE_RUNNER_EVERY + Random.rand(UPDATE_RUNNER_EVERY) current_runner.contacted_at.nil? || - (Time.now - current_runner.contacted_at) >= contacted_at_max_age + (Time.now - current_runner.contacted_at) >= contacted_at_max_age end def build_not_found! diff --git a/lib/gitlab/ci/build/response/image.rb b/lib/gitlab/ci/build/response/image.rb index 342a249aee8..c160689a2e1 100644 --- a/lib/gitlab/ci/build/response/image.rb +++ b/lib/gitlab/ci/build/response/image.rb @@ -17,4 +17,4 @@ module Gitlab end end end -end \ No newline at end of file +end diff --git a/lib/gitlab/ci/build/response/step.rb b/lib/gitlab/ci/build/response/step.rb index 7b35852a510..f78cd566940 100644 --- a/lib/gitlab/ci/build/response/step.rb +++ b/lib/gitlab/ci/build/response/step.rb @@ -43,4 +43,4 @@ module Gitlab end end end -end \ No newline at end of file +end diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb index bd9dc422703..479d55d0871 100644 --- a/spec/requests/api/runner_spec.rb +++ b/spec/requests/api/runner_spec.rb @@ -236,7 +236,6 @@ describe API::Runner do end context 'when valid token is provided' do - context 'when Runner is not active' do let(:runner) { create(:ci_runner, :inactive) } @@ -267,7 +266,7 @@ describe API::Runner do context 'when there is a pending job' do it 'starts a job' do - request_job info: {platform: :darwin} + request_job info: { platform: :darwin } expect(response).to have_http_status(201) expect(response.headers).not_to have_key('X-GitLab-Last-Update') @@ -320,7 +319,7 @@ describe API::Runner do let(:value) { "#{param}_value" } it %q(updates provided Runner's parameter) do - request_job info: {param => value} + request_job info: { param => value } expect(response).to have_http_status(201) runner.reload @@ -386,24 +385,22 @@ describe API::Runner do request_job expect(response).to have_http_status(201) - expect(json_response['variables']).to include( - {'key' => 'CI_BUILD_NAME', 'value' => 'spinach', 'public' => true}, - {'key' => 'CI_BUILD_STAGE', 'value' => 'test', 'public' => true}, - {'key' => 'CI_BUILD_TRIGGERED', 'value' => 'true', 'public' => true}, - {'key' => 'DB_NAME', 'value' => 'postgres', 'public' => true}, - {'key' => 'SECRET_KEY', 'value' => 'secret_value', 'public' => false}, - {'key' => 'TRIGGER_KEY_1', 'value' => 'TRIGGER_VALUE_1', 'public' => false}, - ) + expect(json_response['variables']).to include({ 'key' => 'CI_BUILD_NAME', 'value' => 'spinach', 'public' => true }, + { 'key' => 'CI_BUILD_STAGE', 'value' => 'test', 'public' => true }, + { 'key' => 'CI_BUILD_TRIGGERED', 'value' => 'true', 'public' => true }, + { 'key' => 'DB_NAME', 'value' => 'postgres', 'public' => true }, + { 'key' => 'SECRET_KEY', 'value' => 'secret_value', 'public' => false }, + { 'key' => 'TRIGGER_KEY_1', 'value' => 'TRIGGER_VALUE_1', 'public' => false }) end end describe 'registry credentials support' do let(:registry_url) { 'registry.example.com:5005' } let(:registry_credentials) do - {'type' => 'registry', - 'url' => registry_url, - 'username' => 'gitlab-ci-token', - 'password' => job.token} + { 'type' => 'registry', + 'url' => registry_url, + 'username' => 'gitlab-ci-token', + 'password' => job.token } end context 'when registry is enabled' do @@ -431,7 +428,7 @@ describe API::Runner do def request_job(token = runner.token, **params) new_params = params.merge(token: token, last_update: last_update) - post api('/jobs/request'), new_params, {'User-Agent' => user_agent} + post api('/jobs/request'), new_params, { 'User-Agent' => user_agent } end end end