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
753f2eb3
Commit
753f2eb3
authored
Sep 08, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix incorrectly resolved conflicts in artifacts API
parent
64f1e7b8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
49 deletions
+14
-49
lib/api/job_artifacts.rb
lib/api/job_artifacts.rb
+14
-2
lib/api/jobs.rb
lib/api/jobs.rb
+0
-47
No files found.
lib/api/job_artifacts.rb
View file @
753f2eb3
...
@@ -6,16 +6,18 @@ module API
...
@@ -6,16 +6,18 @@ module API
requires
:id
,
type:
String
,
desc:
'The ID of a project'
requires
:id
,
type:
String
,
desc:
'The ID of a project'
end
end
resource
:projects
,
requirements:
API
::
PROJECT_ENDPOINT_REQUIREMENTS
do
resource
:projects
,
requirements:
API
::
PROJECT_ENDPOINT_REQUIREMENTS
do
desc
'Download the artifacts
fil
e from a job'
do
desc
'Download the artifacts
archiv
e from a job'
do
detail
'This feature was introduced in GitLab 8.10'
detail
'This feature was introduced in GitLab 8.10'
end
end
params
do
params
do
requires
:ref_name
,
type:
String
,
desc:
'The ref from repository'
requires
:ref_name
,
type:
String
,
desc:
'The ref from repository'
requires
:job
,
type:
String
,
desc:
'The name for the job'
requires
:job
,
type:
String
,
desc:
'The name for the job'
end
end
route_setting
:authentication
,
job_token_allowed:
true
get
':id/jobs/artifacts/:ref_name/download'
,
get
':id/jobs/artifacts/:ref_name/download'
,
requirements:
{
ref_name:
/.+/
}
do
requirements:
{
ref_name:
/.+/
}
do
authorize_read_builds!
authorize_read_builds!
check_cross_project_pipelines_feature!
builds
=
user_project
.
latest_successful_builds_for
(
params
[
:ref_name
])
builds
=
user_project
.
latest_successful_builds_for
(
params
[
:ref_name
])
latest_build
=
builds
.
find_by!
(
name:
params
[
:job
])
latest_build
=
builds
.
find_by!
(
name:
params
[
:job
])
...
@@ -23,14 +25,16 @@ module API
...
@@ -23,14 +25,16 @@ module API
present_artifacts!
(
latest_build
.
artifacts_file
)
present_artifacts!
(
latest_build
.
artifacts_file
)
end
end
desc
'Download the artifacts
fil
e from a job'
do
desc
'Download the artifacts
archiv
e from a job'
do
detail
'This feature was introduced in GitLab 8.5'
detail
'This feature was introduced in GitLab 8.5'
end
end
params
do
params
do
requires
:job_id
,
type:
Integer
,
desc:
'The ID of a job'
requires
:job_id
,
type:
Integer
,
desc:
'The ID of a job'
end
end
route_setting
:authentication
,
job_token_allowed:
true
get
':id/jobs/:job_id/artifacts'
do
get
':id/jobs/:job_id/artifacts'
do
authorize_read_builds!
authorize_read_builds!
check_cross_project_pipelines_feature!
build
=
find_build!
(
params
[
:job_id
])
build
=
find_build!
(
params
[
:job_id
])
...
@@ -76,5 +80,13 @@ module API
...
@@ -76,5 +80,13 @@ module API
present
build
,
with:
Entities
::
Job
present
build
,
with:
Entities
::
Job
end
end
end
end
helpers
do
def
check_cross_project_pipelines_feature!
if
job_token_authentication?
&&
!
@project
.
feature_available?
(
:cross_project_pipelines
)
not_found!
(
'Project'
)
end
end
end
end
end
end
end
lib/api/jobs.rb
View file @
753f2eb3
...
@@ -71,41 +71,6 @@ module API
...
@@ -71,41 +71,6 @@ module API
present
build
,
with:
Entities
::
Job
present
build
,
with:
Entities
::
Job
end
end
desc
'Download the artifacts file from a job'
do
detail
'This feature was introduced in GitLab 8.5'
end
params
do
requires
:job_id
,
type:
Integer
,
desc:
'The ID of a job'
end
route_setting
:authentication
,
job_token_allowed:
true
get
':id/jobs/:job_id/artifacts'
do
authorize_read_builds!
check_cross_project_pipelines_feature!
build
=
get_build!
(
params
[
:job_id
])
present_artifacts!
(
build
.
artifacts_file
)
end
desc
'Download the artifacts file from a job'
do
detail
'This feature was introduced in GitLab 8.10'
end
params
do
requires
:ref_name
,
type:
String
,
desc:
'The ref from repository'
requires
:job
,
type:
String
,
desc:
'The name for the job'
end
route_setting
:authentication
,
job_token_allowed:
true
get
':id/jobs/artifacts/:ref_name/download'
,
requirements:
{
ref_name:
/.+/
}
do
authorize_read_builds!
check_cross_project_pipelines_feature!
builds
=
user_project
.
latest_successful_builds_for
(
params
[
:ref_name
])
latest_build
=
builds
.
find_by!
(
name:
params
[
:job
])
present_artifacts!
(
latest_build
.
artifacts_file
)
end
# TODO: We should use `present_file!` and leave this implementation for backward compatibility (when build trace
# TODO: We should use `present_file!` and leave this implementation for backward compatibility (when build trace
# is saved in the DB instead of file). But before that, we need to consider how to replace the value of
# is saved in the DB instead of file). But before that, we need to consider how to replace the value of
# `runners_token` with some mask (like `xxxxxx`) when sending trace file directly by workhorse.
# `runners_token` with some mask (like `xxxxxx`) when sending trace file directly by workhorse.
...
@@ -211,18 +176,6 @@ module API
...
@@ -211,18 +176,6 @@ module API
builds
.
where
(
status:
available_statuses
&&
scope
)
builds
.
where
(
status:
available_statuses
&&
scope
)
end
end
def
authorize_read_builds!
authorize!
:read_build
,
user_project
end
def
authorize_update_builds!
authorize!
:update_build
,
user_project
end
def
check_cross_project_pipelines_feature!
not_found!
(
'Project'
)
if
job_token_authentication?
&&
!
@project
.
feature_available?
(
:cross_project_pipelines
)
end
end
end
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