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
Boxiang Sun
gitlab-ce
Commits
d05af7b7
Commit
d05af7b7
authored
Jul 28, 2016
by
Paco Guzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for Ci::Build artifacts at database level
parent
41057b85
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
1 deletion
+29
-1
CHANGELOG
CHANGELOG
+1
-0
app/models/ci/build.rb
app/models/ci/build.rb
+1
-0
app/views/projects/ci/pipelines/_pipeline.html.haml
app/views/projects/ci/pipelines/_pipeline.html.haml
+1
-1
spec/factories/ci/builds.rb
spec/factories/ci/builds.rb
+16
-0
spec/features/pipelines_spec.rb
spec/features/pipelines_spec.rb
+10
-0
No files found.
CHANGELOG
View file @
d05af7b7
...
@@ -25,6 +25,7 @@ v 8.11.0 (unreleased)
...
@@ -25,6 +25,7 @@ v 8.11.0 (unreleased)
- Load project invited groups and members eagerly in `ProjectTeam#fetch_members`
- Load project invited groups and members eagerly in `ProjectTeam#fetch_members`
- Bump gitlab_git to speedup DiffCollection iterations
- Bump gitlab_git to speedup DiffCollection iterations
- Make branches sortable without push permission !5462 (winniehell)
- Make branches sortable without push permission !5462 (winniehell)
- Check for Ci::Build artifacts at database level on pipeline partial
- Add GitLab Workhorse version to admin dashboard (Katarzyna Kobierska Ula Budziszewska)
- Add GitLab Workhorse version to admin dashboard (Katarzyna Kobierska Ula Budziszewska)
- Add the `sprockets-es6` gem
- Add the `sprockets-es6` gem
- Multiple trigger variables show in separate lines (Katarzyna Kobierska Ula Budziszewska)
- Multiple trigger variables show in separate lines (Katarzyna Kobierska Ula Budziszewska)
...
...
app/models/ci/build.rb
View file @
d05af7b7
...
@@ -13,6 +13,7 @@ module Ci
...
@@ -13,6 +13,7 @@ module Ci
scope
:unstarted
,
->
()
{
where
(
runner_id:
nil
)
}
scope
:unstarted
,
->
()
{
where
(
runner_id:
nil
)
}
scope
:ignore_failures
,
->
()
{
where
(
allow_failure:
false
)
}
scope
:ignore_failures
,
->
()
{
where
(
allow_failure:
false
)
}
scope
:with_artifacts
,
->
()
{
where
.
not
(
artifacts_file:
[
nil
,
''
])
}
scope
:with_artifacts
,
->
()
{
where
.
not
(
artifacts_file:
[
nil
,
''
])
}
scope
:with_artifacts_not_expired
,
->
()
{
with_artifacts
.
where
(
'artifacts_expire_at IS NULL OR artifacts_expire_at > ?'
,
Time
.
now
)
}
scope
:with_expired_artifacts
,
->
()
{
with_artifacts
.
where
(
'artifacts_expire_at < ?'
,
Time
.
now
)
}
scope
:with_expired_artifacts
,
->
()
{
with_artifacts
.
where
(
'artifacts_expire_at < ?'
,
Time
.
now
)
}
scope
:last_month
,
->
()
{
where
(
'created_at > ?'
,
Date
.
today
-
1
.
month
)
}
scope
:last_month
,
->
()
{
where
(
'created_at > ?'
,
Date
.
today
-
1
.
month
)
}
scope
:manual_actions
,
->
()
{
where
(
when: :manual
)
}
scope
:manual_actions
,
->
()
{
where
(
when: :manual
)
}
...
...
app/views/projects/ci/pipelines/_pipeline.html.haml
View file @
d05af7b7
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
%td
.pipeline-actions
%td
.pipeline-actions
.controls.hidden-xs.pull-right
.controls.hidden-xs.pull-right
-
artifacts
=
pipeline
.
builds
.
latest
.
select
{
|
b
|
b
.
artifacts?
}
-
artifacts
=
pipeline
.
builds
.
latest
.
with_artifacts_not_expired
-
actions
=
pipeline
.
manual_actions
-
actions
=
pipeline
.
manual_actions
-
if
artifacts
.
present?
||
actions
.
any?
-
if
artifacts
.
present?
||
actions
.
any?
.btn-group.inline
.btn-group.inline
...
...
spec/factories/ci/builds.rb
View file @
d05af7b7
...
@@ -90,5 +90,21 @@ FactoryGirl.define do
...
@@ -90,5 +90,21 @@ FactoryGirl.define do
build
.
save!
build
.
save!
end
end
end
end
trait
:artifacts_expired
do
after
(
:create
)
do
|
build
,
_
|
build
.
artifacts_file
=
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/ci_build_artifacts.zip'
),
'application/zip'
)
build
.
artifacts_metadata
=
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/ci_build_artifacts_metadata.gz'
),
'application/x-gzip'
)
build
.
artifacts_expire_at
=
1
.
minute
.
ago
build
.
save!
end
end
end
end
end
end
spec/features/pipelines_spec.rb
View file @
d05af7b7
...
@@ -116,9 +116,19 @@ describe "Pipelines" do
...
@@ -116,9 +116,19 @@ describe "Pipelines" do
it
{
expect
(
page
).
to
have_link
(
with_artifacts
.
name
)
}
it
{
expect
(
page
).
to
have_link
(
with_artifacts
.
name
)
}
end
end
context
'with artifacts expired'
do
let!
(
:with_artifacts_expired
)
{
create
(
:ci_build
,
:artifacts_expired
,
:success
,
pipeline:
pipeline
,
name:
'rspec'
,
stage:
'test'
)
}
before
{
visit
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
}
it
{
expect
(
page
).
not_to
have_selector
(
'.build-artifacts'
)
}
end
context
'without artifacts'
do
context
'without artifacts'
do
let!
(
:without_artifacts
)
{
create
(
:ci_build
,
:success
,
pipeline:
pipeline
,
name:
'rspec'
,
stage:
'test'
)
}
let!
(
:without_artifacts
)
{
create
(
:ci_build
,
:success
,
pipeline:
pipeline
,
name:
'rspec'
,
stage:
'test'
)
}
before
{
visit
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
}
it
{
expect
(
page
).
not_to
have_selector
(
'.build-artifacts'
)
}
it
{
expect
(
page
).
not_to
have_selector
(
'.build-artifacts'
)
}
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