Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b27c4420
Commit
b27c4420
authored
Mar 25, 2019
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Destroy releases when delete a tag
ok ok ok ok
parent
b4de23a6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
6 deletions
+24
-6
app/services/releases/destroy_service.rb
app/services/releases/destroy_service.rb
+0
-1
changelogs/unreleased/delete-release-when-delete-tag.yml
changelogs/unreleased/delete-release-when-delete-tag.yml
+5
-0
spec/services/releases/destroy_service_spec.rb
spec/services/releases/destroy_service_spec.rb
+3
-5
spec/services/tags/destroy_service_spec.rb
spec/services/tags/destroy_service_spec.rb
+16
-0
No files found.
app/services/releases/destroy_service.rb
View file @
b27c4420
...
...
@@ -5,7 +5,6 @@ module Releases
include
Releases
::
Concerns
def
execute
return
error
(
'Tag does not exist'
,
404
)
unless
existing_tag
return
error
(
'Release does not exist'
,
404
)
unless
release
return
error
(
'Access Denied'
,
403
)
unless
allowed?
...
...
changelogs/unreleased/delete-release-when-delete-tag.yml
0 → 100644
View file @
b27c4420
---
title
:
Releases will now be automatically deleted when deleting corresponding tag
merge_request
:
26530
author
:
type
:
fixed
spec/services/releases/destroy_service_spec.rb
View file @
b27c4420
...
...
@@ -28,13 +28,11 @@ describe Releases::DestroyService do
end
end
context
'when tag
is not found
'
do
context
'when tag
does not exist in the repository
'
do
let
(
:tag
)
{
'v1.1.1'
}
it
'returns an error'
do
is_expected
.
to
include
(
status: :error
,
message:
'Tag does not exist'
,
http_status:
404
)
it
'removes the orphaned release'
do
expect
{
subject
}.
to
change
{
project
.
releases
.
count
}.
by
(
-
1
)
end
end
...
...
spec/services/tags/destroy_service_spec.rb
View file @
b27c4420
...
...
@@ -7,11 +7,27 @@ describe Tags::DestroyService do
let
(
:service
)
{
described_class
.
new
(
project
,
user
)
}
describe
'#execute'
do
subject
{
service
.
execute
(
tag_name
)
}
it
'removes the tag'
do
expect
(
repository
).
to
receive
(
:before_remove_tag
)
expect
(
service
).
to
receive
(
:success
)
service
.
execute
(
'v1.1.0'
)
end
context
'when there is an associated release on the tag'
do
let
(
:tag
)
{
repository
.
tags
.
first
}
let
(
:tag_name
)
{
tag
.
name
}
before
do
project
.
add_maintainer
(
user
)
create
(
:release
,
tag:
tag_name
,
project:
project
)
end
it
'destroys the release'
do
expect
{
subject
}.
to
change
{
project
.
releases
.
count
}.
by
(
-
1
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment