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
fad63dfb
Commit
fad63dfb
authored
May 11, 2021
by
Maxime Orefice
Committed by
Douglas Barbosa Alexandre
May 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose locked artifacts for pipeline downloadable_artifact
parent
ded4a188
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
7 deletions
+23
-7
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+3
-1
changelogs/unreleased/mo-downloadable-locked-artifacts.yml
changelogs/unreleased/mo-downloadable-locked-artifacts.yml
+5
-0
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+15
-6
No files found.
app/models/ci/pipeline.rb
View file @
fad63dfb
...
...
@@ -70,7 +70,9 @@ module Ci
has_many
:deployments
,
through: :builds
has_many
:environments
,
->
{
distinct
},
through: :deployments
has_many
:latest_builds
,
->
{
latest
.
with_project_and_metadata
},
foreign_key: :commit_id
,
inverse_of: :pipeline
,
class_name:
'Ci::Build'
has_many
:downloadable_artifacts
,
->
{
not_expired
.
downloadable
.
with_job
},
through: :latest_builds
,
source: :job_artifacts
has_many
:downloadable_artifacts
,
->
do
not_expired
.
or
(
where_exists
(
::
Ci
::
Pipeline
.
artifacts_locked
.
where
(
'ci_pipelines.id = ci_builds.commit_id'
))).
downloadable
.
with_job
end
,
through: :latest_builds
,
source: :job_artifacts
has_many
:messages
,
class_name:
'Ci::PipelineMessage'
,
inverse_of: :pipeline
...
...
changelogs/unreleased/mo-downloadable-locked-artifacts.yml
0 → 100644
View file @
fad63dfb
---
title
:
Fix downloadable artifacts for pipeline
merge_request
:
60836
author
:
type
:
fixed
spec/models/ci/pipeline_spec.rb
View file @
fad63dfb
...
...
@@ -68,14 +68,23 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
end
describe
'#downloadable_artifacts'
do
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let_it_be
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let_it_be
(
:downloadable_artifact
)
{
create
(
:ci_job_artifact
,
:codequality
,
job:
build
)
}
let_it_be
(
:expired_artifact
)
{
create
(
:ci_job_artifact
,
:junit
,
:expired
,
job:
build
)
}
let_it_be
(
:undownloadable_artifact
)
{
create
(
:ci_job_artifact
,
:trace
,
job:
build
)
}
it
'returns downloadable artifacts that have not expired'
do
downloadable_artifact
=
create
(
:ci_job_artifact
,
:codequality
,
job:
build
)
_expired_artifact
=
create
(
:ci_job_artifact
,
:junit
,
:expired
,
job:
build
)
_undownloadable_artifact
=
create
(
:ci_job_artifact
,
:trace
,
job:
build
)
context
'when artifacts are locked'
do
it
'returns downloadable artifacts including locked artifacts'
do
expect
(
pipeline
.
downloadable_artifacts
).
to
contain_exactly
(
downloadable_artifact
,
expired_artifact
)
end
end
expect
(
pipeline
.
downloadable_artifacts
).
to
contain_exactly
(
downloadable_artifact
)
context
'when artifacts are unlocked'
do
it
'returns only downloadable artifacts not expired'
do
expired_artifact
.
job
.
pipeline
.
unlocked!
expect
(
pipeline
.
reload
.
downloadable_artifacts
).
to
contain_exactly
(
downloadable_artifact
)
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