diff options
Diffstat (limited to 'app/controllers/projects/tags_controller.rb')
-rw-r--r-- | app/controllers/projects/tags_controller.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/app/controllers/projects/tags_controller.rb b/app/controllers/projects/tags_controller.rb index c89bfd110c4..df20daa8f7e 100644 --- a/app/controllers/projects/tags_controller.rb +++ b/app/controllers/projects/tags_controller.rb @@ -41,16 +41,20 @@ class Projects::TagsController < Projects::ApplicationController # rubocop: enable CodeReuse/ActiveRecord def create + # TODO: remove this with the release creation moved to it's own form https://gitlab.com/gitlab-org/gitlab/-/issues/214245 + evidence_pipeline = find_evidence_pipeline + result = ::Tags::CreateService.new(@project, current_user) .execute(params[:tag_name], params[:ref], params[:message]) if result[:status] == :success - # Release creation with Tags was deprecated in GitLab 11.7 + # TODO: remove this with the release creation moved to it's own form https://gitlab.com/gitlab-org/gitlab/-/issues/214245 if params[:release_description].present? release_params = { tag: params[:tag_name], name: params[:tag_name], - description: params[:release_description] + description: params[:release_description], + evidence_pipeline: evidence_pipeline } Releases::CreateService @@ -93,4 +97,14 @@ class Projects::TagsController < Projects::ApplicationController end end end + + private + + # TODO: remove this with the release creation moved to it's own form https://gitlab.com/gitlab-org/gitlab/-/issues/214245 + def find_evidence_pipeline + evidence_pipeline_sha = @project.repository.commit(params[:ref])&.sha + return unless evidence_pipeline_sha + + @project.ci_pipelines.for_sha(evidence_pipeline_sha).last + end end |