diff --git a/app/assets/javascripts/pages/projects/ci/secure_files/show/index.js b/app/assets/javascripts/pages/projects/ci/secure_files/show/index.js deleted file mode 100644 index 614866066653c1872bddc75a90c662f48788a99c..0000000000000000000000000000000000000000 --- a/app/assets/javascripts/pages/projects/ci/secure_files/show/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import { initCiSecureFiles } from '~/ci_secure_files'; - -initCiSecureFiles(); diff --git a/app/controllers/projects/ci/secure_files_controller.rb b/app/controllers/projects/ci/secure_files_controller.rb deleted file mode 100644 index 59ddca19081bb2f3c0f5e70f768bb81543a51937..0000000000000000000000000000000000000000 --- a/app/controllers/projects/ci/secure_files_controller.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class Projects::Ci::SecureFilesController < Projects::ApplicationController - before_action :authorize_read_secure_files! - - feature_category :pipeline_authoring - - def show - render_404 unless Feature.enabled?(:ci_secure_files, project) - end -end diff --git a/app/views/projects/ci/secure_files/show.html.haml b/app/views/projects/ci/secure_files/show.html.haml deleted file mode 100644 index 1a87ccd753c398a56531da1ce7e180184e861fcb..0000000000000000000000000000000000000000 --- a/app/views/projects/ci/secure_files/show.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -- page_title s_('Secure Files') - -#js-ci-secure-files{ data: { project_id: @project.id, admin: can?(current_user, :admin_secure_files, @project).to_s, file_size_limit: Ci::SecureFile::FILE_SIZE_LIMIT.to_mb } } diff --git a/config/routes/project.rb b/config/routes/project.rb index 628fa3ad37bb7d8f3b4d7a1ab0532b433a3dbe9c..d22029b605519c010a58dd636f9c3b3b4c440002 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -96,7 +96,6 @@ namespace :ci do resource :lint, only: [:show, :create] resource :pipeline_editor, only: [:show], controller: :pipeline_editor, path: 'editor' - resource :secure_files, only: [:show], controller: :secure_files, path: 'secure_files' resources :daily_build_group_report_results, only: [:index], constraints: { format: /(csv|json)/ } namespace :prometheus_metrics do resources :histograms, only: [:create], constraints: { format: 'json' } diff --git a/spec/controllers/projects/ci/secure_files_controller_spec.rb b/spec/controllers/projects/ci/secure_files_controller_spec.rb deleted file mode 100644 index 200997e31b98d1141e9d83814c890e8983c2cbeb..0000000000000000000000000000000000000000 --- a/spec/controllers/projects/ci/secure_files_controller_spec.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Projects::Ci::SecureFilesController do - let_it_be(:project) { create(:project) } - let_it_be(:user) { create(:user) } - - subject(:show_request) { get :show, params: { namespace_id: project.namespace, project_id: project } } - - describe 'GET #show' do - context 'when the :ci_secure_files feature flag is enabled' do - context 'with enough privileges' do - before do - stub_feature_flags(ci_secure_files: true) - sign_in(user) - project.add_developer(user) - show_request - end - - it { expect(response).to have_gitlab_http_status(:ok) } - - it 'renders show page' do - expect(response).to render_template :show - end - end - end - - context 'when the :ci_secure_files feature flag is disabled' do - context 'with enough privileges' do - before do - stub_feature_flags(ci_secure_files: false) - sign_in(user) - project.add_developer(user) - show_request - end - - it 'responds with 404' do - expect(response).to have_gitlab_http_status(:not_found) - end - end - end - - context 'without enough privileges' do - before do - sign_in(user) - project.add_reporter(user) - show_request - end - - it 'responds with 404' do - expect(response).to have_gitlab_http_status(:not_found) - end - end - - context 'an unauthenticated user' do - before do - show_request - end - - it 'redirects to sign in' do - expect(response).to have_gitlab_http_status(:found) - expect(response).to redirect_to('/users/sign_in') - end - end - end -end diff --git a/spec/features/projects/ci/secure_files_spec.rb b/spec/features/projects/ci/secure_files_spec.rb deleted file mode 100644 index 412330eb5d622b39cd537a5f7a00e3ac1e16bab0..0000000000000000000000000000000000000000 --- a/spec/features/projects/ci/secure_files_spec.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'Secure Files', :js do - let(:project) { create(:project) } - let(:user) { create(:user) } - - before do - stub_feature_flags(ci_secure_files_read_only: false) - project.add_maintainer(user) - sign_in(user) - end - - it 'user sees the Secure Files list component' do - visit project_ci_secure_files_path(project) - expect(page).to have_content('There are no secure files yet.') - end - - it 'prompts the user to confirm before deleting a file' do - file = create(:ci_secure_file, project: project) - - visit project_ci_secure_files_path(project) - - expect(page).to have_content(file.name) - - find('button.btn-danger').click - - expect(page).to have_content("Delete #{file.name}?") - - click_on('Delete secure file') - - visit project_ci_secure_files_path(project) - - expect(page).not_to have_content(file.name) - end - - it 'displays an uploaded file in the file list' do - visit project_ci_secure_files_path(project) - expect(page).to have_content('There are no secure files yet.') - - page.attach_file('spec/fixtures/ci_secure_files/upload-keystore.jks') do - click_button 'Upload File' - end - - expect(page).to have_content('upload-keystore.jks') - end - - it 'displays an error when a duplicate file upload is attempted' do - create(:ci_secure_file, project: project, name: 'upload-keystore.jks') - visit project_ci_secure_files_path(project) - - expect(page).to have_content('upload-keystore.jks') - - page.attach_file('spec/fixtures/ci_secure_files/upload-keystore.jks') do - click_button 'Upload File' - end - - expect(page).to have_content('A file with this name already exists.') - end -end diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index 1d58a31bd6ee9cdae9f128f80cb0311c2a4bb86a..5d560620b85870f164ef2995389a3ad8d6876656 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -953,12 +953,6 @@ def show_with_template_type(template_type) end end - describe Projects::Ci::SecureFilesController, 'routing' do - it 'to #show' do - expect(get('/gitlab/gitlabhq/-/ci/secure_files')).to route_to('projects/ci/secure_files#show', namespace_id: 'gitlab', project_id: 'gitlabhq') - end - end - context 'with a non-existent project' do it 'routes to 404 with get request' do expect(get: "/gitlab/not_exist").to route_to(