summaryrefslogtreecommitdiff
path: root/lib/api/tags.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/tags.rb')
-rw-r--r--lib/api/tags.rb85
1 files changed, 2 insertions, 83 deletions
diff --git a/lib/api/tags.rb b/lib/api/tags.rb
index e77d7e34de3..6c8e2c69a6d 100644
--- a/lib/api/tags.rb
+++ b/lib/api/tags.rb
@@ -51,35 +51,22 @@ module API
end
desc 'Create a new repository tag' do
- detail 'This optional release_description parameter was deprecated in GitLab 11.7.'
success Entities::Tag
end
params do
requires :tag_name, type: String, desc: 'The name of the tag'
requires :ref, type: String, desc: 'The commit sha or branch name'
optional :message, type: String, desc: 'Specifying a message creates an annotated tag'
- optional :release_description, type: String, desc: 'Specifying release notes stored in the GitLab database (deprecated in GitLab 11.7)'
end
post ':id/repository/tags', :release_orchestration do
+ deprecate_release_notes unless params[:release_description].blank?
+
authorize_admin_tag
result = ::Tags::CreateService.new(user_project, current_user)
.execute(params[:tag_name], params[:ref], params[:message])
if result[:status] == :success
- # Release creation with Tags API was deprecated in GitLab 11.7
- if params[:release_description].present?
- release_create_params = {
- tag: params[:tag_name],
- name: params[:tag_name], # Name can be specified in new API
- description: params[:release_description]
- }
-
- ::Releases::CreateService
- .new(user_project, current_user, release_create_params)
- .execute
- end
-
present result[:tag],
with: Entities::Tag,
project: user_project
@@ -109,74 +96,6 @@ module API
end
end
end
-
- desc 'Add a release note to a tag' do
- detail 'This feature was deprecated in GitLab 11.7.'
- success Entities::TagRelease
- end
- params do
- requires :tag_name, type: String, desc: 'The name of the tag', as: :tag
- requires :description, type: String, desc: 'Release notes with markdown support'
- end
- post ':id/repository/tags/:tag_name/release', requirements: TAG_ENDPOINT_REQUIREMENTS, feature_category: :release_orchestration do
- authorize_create_release!
-
- ##
- # Legacy API does not support tag auto creation.
- not_found!('Tag') unless user_project.repository.find_tag(params[:tag])
-
- release_create_params = {
- tag: params[:tag],
- name: params[:tag], # Name can be specified in new API
- description: params[:description]
- }
-
- result = ::Releases::CreateService
- .new(user_project, current_user, release_create_params)
- .execute
-
- if result[:status] == :success
- present result[:release], with: Entities::TagRelease
- else
- render_api_error!(result[:message], result[:http_status])
- end
- end
-
- desc "Update a tag's release note" do
- detail 'This feature was deprecated in GitLab 11.7.'
- success Entities::TagRelease
- end
- params do
- requires :tag_name, type: String, desc: 'The name of the tag', as: :tag
- requires :description, type: String, desc: 'Release notes with markdown support'
- end
- put ':id/repository/tags/:tag_name/release', requirements: TAG_ENDPOINT_REQUIREMENTS, feature_category: :release_orchestration do
- authorize_update_release!
-
- result = ::Releases::UpdateService
- .new(user_project, current_user, declared_params(include_missing: false))
- .execute
-
- if result[:status] == :success
- present result[:release], with: Entities::TagRelease
- else
- render_api_error!(result[:message], result[:http_status])
- end
- end
- end
-
- helpers do
- def authorize_create_release!
- authorize! :create_release, user_project
- end
-
- def authorize_update_release!
- authorize! :update_release, release
- end
-
- def release
- @release ||= user_project.releases.find_by_tag(params[:tag])
- end
end
end
end