Commit f318bef3 authored by Arturo Herrero's avatar Arturo Herrero

Merge branch 'remove-artifact-paths-redux' into 'master'

Remove duplicate paths from an internal API serializer [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!55800
parents c5fe30ab 07ca5b5e
...@@ -21,11 +21,17 @@ class BuildArtifactEntity < Grape::Entity ...@@ -21,11 +21,17 @@ class BuildArtifactEntity < Grape::Entity
) )
end end
expose :keep_path, if: -> (*) { artifact.expiring? } do |artifact| expose :keep_path, if: -> (*) { artifact.expiring? && show_duplicated_paths?(artifact.project) } do |artifact|
fast_keep_project_job_artifacts_path(artifact.project, artifact.job) fast_keep_project_job_artifacts_path(artifact.project, artifact.job)
end end
expose :browse_path do |artifact| expose :browse_path, if: -> (*) { show_duplicated_paths?(artifact.project) } do |artifact|
fast_browse_project_job_artifacts_path(artifact.project, artifact.job) fast_browse_project_job_artifacts_path(artifact.project, artifact.job)
end end
private
def show_duplicated_paths?(project)
!Gitlab::Ci::Features.remove_duplicate_artifact_exposure_paths?(project)
end
end end
---
name: remove_duplicate_artifact_exposure_paths
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/54611
rollout_issue_url:
milestone: '13.10'
type: development
group: group::testing
default_enabled: false
...@@ -71,6 +71,10 @@ module Gitlab ...@@ -71,6 +71,10 @@ module Gitlab
def self.ci_commit_pipeline_mini_graph_vue_enabled?(project) def self.ci_commit_pipeline_mini_graph_vue_enabled?(project)
::Feature.enabled?(:ci_commit_pipeline_mini_graph_vue, project, default_enabled: :yaml) ::Feature.enabled?(:ci_commit_pipeline_mini_graph_vue, project, default_enabled: :yaml)
end end
def self.remove_duplicate_artifact_exposure_paths?(project)
::Feature.enabled?(:remove_duplicate_artifact_exposure_paths, project, default_enabled: :yaml)
end
end end
end end
end end
...@@ -21,15 +21,30 @@ RSpec.describe BuildArtifactEntity do ...@@ -21,15 +21,30 @@ RSpec.describe BuildArtifactEntity do
expect(subject).to include(:expired, :expire_at) expect(subject).to include(:expired, :expire_at)
end end
it 'contains paths to the artifacts' do it 'exposes the artifact download path' do
expect(subject[:path]) expect(subject[:path]).to include "jobs/#{job.id}/artifacts/download?file_type=codequality"
.to include "jobs/#{job.id}/artifacts/download?file_type=codequality" end
context 'with remove_duplicate_artifact_exposure_paths enabled' do
before do
stub_feature_flags(remove_duplicate_artifact_exposure_paths: true)
end
it 'has no keep or browse path' do
expect(subject).not_to include(:keep_path)
expect(subject).not_to include(:browse_path)
end
end
expect(subject[:keep_path]) context 'with remove_duplicate_artifact_exposure_paths disabled' do
.to include "jobs/#{job.id}/artifacts/keep" before do
stub_feature_flags(remove_duplicate_artifact_exposure_paths: false)
end
expect(subject[:browse_path]) it 'has keep and browse paths' do
.to include "jobs/#{job.id}/artifacts/browse" expect(subject[:keep_path]).to be_present
expect(subject[:browse_path]).to be_present
end
end end
end end
end end
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