Commit 8e4ff69e authored by Alper Akgun's avatar Alper Akgun

Merge branch '338908-remove-ci_create_external_pr_pipeline_async' into 'master'

Remove FF ci_create_external_pr_pipeline_async

See merge request gitlab-org/gitlab!73828
parents 4e580427 cb49dc14
......@@ -16,14 +16,9 @@ module Ci
private
def create_pipeline_for(pull_request)
if ::Feature.enabled?(:ci_create_external_pr_pipeline_async, project, default_enabled: :yaml)
Ci::ExternalPullRequests::CreatePipelineWorker.perform_async(
project.id, current_user.id, pull_request.id
)
else
Ci::CreatePipelineService.new(project, current_user, create_params(pull_request))
.execute(:external_pull_request_event, external_pull_request: pull_request)
end
Ci::ExternalPullRequests::CreatePipelineWorker.perform_async(
project.id, current_user.id, pull_request.id
)
end
def create_params(pull_request)
......
---
name: ci_create_external_pr_pipeline_async
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68567
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/338908
milestone: '14.3'
type: development
group: group::pipeline authoring
default_enabled: true
......@@ -84,29 +84,6 @@ RSpec.describe API::ProjectMirror do
subject(:send_request) { do_post(params: params) }
shared_examples_for 'triggering pipeline creation' do
context 'when the FF ci_create_external_pr_pipeline_async is disabled' do
before do
stub_feature_flags(ci_create_external_pr_pipeline_async: false)
end
let(:create_pipeline_service) { instance_double(Ci::CreatePipelineService) }
it 'triggers a pipeline for pull request' do
expect(Ci::CreatePipelineService)
.to receive(:new)
.with(project_mirrored, user, pipeline_params)
.and_return(create_pipeline_service)
expect(create_pipeline_service)
.to receive(:execute)
.with(:external_pull_request_event, any_args)
send_request
expect(response).to have_gitlab_http_status(:ok)
end
end
it 'enqueues Ci::ExternalPullRequests::CreatePipelineWorker' do
expect { send_request }
.to change { ExternalPullRequest.count }.by(1)
......
......@@ -53,29 +53,6 @@ RSpec.describe Ci::ExternalPullRequests::ProcessGithubEventService do
let(:source_branch) { branch.name }
let(:source_sha) { branch.target }
context 'when the FF ci_create_external_pr_pipeline_async is disabled' do
before do
stub_feature_flags(ci_create_external_pr_pipeline_async: false)
end
let(:create_pipeline_service) { instance_double(Ci::CreatePipelineService) }
it 'creates a pipeline and the external pull request' do
pipeline_params = {
ref: Gitlab::Git::BRANCH_REF_PREFIX + branch.name,
source_sha: branch.target,
target_sha: 'a09386439ca39abe575675ffd4b89ae824fec22f'
}
expect(Ci::CreatePipelineService).to receive(:new)
.with(project, user, pipeline_params)
.and_return(create_pipeline_service)
expect(create_pipeline_service).to receive(:execute)
.with(:external_pull_request_event, any_args)
expect { subject.execute(params) }.to change { ExternalPullRequest.count }.by(1)
end
end
it 'enqueues Ci::ExternalPullRequests::CreatePipelineWorker' do
expect { subject.execute(params) }
.to change { ExternalPullRequest.count }.by(1)
......
......@@ -26,28 +26,6 @@ RSpec.describe Ci::ExternalPullRequests::CreatePipelineService do
pull_request.update!(source_branch: source_branch.name, source_sha: source_branch.target)
end
context 'when the FF ci_create_external_pr_pipeline_async is disabled' do
before do
stub_feature_flags(ci_create_external_pr_pipeline_async: false)
end
it 'creates a pipeline for external pull request', :aggregate_failures do
pipeline = execute.payload
expect(execute).to be_success
expect(pipeline).to be_valid
expect(pipeline).to be_persisted
expect(pipeline).to be_external_pull_request_event
expect(pipeline).to eq(project.ci_pipelines.last)
expect(pipeline.external_pull_request).to eq(pull_request)
expect(pipeline.user).to eq(user)
expect(pipeline.status).to eq('created')
expect(pipeline.ref).to eq(pull_request.source_branch)
expect(pipeline.sha).to eq(pull_request.source_sha)
expect(pipeline.source_sha).to eq(pull_request.source_sha)
end
end
it 'enqueues Ci::ExternalPullRequests::CreatePipelineWorker' do
expect { execute }
.to change { ::Ci::ExternalPullRequests::CreatePipelineWorker.jobs.count }
......
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