Skip to content
Snippets Groups Projects
Commit 76c253d3 authored by Leaminn Ma's avatar Leaminn Ma :two: Committed by Furkan Ayhan
Browse files

Removed PipelinesController#config_variables endpoint

This MR removes the PipelinesController#config_variables
endpoint as it is not in use. There is a GraphQL-equivalent
query that can be used for the same purpose.

Changelog: removed
parent 19468878
No related branches found
No related tags found
3 merge requests!118700Remove refactor_vulnerability_filters feature flag,!116602Draft: Resolve "Remove the possibility to set redis_slot in known_events",!116044Remove the Projects::PipelinesController#config_variables endpoint
......@@ -9,16 +9,16 @@ class Projects::PipelinesController < Projects::ApplicationController
urgency :low, [
:index, :new, :builds, :show, :failures, :create,
:stage, :retry, :dag, :cancel, :test_report,
:charts, :config_variables, :destroy, :status
:charts, :destroy, :status
]
before_action :disable_query_limiting, only: [:create, :retry]
before_action :pipeline, except: [:index, :new, :create, :charts, :config_variables]
before_action :pipeline, except: [:index, :new, :create, :charts]
before_action :set_pipeline_path, only: [:show]
before_action :authorize_read_pipeline!
before_action :authorize_read_build!, only: [:index, :show]
before_action :authorize_read_ci_cd_analytics!, only: [:charts]
before_action :authorize_create_pipeline!, only: [:new, :create, :config_variables]
before_action :authorize_create_pipeline!, only: [:new, :create]
before_action :authorize_update_pipeline!, only: [:retry, :cancel]
before_action :ensure_pipeline, only: [:show, :downloadable_artifacts]
before_action :reject_if_build_artifacts_size_refreshing!, only: [:destroy]
......@@ -45,7 +45,7 @@ class Projects::PipelinesController < Projects::ApplicationController
POLLING_INTERVAL = 10_000
feature_category :continuous_integration, [
:charts, :show, :config_variables, :stage, :cancel, :retry,
:charts, :show, :stage, :cancel, :retry,
:builds, :dag, :failures, :status,
:index, :create, :new, :destroy
]
......@@ -216,18 +216,6 @@ def test_report
end
end
def config_variables
respond_to do |format|
format.json do
# Even if the parameter name is `sha`, it is actually a ref name. We always send `ref` to the endpoint.
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/389065
result = Ci::ListConfigVariablesService.new(@project, current_user).execute(params[:sha])
result.nil? ? head(:no_content) : render(json: result)
end
end
end
def downloadable_artifacts
render json: Ci::DownloadableArtifactSerializer.new(
project: project,
......
......@@ -7,7 +7,6 @@
#js-new-pipeline{ data: { project_id: @project.id,
pipelines_path: project_pipelines_path(@project),
config_variables_path: config_variables_namespace_project_pipelines_path(@project.namespace, @project),
default_branch: @project.default_branch,
pipelines_editor_path: project_ci_pipeline_editor_path(@project),
can_view_pipeline_editor: can_view_pipeline_editor?(@project),
......
......@@ -7,7 +7,6 @@
scope '(*ref)', constraints: { ref: Gitlab::PathRegex.git_reference_regex } do
get :latest, action: :show, defaults: { latest: true }
end
get :config_variables
end
member do
......
......@@ -1311,148 +1311,6 @@ def delete_pipeline
end
end
describe 'GET config_variables.json', :use_clean_rails_memory_store_caching do
include ReactiveCachingHelpers
let(:ci_config) { '' }
let(:files) { { '.gitlab-ci.yml' => YAML.dump(ci_config) } }
let(:project) { create(:project, :auto_devops_disabled, :custom_repo, files: files) }
let(:service) { Ci::ListConfigVariablesService.new(project, user) }
before do
allow(Ci::ListConfigVariablesService)
.to receive(:new)
.and_return(service)
end
context 'when sending a valid ref' do
let(:ref) { 'master' }
let(:ci_config) do
{
variables: {
KEY1: { value: 'val 1', description: 'description 1' }
},
test: {
stage: 'test',
script: 'echo'
}
}
end
before do
synchronous_reactive_cache(service)
end
it 'returns variable list' do
get_config_variables
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['KEY1']).to eq({ 'value' => 'val 1', 'description' => 'description 1' })
end
end
context 'when sending an invalid ref' do
let(:ref) { 'invalid-ref' }
before do
synchronous_reactive_cache(service)
end
it 'returns empty json' do
get_config_variables
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to eq({})
end
end
context 'when sending an invalid config' do
let(:ref) { 'master' }
let(:ci_config) do
{
variables: {
KEY1: { value: 'val 1', description: 'description 1' }
},
test: {
stage: 'invalid',
script: 'echo'
}
}
end
before do
synchronous_reactive_cache(service)
end
it 'returns empty result' do
get_config_variables
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to eq({})
end
end
context 'when the cache is empty' do
let(:ref) { 'master' }
let(:ci_config) do
{
variables: {
KEY1: { value: 'val 1', description: 'description 1' }
},
test: {
stage: 'test',
script: 'echo'
}
}
end
it 'returns no content' do
get_config_variables
expect(response).to have_gitlab_http_status(:no_content)
end
end
context 'when project uses external project ci config' do
let(:other_project) { create(:project, :custom_repo, files: other_project_files) }
let(:other_project_files) { { '.gitlab-ci.yml' => YAML.dump(other_project_ci_config) } }
let(:ref) { 'master' }
let(:other_project_ci_config) do
{
variables: {
KEY1: { value: 'val 1', description: 'description 1' }
},
test: {
stage: 'test',
script: 'echo'
}
}
end
before do
other_project.add_developer(user)
project.update!(ci_config_path: ".gitlab-ci.yml@#{other_project.full_path}:master")
synchronous_reactive_cache(service)
end
it 'returns other project config variables' do
get_config_variables
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['KEY1']).to eq({ 'value' => 'val 1', 'description' => 'description 1' })
end
end
private
def get_config_variables
get :config_variables, params: {
namespace_id: project.namespace, project_id: project, sha: ref
}, format: :json
end
end
describe 'GET downloadable_artifacts.json' do
context 'when pipeline is empty' do
let(:pipeline) { create(:ci_empty_pipeline) }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment