diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-28 21:26:09 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-28 21:26:09 +0000 |
commit | 1646149f856e38e4f0b182877289ff1bf4df8870 (patch) | |
tree | 9d9fd2ff0e4b1ffd4666ee437d5d1670cd546738 | |
parent | 4467fbd0f613f18cc746caae02e11ab4785b772c (diff) | |
download | gitlab-ce-1646149f856e38e4f0b182877289ff1bf4df8870.tar.gz |
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
5 files changed, 44 insertions, 2 deletions
diff --git a/app/controllers/projects/artifacts_controller.rb b/app/controllers/projects/artifacts_controller.rb index 50399a8cfbb..554d2b4d120 100644 --- a/app/controllers/projects/artifacts_controller.rb +++ b/app/controllers/projects/artifacts_controller.rb @@ -111,7 +111,7 @@ class Projects::ArtifactsController < Projects::ApplicationController def build @build ||= begin - build = build_from_id || build_from_ref + build = build_from_id || build_from_sha || build_from_ref build&.present(current_user: current_user) end end @@ -125,7 +125,8 @@ class Projects::ArtifactsController < Projects::ApplicationController project.builds.find_by_id(params[:job_id]) if params[:job_id] end - def build_from_ref + def build_from_sha + return if params[:job].blank? return unless @ref_name commit = project.commit(@ref_name) @@ -134,6 +135,13 @@ class Projects::ArtifactsController < Projects::ApplicationController project.latest_successful_build_for_sha(params[:job], commit.id) end + def build_from_ref + return if params[:job].blank? + return unless @ref_name + + project.latest_successful_build_for_ref(params[:job], @ref_name) + end + def artifacts_file @artifacts_file ||= build&.artifacts_file_for_type(params[:file_type] || :archive) end diff --git a/changelogs/unreleased/218557-geo-design-thumbnails-are-not-replicated.yml b/changelogs/unreleased/218557-geo-design-thumbnails-are-not-replicated.yml new file mode 100644 index 00000000000..73ebbb06630 --- /dev/null +++ b/changelogs/unreleased/218557-geo-design-thumbnails-are-not-replicated.yml @@ -0,0 +1,5 @@ +--- +title: Fix Geo replication for design thumbnails +merge_request: 32703 +author: +type: fixed diff --git a/changelogs/unreleased/sh-fix-artifacts-download-404.yml b/changelogs/unreleased/sh-fix-artifacts-download-404.yml new file mode 100644 index 00000000000..37615394344 --- /dev/null +++ b/changelogs/unreleased/sh-fix-artifacts-download-404.yml @@ -0,0 +1,5 @@ +--- +title: Fix 404s downloading build artifacts +merge_request: 32741 +author: +type: fixed diff --git a/spec/controllers/projects/artifacts_controller_spec.rb b/spec/controllers/projects/artifacts_controller_spec.rb index c59983d5138..f426a3f2040 100644 --- a/spec/controllers/projects/artifacts_controller_spec.rb +++ b/spec/controllers/projects/artifacts_controller_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' describe Projects::ArtifactsController do + include RepoHelpers + let(:user) { project.owner } let_it_be(:project) { create(:project, :repository, :public) } @@ -447,6 +449,22 @@ describe Projects::ArtifactsController do expect(response).to redirect_to(path) end end + + context 'with a failed pipeline on an updated master' do + before do + create_file_in_repo(project, 'master', 'master', 'test.txt', 'This is test') + + create(:ci_pipeline, + project: project, + sha: project.commit.sha, + ref: project.default_branch, + status: 'failed') + + get :latest_succeeded, params: params_from_ref(project.default_branch) + end + + it_behaves_like 'redirect to the job' + end end end end diff --git a/spec/features/projects/artifacts/user_downloads_artifacts_spec.rb b/spec/features/projects/artifacts/user_downloads_artifacts_spec.rb index 3cbf276c02d..78ff89799ad 100644 --- a/spec/features/projects/artifacts/user_downloads_artifacts_spec.rb +++ b/spec/features/projects/artifacts/user_downloads_artifacts_spec.rb @@ -32,5 +32,11 @@ describe "User downloads artifacts" do it_behaves_like "downloading" end + + context "via SHA" do + let(:url) { latest_succeeded_project_artifacts_path(project, "#{pipeline.sha}/download", job: job.name) } + + it_behaves_like "downloading" + end end end |