summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-07-01 06:07:35 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-01 06:07:35 +0000
commit0537e77587de43e2b3c5cbd8610641b3003a9840 (patch)
treecc9275bdae7321d35be85208647c0bfd50abe7e6
parent07be35d0583dcb6a7becd1401ebc8fb5b03c426b (diff)
downloadgitlab-ce-0537e77587de43e2b3c5cbd8610641b3003a9840.tar.gz
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/finders/ci/pipelines_for_merge_request_finder.rb3
-rw-r--r--app/graphql/types/ci/runner_type.rb28
-rw-r--r--config/feature_flags/development/ci_quota_check_on_retries.yml8
-rw-r--r--config/feature_flags/development/use_distinct_in_shas_cte.yml8
-rw-r--r--config/karma.config.js2
-rw-r--r--config/webpack.config.js2
-rw-r--r--doc/api/graphql/reference/index.md2
-rw-r--r--lib/gitlab/database/batch_count.rb2
-rw-r--r--lib/gitlab/database/postgres_hll/batch_distinct_counter.rb8
-rw-r--r--scripts/frontend/extract_gettext_all.js2
-rw-r--r--scripts/frontend/stylelint/stylelint-utility-classes.js2
-rwxr-xr-xscripts/trigger-build17
-rw-r--r--spec/graphql/types/ci/runner_type_spec.rb1
-rw-r--r--spec/javascripts/lib/utils/mock_data.js2
-rw-r--r--spec/models/integrations/bamboo_spec.rb83
-rw-r--r--spec/requests/api/graphql/ci/runner_spec.rb54
-rw-r--r--storybook/config/webpack.config.js2
-rw-r--r--workhorse/config_test.go32
-rw-r--r--workhorse/main.go13
19 files changed, 178 insertions, 93 deletions
diff --git a/app/finders/ci/pipelines_for_merge_request_finder.rb b/app/finders/ci/pipelines_for_merge_request_finder.rb
index 6c5038128f8..f769da03738 100644
--- a/app/finders/ci/pipelines_for_merge_request_finder.rb
+++ b/app/finders/ci/pipelines_for_merge_request_finder.rb
@@ -47,8 +47,7 @@ module Ci
# rubocop: disable CodeReuse/ActiveRecord
def pipelines_using_cte
- sha_relation = merge_request.all_commits.select(:sha)
- sha_relation = sha_relation.distinct if Feature.enabled?(:use_distinct_in_shas_cte, default_enabled: :yaml)
+ sha_relation = merge_request.all_commits.select(:sha).distinct
cte = Gitlab::SQL::CTE.new(:shas, sha_relation)
diff --git a/app/graphql/types/ci/runner_type.rb b/app/graphql/types/ci/runner_type.rb
index 837d91ef765..9816075d23c 100644
--- a/app/graphql/types/ci/runner_type.rb
+++ b/app/graphql/types/ci/runner_type.rb
@@ -6,6 +6,10 @@ module Types
graphql_name 'CiRunner'
authorize :read_runner
+ JOB_COUNT_LIMIT = 1000
+
+ alias_method :runner, :object
+
field :id, ::Types::GlobalIDType[::Ci::Runner], null: false,
description: 'ID of the runner.'
field :description, GraphQL::STRING_TYPE, null: true,
@@ -37,6 +41,30 @@ module Types
description: 'Type of the runner.'
field :tag_list, [GraphQL::STRING_TYPE], null: true,
description: 'Tags associated with the runner.'
+ field :project_count, GraphQL::INT_TYPE, null: true,
+ description: 'Number of projects that the runner is associated with.'
+ field :job_count, GraphQL::INT_TYPE, null: true,
+ description: "Number of jobs processed by the runner (limited to #{JOB_COUNT_LIMIT}, plus one to indicate that more items exist)."
+
+ def job_count
+ # We limit to 1 above the JOB_COUNT_LIMIT to indicate that more items exist after JOB_COUNT_LIMIT
+ runner.builds.limit(JOB_COUNT_LIMIT + 1).count
+ end
+
+ # rubocop: disable CodeReuse/ActiveRecord
+ def project_count
+ BatchLoader::GraphQL.for(runner.id).batch(key: :runner_project_count) do |ids, loader, args|
+ counts = ::Ci::RunnerProject.select(:runner_id, 'COUNT(*) as count')
+ .where(runner_id: ids)
+ .group(:runner_id)
+ .index_by(&:runner_id)
+
+ ids.each do |id|
+ loader.call(id, counts[id]&.count)
+ end
+ end
+ end
+ # rubocop: enable CodeReuse/ActiveRecord
end
end
end
diff --git a/config/feature_flags/development/ci_quota_check_on_retries.yml b/config/feature_flags/development/ci_quota_check_on_retries.yml
deleted file mode 100644
index 059e97e8c86..00000000000
--- a/config/feature_flags/development/ci_quota_check_on_retries.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-name: ci_quota_check_on_retries
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62702
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/333765
-milestone: '14.0'
-type: development
-group: group::pipeline execution
-default_enabled: false
diff --git a/config/feature_flags/development/use_distinct_in_shas_cte.yml b/config/feature_flags/development/use_distinct_in_shas_cte.yml
deleted file mode 100644
index b741b8d5f0c..00000000000
--- a/config/feature_flags/development/use_distinct_in_shas_cte.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-name: use_distinct_in_shas_cte
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/61454
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/330586
-milestone: '13.12'
-type: development
-group: group::optimize
-default_enabled: true
diff --git a/config/karma.config.js b/config/karma.config.js
index 3e125759357..39c9dbe264c 100644
--- a/config/karma.config.js
+++ b/config/karma.config.js
@@ -5,7 +5,7 @@ const argumentsParser = require('commander');
const glob = require('glob');
const webpack = require('webpack');
const IS_EE = require('./helpers/is_ee_env');
-const webpackConfig = require('./webpack.config.js');
+const webpackConfig = require('./webpack.config');
const ROOT_PATH = path.resolve(__dirname, '..');
const SPECS_PATH = /^(?:\.[\\/])?(ee[\\/])?spec[\\/]javascripts[\\/]/;
diff --git a/config/webpack.config.js b/config/webpack.config.js
index c2af7197f94..422f60736e7 100644
--- a/config/webpack.config.js
+++ b/config/webpack.config.js
@@ -422,7 +422,7 @@ module.exports = {
);
// eslint-disable-next-line global-require
- const dllConfig = require('./webpack.vendor.config.js');
+ const dllConfig = require('./webpack.vendor.config');
const dllCompiler = webpack(dllConfig);
dllCompiler.run((err, stats) => {
diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md
index 0c45b0618e7..56dc130bdd2 100644
--- a/doc/api/graphql/reference/index.md
+++ b/doc/api/graphql/reference/index.md
@@ -7710,9 +7710,11 @@ Represents the total number of issues and their weights for a particular day.
| <a id="cirunnerdescription"></a>`description` | [`String`](#string) | Description of the runner. |
| <a id="cirunnerid"></a>`id` | [`CiRunnerID!`](#cirunnerid) | ID of the runner. |
| <a id="cirunneripaddress"></a>`ipAddress` | [`String!`](#string) | IP address of the runner. |
+| <a id="cirunnerjobcount"></a>`jobCount` | [`Int`](#int) | Number of jobs processed by the runner (limited to 1000, plus one to indicate that more items exist). |
| <a id="cirunnerlocked"></a>`locked` | [`Boolean`](#boolean) | Indicates the runner is locked. |
| <a id="cirunnermaximumtimeout"></a>`maximumTimeout` | [`Int`](#int) | Maximum timeout (in seconds) for jobs processed by the runner. |
| <a id="cirunnerprivateprojectsminutescostfactor"></a>`privateProjectsMinutesCostFactor` | [`Float`](#float) | Private projects' "minutes cost factor" associated with the runner (GitLab.com only). |
+| <a id="cirunnerprojectcount"></a>`projectCount` | [`Int`](#int) | Number of projects that the runner is associated with. |
| <a id="cirunnerpublicprojectsminutescostfactor"></a>`publicProjectsMinutesCostFactor` | [`Float`](#float) | Public projects' "minutes cost factor" associated with the runner (GitLab.com only). |
| <a id="cirunnerrevision"></a>`revision` | [`String!`](#string) | Revision of the runner. |
| <a id="cirunnerrununtagged"></a>`runUntagged` | [`Boolean!`](#boolean) | Indicates the runner is able to run untagged jobs. |
diff --git a/lib/gitlab/database/batch_count.rb b/lib/gitlab/database/batch_count.rb
index 8b16ef5ed3b..9855acf2507 100644
--- a/lib/gitlab/database/batch_count.rb
+++ b/lib/gitlab/database/batch_count.rb
@@ -18,7 +18,7 @@
# batch_count(::Clusters::Cluster.aws_installed.enabled, :cluster_id)
# batch_count(Namespace.group(:type))
# batch_distinct_count(::Project, :creator_id)
-# batch_distinct_count(::Project.with_active_integrations.service_desk_enabled.where(time_period), start: ::User.minimum(:id), finish: ::User.maximum(:id))
+# batch_distinct_count(::Project.aimed_for_deletion.service_desk_enabled.where(time_period), start: ::User.minimum(:id), finish: ::User.maximum(:id))
# batch_distinct_count(Project.group(:visibility_level), :creator_id)
# batch_sum(User, :sign_in_count)
# batch_sum(Issue.group(:state_id), :weight))
diff --git a/lib/gitlab/database/postgres_hll/batch_distinct_counter.rb b/lib/gitlab/database/postgres_hll/batch_distinct_counter.rb
index 7d5163f3a16..580cab5622d 100644
--- a/lib/gitlab/database/postgres_hll/batch_distinct_counter.rb
+++ b/lib/gitlab/database/postgres_hll/batch_distinct_counter.rb
@@ -11,17 +11,17 @@ module Gitlab
# In order to not use a possible complex time consuming query when calculating min and max values,
# the start and finish can be sent specifically, start and finish should contain max and min values for PRIMARY KEY of
# relation (most cases `id` column) rather than counted attribute eg:
- # estimate_distinct_count(start: ::Project.with_active_integrations.minimum(:id), finish: ::Project.with_active_integrations.maximum(:id))
+ # estimate_distinct_count(start: ::Project.aimed_for_deletion.minimum(:id), finish: ::Project.aimed_for_deletion.maximum(:id))
#
# Grouped relations are NOT supported yet.
#
# @example Usage
# ::Gitlab::Database::PostgresHllBatchDistinctCount.new(::Project, :creator_id).execute
- # ::Gitlab::Database::PostgresHllBatchDistinctCount.new(::Project.with_active_integrations.service_desk_enabled.where(time_period))
+ # ::Gitlab::Database::PostgresHllBatchDistinctCount.new(::Project.aimed_for_deletion.service_desk_enabled.where(time_period))
# .execute(
# batch_size: 1_000,
- # start: ::Project.with_active_integrations.service_desk_enabled.where(time_period).minimum(:id),
- # finish: ::Project.with_active_integrations.service_desk_enabled.where(time_period).maximum(:id)
+ # start: ::Project.aimed_for_deletion.service_desk_enabled.where(time_period).minimum(:id),
+ # finish: ::Project.aimed_for_deletion.service_desk_enabled.where(time_period).maximum(:id)
# )
#
# @note HyperLogLog is an PROBABILISTIC algorithm that ESTIMATES distinct count of given attribute value for supplied relation
diff --git a/scripts/frontend/extract_gettext_all.js b/scripts/frontend/extract_gettext_all.js
index 896790a73bb..0a5e2b06971 100644
--- a/scripts/frontend/extract_gettext_all.js
+++ b/scripts/frontend/extract_gettext_all.js
@@ -6,7 +6,7 @@ const {
decorateExtractorWithHelpers,
} = require('gettext-extractor-vue');
const vue2TemplateCompiler = require('vue-template-compiler');
-const ensureSingleLine = require('../../app/assets/javascripts/locale/ensure_single_line.js');
+const ensureSingleLine = require('../../app/assets/javascripts/locale/ensure_single_line');
const args = argumentsParser
.option('-f, --file <file>', 'Extract message from one single file')
diff --git a/scripts/frontend/stylelint/stylelint-utility-classes.js b/scripts/frontend/stylelint/stylelint-utility-classes.js
index 420fe82d826..14827145b54 100644
--- a/scripts/frontend/stylelint/stylelint-utility-classes.js
+++ b/scripts/frontend/stylelint/stylelint-utility-classes.js
@@ -1,6 +1,6 @@
const stylelint = require('stylelint');
const utils = require('./stylelint-utils');
-const utilityClasses = require('./utility-classes-map.js');
+const utilityClasses = require('./utility-classes-map');
const ruleName = 'stylelint-gitlab/utility-classes';
diff --git a/scripts/trigger-build b/scripts/trigger-build
index 03aca8b3da7..cb235677b5d 100755
--- a/scripts/trigger-build
+++ b/scripts/trigger-build
@@ -313,27 +313,18 @@ module Trigger
comment = "<!-- #{IDENTIFIABLE_NOTE_TAG} --> \nStarted database testing [pipeline](https://ops.gitlab.net/#{downstream_project_path}/-/pipelines/#{pipeline.id}) " \
"(limited access). This comment will be updated once the pipeline has finished running."
- # Look for a note to update
+ # Look for an existing note
db_testing_notes = gitlab.merge_request_notes(project_path, merge_request_id).auto_paginate.select do |note|
note.body.include?(IDENTIFIABLE_NOTE_TAG)
end
- note = db_testing_notes.max_by { |note| Time.parse(note.created_at) }
-
- if note && note.type != 'DiscussionNote'
- # The latest note has not led to a discussion. Update it.
- gitlab.edit_merge_request_note(project_path, merge_request_id, note.id, comment)
-
- puts "Updated comment:\n"
- else
- # This is the first note or the latest note has been discussed on the MR.
- # Don't update, create new note instead.
+ if db_testing_notes.empty?
+ # This is the first note
note = gitlab.create_merge_request_note(project_path, merge_request_id, comment)
puts "Posted comment to:\n"
+ puts "https://gitlab.com/#{project_path}/-/merge_requests/#{merge_request_id}#note_#{note.id}"
end
-
- puts "https://gitlab.com/#{project_path}/-/merge_requests/#{merge_request_id}#note_#{note.id}"
end
private
diff --git a/spec/graphql/types/ci/runner_type_spec.rb b/spec/graphql/types/ci/runner_type_spec.rb
index f27216f4d39..cff4c459d79 100644
--- a/spec/graphql/types/ci/runner_type_spec.rb
+++ b/spec/graphql/types/ci/runner_type_spec.rb
@@ -11,6 +11,7 @@ RSpec.describe GitlabSchema.types['CiRunner'] do
expected_fields = %w[
id description contacted_at maximum_timeout access_level active status
version short_sha revision locked run_untagged ip_address runner_type tag_list
+ project_count job_count
]
expect(described_class).to include_graphql_fields(*expected_fields)
diff --git a/spec/javascripts/lib/utils/mock_data.js b/spec/javascripts/lib/utils/mock_data.js
index c2f79a32377..f1358986f2a 100644
--- a/spec/javascripts/lib/utils/mock_data.js
+++ b/spec/javascripts/lib/utils/mock_data.js
@@ -1 +1 @@
-export * from '../../../frontend/lib/utils/mock_data.js';
+export * from '../../../frontend/lib/utils/mock_data';
diff --git a/spec/models/integrations/bamboo_spec.rb b/spec/models/integrations/bamboo_spec.rb
index 39966f7978d..b5a48cb235c 100644
--- a/spec/models/integrations/bamboo_spec.rb
+++ b/spec/models/integrations/bamboo_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe Integrations::Bamboo, :use_clean_rails_memory_store_caching do
let_it_be(:project) { create(:project) }
- subject(:service) do
+ subject(:integration) do
described_class.create!(
project: project,
properties: {
@@ -28,47 +28,47 @@ RSpec.describe Integrations::Bamboo, :use_clean_rails_memory_store_caching do
end
describe 'Validations' do
- context 'when service is active' do
+ context 'when active' do
before do
- subject.active = true
+ integration.active = true
end
it { is_expected.to validate_presence_of(:build_key) }
it { is_expected.to validate_presence_of(:bamboo_url) }
- it_behaves_like 'issue tracker service URL attribute', :bamboo_url
+ it_behaves_like 'issue tracker integration URL attribute', :bamboo_url
describe '#username' do
it 'does not validate the presence of username if password is nil' do
- subject.password = nil
+ integration.password = nil
- expect(subject).not_to validate_presence_of(:username)
+ expect(integration).not_to validate_presence_of(:username)
end
it 'validates the presence of username if password is present' do
- subject.password = 'secret'
+ integration.password = 'secret'
- expect(subject).to validate_presence_of(:username)
+ expect(integration).to validate_presence_of(:username)
end
end
describe '#password' do
it 'does not validate the presence of password if username is nil' do
- subject.username = nil
+ integration.username = nil
- expect(subject).not_to validate_presence_of(:password)
+ expect(integration).not_to validate_presence_of(:password)
end
it 'validates the presence of password if username is present' do
- subject.username = 'john'
+ integration.username = 'john'
- expect(subject).to validate_presence_of(:password)
+ expect(integration).to validate_presence_of(:password)
end
end
end
- context 'when service is inactive' do
+ context 'when inactive' do
before do
- subject.active = false
+ integration.active = false
end
it { is_expected.not_to validate_presence_of(:build_key) }
@@ -82,45 +82,38 @@ RSpec.describe Integrations::Bamboo, :use_clean_rails_memory_store_caching do
describe 'before_update :reset_password' do
context 'when a password was previously set' do
it 'resets password if url changed' do
- bamboo_integration = service
+ integration.bamboo_url = 'http://gitlab1.com'
+ integration.save!
- bamboo_integration.bamboo_url = 'http://gitlab1.com'
- bamboo_integration.save!
-
- expect(bamboo_integration.password).to be_nil
+ expect(integration.password).to be_nil
end
it 'does not reset password if username changed' do
- bamboo_integration = service
-
- bamboo_integration.username = 'some_name'
- bamboo_integration.save!
+ integration.username = 'some_name'
+ integration.save!
- expect(bamboo_integration.password).to eq('password')
+ expect(integration.password).to eq('password')
end
it "does not reset password if new url is set together with password, even if it's the same password" do
- bamboo_integration = service
-
- bamboo_integration.bamboo_url = 'http://gitlab_edited.com'
- bamboo_integration.password = 'password'
- bamboo_integration.save!
+ integration.bamboo_url = 'http://gitlab_edited.com'
+ integration.password = 'password'
+ integration.save!
- expect(bamboo_integration.password).to eq('password')
- expect(bamboo_integration.bamboo_url).to eq('http://gitlab_edited.com')
+ expect(integration.password).to eq('password')
+ expect(integration.bamboo_url).to eq('http://gitlab_edited.com')
end
end
it 'saves password if new url is set together with password when no password was previously set' do
- bamboo_integration = service
- bamboo_integration.password = nil
+ integration.password = nil
- bamboo_integration.bamboo_url = 'http://gitlab_edited.com'
- bamboo_integration.password = 'password'
- bamboo_integration.save!
+ integration.bamboo_url = 'http://gitlab_edited.com'
+ integration.password = 'password'
+ integration.save!
- expect(bamboo_integration.password).to eq('password')
- expect(bamboo_integration.bamboo_url).to eq('http://gitlab_edited.com')
+ expect(integration.password).to eq('password')
+ expect(integration.bamboo_url).to eq('http://gitlab_edited.com')
end
end
end
@@ -129,29 +122,29 @@ RSpec.describe Integrations::Bamboo, :use_clean_rails_memory_store_caching do
it 'runs update and build action' do
stub_update_and_build_request
- subject.execute(Gitlab::DataBuilder::Push::SAMPLE_DATA)
+ integration.execute(Gitlab::DataBuilder::Push::SAMPLE_DATA)
end
end
describe '#build_page' do
it 'returns the contents of the reactive cache' do
- stub_reactive_cache(service, { build_page: 'foo' }, 'sha', 'ref')
+ stub_reactive_cache(integration, { build_page: 'foo' }, 'sha', 'ref')
- expect(service.build_page('sha', 'ref')).to eq('foo')
+ expect(integration.build_page('sha', 'ref')).to eq('foo')
end
end
describe '#commit_status' do
it 'returns the contents of the reactive cache' do
- stub_reactive_cache(service, { commit_status: 'foo' }, 'sha', 'ref')
+ stub_reactive_cache(integration, { commit_status: 'foo' }, 'sha', 'ref')
- expect(service.commit_status('sha', 'ref')).to eq('foo')
+ expect(integration.commit_status('sha', 'ref')).to eq('foo')
end
end
shared_examples 'reactive cache calculation' do
describe '#build_page' do
- subject { service.calculate_reactive_cache('123', 'unused')[:build_page] }
+ subject { integration.calculate_reactive_cache('123', 'unused')[:build_page] }
it 'returns a specific URL when status is 500' do
stub_request(status: 500)
@@ -183,7 +176,7 @@ RSpec.describe Integrations::Bamboo, :use_clean_rails_memory_store_caching do
end
describe '#commit_status' do
- subject { service.calculate_reactive_cache('123', 'unused')[:commit_status] }
+ subject { integration.calculate_reactive_cache('123', 'unused')[:commit_status] }
it 'sets commit status to :error when status is 500' do
stub_request(status: 500)
diff --git a/spec/requests/api/graphql/ci/runner_spec.rb b/spec/requests/api/graphql/ci/runner_spec.rb
index aca93634fa0..09050e6cdbe 100644
--- a/spec/requests/api/graphql/ci/runner_spec.rb
+++ b/spec/requests/api/graphql/ci/runner_spec.rb
@@ -59,7 +59,9 @@ RSpec.describe 'Query.runner(id)' do
'accessLevel' => runner.access_level.to_s.upcase,
'runUntagged' => runner.run_untagged,
'ipAddress' => runner.ip_address,
- 'runnerType' => 'INSTANCE_TYPE'
+ 'runnerType' => 'INSTANCE_TYPE',
+ 'jobCount' => 0,
+ 'projectCount' => nil
)
expect(runner_data['tagList']).to match_array runner.tag_list
end
@@ -111,6 +113,51 @@ RSpec.describe 'Query.runner(id)' do
it_behaves_like 'runner details fetch', :inactive_runner
end
+ describe 'for multiple runners' do
+ let_it_be(:project1) { create(:project, :test_repo) }
+ let_it_be(:project2) { create(:project, :test_repo) }
+ let_it_be(:project_runner) do
+ create(:ci_runner, :project, projects: [project1, project2], description: 'Runner 1', contacted_at: 2.hours.ago,
+ active: true, version: 'adfe156', revision: 'a', locked: true, ip_address: '127.0.0.1', maximum_timeout: 600,
+ access_level: 0, run_untagged: true)
+ end
+
+ let!(:job) { create(:ci_build, runner: project_runner) }
+
+ context 'requesting project and job counts' do
+ let(:query) do
+ %(
+ query {
+ projectRunner: runner(id: "#{project_runner.to_global_id}") {
+ projectCount
+ jobCount
+ }
+ activeRunner: runner(id: "#{active_runner.to_global_id}") {
+ projectCount
+ jobCount
+ }
+ }
+ )
+ end
+
+ before do
+ post_graphql(query, current_user: user)
+ end
+
+ it 'retrieves expected fields' do
+ runner1_data = graphql_data_at(:project_runner)
+ runner2_data = graphql_data_at(:active_runner)
+
+ expect(runner1_data).to match a_hash_including(
+ 'jobCount' => 1,
+ 'projectCount' => 2)
+ expect(runner2_data).to match a_hash_including(
+ 'jobCount' => 0,
+ 'projectCount' => nil)
+ end
+ end
+ end
+
describe 'by regular user' do
let(:user) { create_default(:user) }
@@ -127,11 +174,14 @@ RSpec.describe 'Query.runner(id)' do
def runner_query(runner)
<<~SINGLE
runner(id: "#{runner.to_global_id}") {
- #{all_graphql_fields_for('CiRunner')}
+ #{all_graphql_fields_for('CiRunner', excluded: excluded_fields)}
}
SINGLE
end
+ # Currently excluding a known N+1 issue, see https://gitlab.com/gitlab-org/gitlab/-/issues/334759
+ let(:excluded_fields) { %w[jobCount] }
+
let(:single_query) do
<<~QUERY
{
diff --git a/storybook/config/webpack.config.js b/storybook/config/webpack.config.js
index bdfbc52dad5..c67f79b55a0 100644
--- a/storybook/config/webpack.config.js
+++ b/storybook/config/webpack.config.js
@@ -5,7 +5,7 @@ const path = require('path');
const sass = require('node-sass'); // eslint-disable-line import/no-unresolved
const { buildIncludePaths, resolveGlobUrl } = require('node-sass-magic-importer/dist/toolbox'); // eslint-disable-line import/no-unresolved
const webpack = require('webpack');
-const gitlabWebpackConfig = require('../../config/webpack.config.js');
+const gitlabWebpackConfig = require('../../config/webpack.config');
const ROOT = path.resolve(__dirname, '../../');
const TRANSPARENT_1X1_PNG =
diff --git a/workhorse/config_test.go b/workhorse/config_test.go
index b1b04cb9a65..5a2743f375a 100644
--- a/workhorse/config_test.go
+++ b/workhorse/config_test.go
@@ -101,6 +101,38 @@ func TestConfigDefaults(t *testing.T) {
require.Equal(t, expectedCfg, cfg)
}
+func TestCableConfigDefault(t *testing.T) {
+ backendURL, err := url.Parse("http://localhost:1234")
+ require.NoError(t, err)
+
+ args := []string{
+ "-authBackend", backendURL.String(),
+ }
+ boot, cfg, err := buildConfig("test", args)
+ require.NoError(t, err, "build config")
+
+ expectedBoot := &bootConfig{
+ secretPath: "./.gitlab_workhorse_secret",
+ listenAddr: "localhost:8181",
+ listenNetwork: "tcp",
+ logFormat: "text",
+ }
+
+ require.Equal(t, expectedBoot, boot)
+
+ expectedCfg := &config.Config{
+ Backend: backendURL,
+ CableBackend: backendURL,
+ Version: "(unknown version)",
+ DocumentRoot: "public",
+ ProxyHeadersTimeout: 5 * time.Minute,
+ APIQueueTimeout: queueing.DefaultTimeout,
+ APICILongPollingDuration: 50 * time.Nanosecond,
+ ImageResizerConfig: config.DefaultImageResizerConfig,
+ }
+ require.Equal(t, expectedCfg, cfg)
+}
+
func TestConfigFlagParsing(t *testing.T) {
backendURL, err := url.Parse("http://localhost:1234")
require.NoError(t, err)
diff --git a/workhorse/main.go b/workhorse/main.go
index de282b2c670..f5cb3f77746 100644
--- a/workhorse/main.go
+++ b/workhorse/main.go
@@ -95,7 +95,7 @@ func buildConfig(arg0 string, args []string) (*bootConfig, *config.Config, error
fset.StringVar(&cfg.Socket, "authSocket", "", "Optional: Unix domain socket to dial authBackend at")
// actioncable backend
- cableBackend := fset.String("cableBackend", upstream.DefaultBackend.String(), "ActionCable backend")
+ cableBackend := fset.String("cableBackend", "", "ActionCable backend")
fset.StringVar(&cfg.CableSocket, "cableSocket", "", "Optional: Unix domain socket to dial cableBackend at")
fset.StringVar(&cfg.DocumentRoot, "documentRoot", "public", "Path to static files content")
@@ -123,9 +123,14 @@ func buildConfig(arg0 string, args []string) (*bootConfig, *config.Config, error
return nil, nil, fmt.Errorf("authBackend: %v", err)
}
- cfg.CableBackend, err = parseAuthBackend(*cableBackend)
- if err != nil {
- return nil, nil, fmt.Errorf("cableBackend: %v", err)
+ if *cableBackend != "" {
+ // A custom -cableBackend has been specified
+ cfg.CableBackend, err = parseAuthBackend(*cableBackend)
+ if err != nil {
+ return nil, nil, fmt.Errorf("cableBackend: %v", err)
+ }
+ } else {
+ cfg.CableBackend = cfg.Backend
}
tomlData := ""