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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
f3e92fb4
Commit
f3e92fb4
authored
Feb 01, 2016
by
Grzegorz Bizon
Committed by
Grzegorz Bizon
Feb 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make CI build eraseable only if build is completed
parent
c8102d93
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
3 deletions
+7
-3
app/models/ci/build.rb
app/models/ci/build.rb
+4
-0
app/models/ci/build/eraseable.rb
app/models/ci/build/eraseable.rb
+1
-1
spec/models/ci/build/eraseable_spec.rb
spec/models/ci/build/eraseable_spec.rb
+2
-2
No files found.
app/models/ci/build.rb
View file @
f3e92fb4
...
@@ -205,6 +205,10 @@ module Ci
...
@@ -205,6 +205,10 @@ module Ci
end
end
end
end
def
trace_empty?
raw_trace
.
blank?
end
def
raw_trace
def
raw_trace
if
File
.
file?
(
path_to_trace
)
if
File
.
file?
(
path_to_trace
)
File
.
read
(
path_to_trace
)
File
.
read
(
path_to_trace
)
...
...
app/models/ci/build/eraseable.rb
View file @
f3e92fb4
...
@@ -11,7 +11,7 @@ module Ci
...
@@ -11,7 +11,7 @@ module Ci
end
end
def
eraseable?
def
eraseable?
artifacts_file
.
exists?
||
File
.
file?
(
path_to_trace
)
complete?
&&
(
artifacts_file
.
exists?
||
!
trace_empty?
)
end
end
def
erase_url
def
erase_url
...
...
spec/models/ci/build/eraseable_spec.rb
View file @
f3e92fb4
...
@@ -20,7 +20,7 @@ describe Ci::Build::Eraseable, models: true do
...
@@ -20,7 +20,7 @@ describe Ci::Build::Eraseable, models: true do
end
end
context
'build is eraseable'
do
context
'build is eraseable'
do
let!
(
:build
)
{
create
(
:ci_build_with_trace
,
:artifacts
)
}
let!
(
:build
)
{
create
(
:ci_build_with_trace
,
:
success
,
:
artifacts
)
}
describe
'#erase!'
do
describe
'#erase!'
do
before
{
build
.
erase!
}
before
{
build
.
erase!
}
...
@@ -49,7 +49,7 @@ describe Ci::Build::Eraseable, models: true do
...
@@ -49,7 +49,7 @@ describe Ci::Build::Eraseable, models: true do
end
end
context
'metadata and build trace are not available'
do
context
'metadata and build trace are not available'
do
let!
(
:build
)
{
create
(
:ci_build
,
:artifacts
)
}
let!
(
:build
)
{
create
(
:ci_build
,
:
success
,
:
artifacts
)
}
before
{
build
.
remove_artifacts_metadata!
}
before
{
build
.
remove_artifacts_metadata!
}
describe
'#erase!'
do
describe
'#erase!'
do
...
...
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