Commit eacaee59 authored by Stan Hu's avatar Stan Hu

Merge branch 'ce-to-ee-2018-06-17' into 'master'

CE upstream - 2018-06-17 18:24 UTC

See merge request gitlab-org/gitlab-ee!6166
parents e14c0331 61dbbbff
...@@ -27,14 +27,12 @@ module Ci ...@@ -27,14 +27,12 @@ module Ci
valid = true valid = true
if Feature.enabled?('ci_job_request_with_tags_matcher') # pick builds that does not have other tags than runner's one
# pick builds that does not have other tags than runner's one builds = builds.matches_tag_ids(runner.tags.ids)
builds = builds.matches_tag_ids(runner.tags.ids)
# pick builds that have at least one tag # pick builds that have at least one tag
unless runner.run_untagged? unless runner.run_untagged?
builds = builds.with_any_tags builds = builds.with_any_tags
end
end end
builds.find do |build| builds.find do |build|
......
---
title: Optimise paused runners to reduce amount of used requests
merge_request:
author:
type: performance
---
title: Remove the ci_job_request_with_tags_matcher
merge_request:
author:
type: performance
...@@ -84,7 +84,11 @@ module API ...@@ -84,7 +84,11 @@ module API
end end
post '/request' do post '/request' do
authenticate_runner! authenticate_runner!
no_content! unless current_runner.active?
unless current_runner.active?
header 'X-GitLab-Last-Update', current_runner.ensure_runner_queue_value
break no_content!
end
if current_runner.runner_queue_value_latest?(params[:last_update]) if current_runner.runner_queue_value_latest?(params[:last_update])
header 'X-GitLab-Last-Update', params[:last_update] header 'X-GitLab-Last-Update', params[:last_update]
......
...@@ -356,11 +356,13 @@ describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -356,11 +356,13 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
context 'when valid token is provided' do context 'when valid token is provided' do
context 'when Runner is not active' do context 'when Runner is not active' do
let(:runner) { create(:ci_runner, :inactive) } let(:runner) { create(:ci_runner, :inactive) }
let(:update_value) { runner.ensure_runner_queue_value }
it 'returns 204 error' do it 'returns 204 error' do
request_job request_job
expect(response).to have_gitlab_http_status 204 expect(response).to have_gitlab_http_status(204)
expect(response.header['X-GitLab-Last-Update']).to eq(update_value)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment