Commit 89a4f476 authored by 🤖 GitLab Bot 🤖's avatar 🤖 GitLab Bot 🤖

Add latest changes from gitlab-org/[email protected]

parent 3e78ae6e
......@@ -6,7 +6,7 @@ export default class FilteredSearchTokenizer {
// Values that start with a double quote must end in a double quote (same for single)
const tokenRegex = new RegExp(
`(${allowedKeys.join('|')}):(=|!=)?([~%@]?)(?:('[^']*'{0,1})|("[^"]*"{0,1})|(\\S+))`,
`(${allowedKeys.join('|')}):(=|!=)?([~%@&]?)(?:('[^']*'{0,1})|("[^"]*"{0,1})|(\\S+))`,
'g',
);
const tokens = [];
......@@ -15,17 +15,19 @@ export default class FilteredSearchTokenizer {
const searchToken =
input
.replace(tokenRegex, (match, key, operator, symbol, v1, v2, v3) => {
const prefixedTokens = ['~', '%', '@', '&'];
const comparisonTokens = ['!=', '='];
let tokenValue = v1 || v2 || v3;
let tokenSymbol = symbol;
let tokenIndex = '';
let tokenOperator = operator;
if (tokenValue === '~' || tokenValue === '%' || tokenValue === '@') {
if (prefixedTokens.includes(tokenValue)) {
tokenSymbol = tokenValue;
tokenValue = '';
}
if (tokenValue === '!=' || tokenValue === '=') {
if (comparisonTokens.includes(tokenValue)) {
tokenOperator = tokenValue;
tokenValue = '';
}
......
......@@ -162,10 +162,6 @@ $mr-widget-min-height: 69px;
.btn {
font-size: $gl-font-size;
&[disabled] {
opacity: 0.3;
}
&.dropdown-toggle {
.fa {
color: inherit;
......
......@@ -539,7 +539,6 @@ module Ci
.concat(job_variables)
.concat(environment_changed_page_variables)
.concat(persisted_environment_variables)
.concat(deploy_freeze_variables)
.to_runner_variables
end
end
......@@ -595,18 +594,6 @@ module Ci
end
end
def deploy_freeze_variables
Gitlab::Ci::Variables::Collection.new.tap do |variables|
break variables unless freeze_period?
variables.append(key: 'CI_DEPLOY_FREEZE', value: 'true')
end
end
def freeze_period?
Ci::FreezePeriodStatus.new(project: project).execute
end
def dependency_variables
return [] if all_dependencies.empty?
......
......@@ -604,6 +604,10 @@ module Ci
project.deployment_platform&.active?
end
def freeze_period?
Ci::FreezePeriodStatus.new(project: project).execute
end
def has_warnings?
number_of_warnings.positive?
end
......@@ -714,6 +718,7 @@ module Ci
end
variables.append(key: 'CI_KUBERNETES_ACTIVE', value: 'true') if has_kubernetes_active?
variables.append(key: 'CI_DEPLOY_FREEZE', value: 'true') if freeze_period?
if external_pull_request_event? && external_pull_request
variables.concat(external_pull_request.predefined_variables)
......
---
title: Properly set CI_DEPLOY_FREEZE variable in pipelines
merge_request: 35226
author:
type: fixed
---
title: Fix styling bug for disabled merge button
merge_request: 35365
author:
type: fixed
......@@ -2,7 +2,7 @@
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29382) in GitLab 13.0.
You can use the Freeze Periods API to manipulate GitLab's [Freeze Period](../user/project/releases/index.md#set-a-deploy-freeze) entries.
You can use the Freeze Periods API to manipulate GitLab's [Freeze Period](../user/project/releases/index.md#prevent-unintentional-releases-by-setting-a-deploy-freeze) entries.
## Permissions and security
......
......@@ -7,7 +7,7 @@ that help maintain deployment security and stability.
You can:
- [Restrict write-access to a critical environment](#restrict-write-access-to-a-critical-environment)
- [Restrict deployments for a particular period](#restrict-deployments-for-a-particular-period)
- [Prevent deployments during deploy freeze windows](#prevent-deployments-during-deploy-freeze-windows)
If you are using a continuous deployment workflow and want to ensure that concurrent deployments to the same environment do not happen, you should enable the following options:
......@@ -77,10 +77,10 @@ The improved pipeline flow **after** enabling Skip outdated deployment jobs:
1. The `deploy` job in Pipeline-B finishes first, and deploys the newer code.
1. The `deploy` job in Pipeline-A is automatically cancelled, so that it doesn't overwrite the deployment from the newer pipeline.
## Restrict deployments for a particular period
## Prevent deployments during deploy freeze windows
If you want to prevent deployments for a particular period, for example during a planned
vacation period when most employees are out, you can set up a [Deploy Freeze](../../user/project/releases/index.md#set-a-deploy-freeze).
vacation period when most employees are out, you can set up a [Deploy Freeze](../../user/project/releases/index.md#prevent-unintentional-releases-by-setting-a-deploy-freeze).
During a deploy freeze period, no deployment can be executed. This is helpful to
ensure that deployments do not happen unexpectedly.
......
......@@ -431,7 +431,7 @@ in GitLab that helps maintain deployment security and stability.
- [Restrict write-access to a critical environment](deployment_safety.md#restrict-write-access-to-a-critical-environment)
- [Limit the job-concurrency for deployment jobs](deployment_safety.md#ensure-only-one-deployment-job-runs-at-a-time)
- [Skip outdated deployment jobs](deployment_safety.md#skip-outdated-deployment-jobs)
- [Restrict deployments for a particular period](deployment_safety.md#restrict-deployments-for-a-particular-period)
- [Prevent deployments during deploy freeze windows](deployment_safety.md#prevent-deployments-during-deploy-freeze-windows)
### Complete example
......
......@@ -62,8 +62,7 @@ We are building a [JenkinsFile Wrapper](https://gitlab.com/gitlab-org/jfr-contai
you to run a complete Jenkins instance inside of a GitLab job, including plugins. This can help ease the process
of transition, by letting you delay the migration of less urgent pipelines for a period of time.
If you are interested, join our [public testing issue](https://gitlab.com/gitlab-org/gitlab/-/issues/215675) to
If you are interested, you might be able to [help GitLab test the wrapper](https://gitlab.com/gitlab-org/gitlab/-/issues/215675).
If you are interested in helping GitLab test the wrapper, join our [public testing issue](https://gitlab.com/gitlab-org/gitlab/-/issues/215675) for instructions and to provide your feedback.
## Important product differences
......
......@@ -29,7 +29,7 @@ Similarly, milestones can be used as releases. To do so:
1. Set the milestone title to the version of your release, such as `Version 9.4`.
1. Add an issue to your release by associating the desired milestone from the issue's right-hand sidebar.
Additionally, you can integrate milestones with GitLab's [Releases feature](../releases/index.md#releases-associated-with-milestones).
Additionally, you can integrate milestones with GitLab's [Releases feature](../releases/index.md#associate-milestones-with-a-release).
## Project milestones and group milestones
......
This diff is collapsed.
......@@ -131,6 +131,8 @@ module API
mount ::API::Boards
mount ::API::Branches
mount ::API::BroadcastMessages
mount ::API::Ci::Runner
mount ::API::Ci::Runners
mount ::API::Commits
mount ::API::CommitStatuses
mount ::API::ContainerRegistryEvent
......@@ -195,8 +197,6 @@ module API
mount ::API::Release::Links
mount ::API::RemoteMirrors
mount ::API::Repositories
mount ::API::Runner
mount ::API::Runners
mount ::API::Search
mount ::API::Services
mount ::API::Settings
......
This diff is collapsed.
This diff is collapsed.
......@@ -60,7 +60,7 @@ module API
not_found! 'Commit' unless commit
# Since the CommitStatus is attached to Ci::Pipeline (in the future Pipeline)
# Since the CommitStatus is attached to ::Ci::Pipeline (in the future Pipeline)
# We need to always have the pipeline object
# To have a valid pipeline object that can be attached to specific MR
# Other CI service needs to send `ref`
......
......@@ -48,7 +48,7 @@ module API
requires :value, type: String, desc: 'The value of the variable'
optional :protected, type: String, desc: 'Whether the variable is protected'
optional :masked, type: String, desc: 'Whether the variable is masked'
optional :variable_type, type: String, values: Ci::GroupVariable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file. Defaults to env_var'
optional :variable_type, type: String, values: ::Ci::GroupVariable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file. Defaults to env_var'
end
post ':id/variables' do
variable_params = declared_params(include_missing: false)
......@@ -70,7 +70,7 @@ module API
optional :value, type: String, desc: 'The value of the variable'
optional :protected, type: String, desc: 'Whether the variable is protected'
optional :masked, type: String, desc: 'Whether the variable is masked'
optional :variable_type, type: String, values: Ci::GroupVariable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file'
optional :variable_type, type: String, values: ::Ci::GroupVariable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file'
end
# rubocop: disable CodeReuse/ActiveRecord
put ':id/variables/:key' do
......
......@@ -60,7 +60,7 @@ module API
def current_job
strong_memoize(:current_job) do
Ci::Build.find_by_id(params[:id])
::Ci::Build.find_by_id(params[:id])
end
end
......
......@@ -160,7 +160,7 @@ module API
authorize!(:update_build, build)
break forbidden!('Job is not retryable') unless build.retryable?
build = Ci::Build.retry(build, current_user)
build = ::Ci::Build.retry(build, current_user)
present build, with: Entities::Job
end
......
......@@ -22,7 +22,7 @@ module API
get ':id/pipeline_schedules' do
authorize! :read_pipeline_schedule, user_project
schedules = Ci::PipelineSchedulesFinder.new(user_project).execute(scope: params[:scope])
schedules = ::Ci::PipelineSchedulesFinder.new(user_project).execute(scope: params[:scope])
.preload([:owner, :last_pipeline])
present paginate(schedules), with: Entities::PipelineSchedule
end
......@@ -51,7 +51,7 @@ module API
post ':id/pipeline_schedules' do
authorize! :create_pipeline_schedule, user_project
pipeline_schedule = Ci::CreatePipelineScheduleService
pipeline_schedule = ::Ci::CreatePipelineScheduleService
.new(user_project, current_user, declared_params(include_missing: false))
.execute
......@@ -137,7 +137,7 @@ module API
requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id'
requires :key, type: String, desc: 'The key of the variable'
requires :value, type: String, desc: 'The value of the variable'
optional :variable_type, type: String, values: Ci::PipelineScheduleVariable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file. Defaults to env_var'
optional :variable_type, type: String, values: ::Ci::PipelineScheduleVariable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file. Defaults to env_var'
end
post ':id/pipeline_schedules/:pipeline_schedule_id/variables' do
authorize! :update_pipeline_schedule, pipeline_schedule
......@@ -158,7 +158,7 @@ module API
requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id'
requires :key, type: String, desc: 'The key of the variable'
optional :value, type: String, desc: 'The value of the variable'
optional :variable_type, type: String, values: Ci::PipelineScheduleVariable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file'
optional :variable_type, type: String, values: ::Ci::PipelineScheduleVariable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file'
end
put ':id/pipeline_schedules/:pipeline_schedule_id/variables/:key' do
authorize! :update_pipeline_schedule, pipeline_schedule
......
......@@ -18,7 +18,7 @@ module API
use :pagination
optional :scope, type: String, values: %w[running pending finished branches tags],
desc: 'The scope of pipelines'
optional :status, type: String, values: Ci::HasStatus::AVAILABLE_STATUSES,
optional :status, type: String, values: ::Ci::HasStatus::AVAILABLE_STATUSES,
desc: 'The status of pipelines'
optional :ref, type: String, desc: 'The ref of pipelines'
optional :sha, type: String, desc: 'The sha of pipelines'
......@@ -27,7 +27,7 @@ module API
optional :username, type: String, desc: 'The username of the user who triggered pipelines'
optional :updated_before, type: DateTime, desc: 'Return pipelines updated before the specified datetime. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ'
optional :updated_after, type: DateTime, desc: 'Return pipelines updated after the specified datetime. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ'
optional :order_by, type: String, values: Ci::PipelinesFinder::ALLOWED_INDEXED_COLUMNS, default: 'id',
optional :order_by, type: String, values: ::Ci::PipelinesFinder::ALLOWED_INDEXED_COLUMNS, default: 'id',
desc: 'Order pipelines'
optional :sort, type: String, values: %w[asc desc], default: 'desc',
desc: 'Sort pipelines'
......@@ -36,7 +36,7 @@ module API
authorize! :read_pipeline, user_project
authorize! :read_build, user_project
pipelines = Ci::PipelinesFinder.new(user_project, current_user, params).execute
pipelines = ::Ci::PipelinesFinder.new(user_project, current_user, params).execute
present paginate(pipelines), with: Entities::PipelineBasic
end
......@@ -57,9 +57,9 @@ module API
.merge(variables_attributes: params[:variables])
.except(:variables)
new_pipeline = Ci::CreatePipelineService.new(user_project,
current_user,
pipeline_params)
new_pipeline = ::Ci::CreatePipelineService.new(user_project,
current_user,
pipeline_params)
.execute(:api, ignore_skip_ci: true, save_on_errors: false)
if new_pipeline.persisted?
......
This diff is collapsed.
This diff is collapsed.
......@@ -32,7 +32,7 @@ module API
project = find_project(params[:id])
not_found! unless project
result = Ci::PipelineTriggerService.new(project, nil, params).execute
result = ::Ci::PipelineTriggerService.new(project, nil, params).execute
not_found! unless result
if result[:http_status]
......
......@@ -56,7 +56,7 @@ module API
requires :value, type: String, desc: 'The value of the variable'
optional :protected, type: Boolean, desc: 'Whether the variable is protected'
optional :masked, type: Boolean, desc: 'Whether the variable is masked'
optional :variable_type, type: String, values: Ci::Variable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file. Defaults to env_var'
optional :variable_type, type: String, values: ::Ci::Variable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file. Defaults to env_var'
optional :environment_scope, type: String, desc: 'The environment_scope of the variable'
end
post ':id/variables' do
......@@ -80,7 +80,7 @@ module API
optional :value, type: String, desc: 'The value of the variable'
optional :protected, type: Boolean, desc: 'Whether the variable is protected'
optional :masked, type: Boolean, desc: 'Whether the variable is masked'
optional :variable_type, type: String, values: Ci::Variable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file'
optional :variable_type, type: String, values: ::Ci::Variable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file'
optional :environment_scope, type: String, desc: 'The environment_scope of the variable'
end
# rubocop: disable CodeReuse/ActiveRecord
......
......@@ -558,6 +558,18 @@ module Gitlab
end
end
def issue_minimum_id
strong_memoize(:issue_minimum_id) do
::Issue.minimum(:id)
end
end
def issue_maximum_id
strong_memoize(:issue_maximum_id) do
::Issue.maximum(:id)
end
end
def clear_memoized
clear_memoization(:user_minimum_id)
clear_memoization(:user_maximum_id)
......
......@@ -165,10 +165,13 @@ RSpec.describe Gitlab::Database::PartitioningMigrationHelpers::TableManagementHe
it 'creates a partition spanning over each month in the range given' do
migration.partition_table_by_date template_table, partition_column, min_date: min_date, max_date: max_date
expect_range_partition_of("#{partitioned_table}_000000", partitioned_table, 'MINVALUE', "'2019-12-01 00:00:00'")
expect_range_partition_of("#{partitioned_table}_201912", partitioned_table, "'2019-12-01 00:00:00'", "'2020-01-01 00:00:00'")
expect_range_partition_of("#{partitioned_table}_202001", partitioned_table, "'2020-01-01 00:00:00'", "'2020-02-01 00:00:00'")
expect_range_partition_of("#{partitioned_table}_202002", partitioned_table, "'2020-02-01 00:00:00'", "'2020-03-01 00:00:00'")
expect_range_partitions_for(partitioned_table, {
'000000' => ['MINVALUE', "'2019-12-01 00:00:00'"],
'201912' => ["'2019-12-01 00:00:00'", "'2020-01-01 00:00:00'"],
'202001' => ["'2020-01-01 00:00:00'", "'2020-02-01 00:00:00'"],
'202002' => ["'2020-02-01 00:00:00'", "'2020-03-01 00:00:00'"],
'202003' => ["'2020-03-01 00:00:00'", "'2020-04-01 00:00:00'"]
})
end
end
......
......@@ -2974,19 +2974,6 @@ RSpec.describe Ci::Build do
it { is_expected.to include(deployment_variable) }
end
context 'when build has a freeze period' do
let(:freeze_variable) { { key: 'CI_DEPLOY_FREEZE', value: 'true', masked: false, public: true } }
before do
expect_next_instance_of(Ci::FreezePeriodStatus) do |freeze_period|
expect(freeze_period).to receive(:execute)
.and_return(true)
end
end
it { is_expected.to include(freeze_variable) }
end
context 'when project has default CI config path' do
let(:ci_config_path) { { key: 'CI_CONFIG_PATH', value: '.gitlab-ci.yml', public: true, masked: false } }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
include StubGitlabCalls
include RedisHelpers
include WorkhorseHelpers
......@@ -13,7 +13,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
stub_feature_flags(ci_enable_live_trace: true)
stub_gitlab_calls
stub_application_setting(runners_registration_token: registration_token)
allow_any_instance_of(Ci::Runner).to receive(:cache_attributes)
allow_any_instance_of(::Ci::Runner).to receive(:cache_attributes)
end
describe '/api/v4/runners' do
......@@ -38,7 +38,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
it 'creates runner with default values' do
post api('/runners'), params: { token: registration_token }
runner = Ci::Runner.first
runner = ::Ci::Runner.first
expect(response).to have_gitlab_http_status(:created)
expect(json_response['id']).to eq(runner.id)
......@@ -57,7 +57,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
expect(response).to have_gitlab_http_status(:created)
expect(project.runners.size).to eq(1)
runner = Ci::Runner.first
runner = ::Ci::Runner.first
expect(runner.token).not_to eq(registration_token)
expect(runner.token).not_to eq(project.runners_token)
expect(runner).to be_project_type
......@@ -72,7 +72,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
expect(response).to have_gitlab_http_status(:created)
expect(group.runners.reload.size).to eq(1)
runner = Ci::Runner.first
runner = ::Ci::Runner.first
expect(runner.token).not_to eq(registration_token)
expect(runner.token).not_to eq(group.runners_token)
expect(runner).to be_group_type
......@@ -88,7 +88,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
}
expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.description).to eq('server.hostname')
expect(::Ci::Runner.first.description).to eq('server.hostname')
end
end
......@@ -100,7 +100,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
}
expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.tag_list.sort).to eq(%w(tag1 tag2))
expect(::Ci::Runner.first.tag_list.sort).to eq(%w(tag1 tag2))
end
end
......@@ -114,8 +114,8 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
}
expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.run_untagged).to be false
expect(Ci::Runner.first.tag_list.sort).to eq(['tag'])
expect(::Ci::Runner.first.run_untagged).to be false
expect(::Ci::Runner.first.tag_list.sort).to eq(['tag'])
end
end
......@@ -141,7 +141,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
}
expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.locked).to be true
expect(::Ci::Runner.first.locked).to be true
end
end
......@@ -154,7 +154,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
}
expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.active).to be true
expect(::Ci::Runner.first.active).to be true
end
end
......@@ -166,7 +166,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
}
expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.active).to be false
expect(::Ci::Runner.first.active).to be false
end
end
end
......@@ -180,7 +180,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
}
expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.ref_protected?).to be true
expect(::Ci::Runner.first.ref_protected?).to be true
end
end
......@@ -192,7 +192,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
}
expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.ref_protected?).to be false
expect(::Ci::Runner.first.ref_protected?).to be false
end
end
end
......@@ -205,7 +205,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
}
expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.maximum_timeout).to eq(9000)
expect(::Ci::Runner.first.maximum_timeout).to eq(9000)
end
context 'when maximum job timeout is empty' do
......@@ -216,7 +216,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
}
expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.maximum_timeout).to be_nil
expect(::Ci::Runner.first.maximum_timeout).to be_nil
end
end
end
......@@ -232,7 +232,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
}
expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.read_attribute(param.to_sym)).to eq(value)
expect(::Ci::Runner.first.read_attribute(param.to_sym)).to eq(value)
end
end
end
......@@ -243,7 +243,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
headers: { 'X-Forwarded-For' => '123.111.123.111' }
expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.ip_address).to eq('123.111.123.111')
expect(::Ci::Runner.first.ip_address).to eq('123.111.123.111')
end
end
......@@ -271,7 +271,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
delete api('/runners'), params: { token: runner.token }
expect(response).to have_gitlab_http_status(:no_content)
expect(Ci::Runner.count).to eq(0)
expect(::Ci::Runner.count).to eq(0)
end
it_behaves_like '412 response' do
......@@ -537,7 +537,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
end
it 'creates persistent ref' do
expect_any_instance_of(Ci::PersistentRef).to receive(:create_ref)
expect_any_instance_of(::Ci::PersistentRef).to receive(:create_ref)
.with(job.sha, "refs/#{Repository::REF_PIPELINES}/#{job.commit_id}")
request_job info: { platform: :darwin }
......@@ -749,7 +749,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
context 'when concurrently updating a job' do
before do
expect_any_instance_of(Ci::Build).to receive(:run!)
expect_any_instance_of(::Ci::Build).to receive(:run!)
.and_raise(ActiveRecord::StaleObjectError.new(nil, nil))
end
......@@ -890,7 +890,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
let!(:trigger_request) { create(:ci_trigger_request, pipeline: pipeline, builds: [job], trigger: trigger) }
before do
project.variables << Ci::Variable.new(key: 'SECRET_KEY', value: 'secret_value')
project.variables << ::Ci::Variable.new(key: 'SECRET_KEY', value: 'secret_value')
end
shared_examples 'expected variables behavior' do
......@@ -1099,7 +1099,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
let_it_be(:project) { create(:project, :repository) }
let(:runner) { create(:ci_runner, :project, projects: [project]) }
let(:service) { Ci::CreateWebIdeTerminalService.new(project, user, ref: 'master').execute }
let(:service) { ::Ci::CreateWebIdeTerminalService.new(project, user, ref: 'master').execute }
let(:pipeline) { service[:pipeline] }
let(:build) { pipeline.builds.first }
let(:job) { {} }
......@@ -2258,7 +2258,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
FileUtils.remove_entry(new_tmpdir)
end
it' "fails to post artifacts for outside of tmp path"' do
it 'fails to post artifacts for outside of tmp path' do
upload_artifacts(file_upload, headers_with_token)
expect(response).to have_gitlab_http_status(:bad_request)
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe API::Runners do
RSpec.describe API::Ci::Runners do
let_it_be(:admin) { create(:user, :admin) }
let_it_be(:user) { create(:user) }
let_it_be(:user2) { create(:user) }
......@@ -266,7 +266,7 @@ RSpec.describe API::Runners do
delete api("/runners/#{unused_project_runner.id}", admin)
expect(response).to have_gitlab_http_status(:no_content)
end.to change { Ci::Runner.project_type.count }.by(-1)
end.to change { ::Ci::Runner.project_type.count }.by(-1)
end
end
......@@ -493,7 +493,7 @@ RSpec.describe API::Runners do
delete api("/runners/#{shared_runner.id}", admin)