Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
java-gitlab-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
沈俊林
java-gitlab-api
Commits
e42ba831
Commit
e42ba831
authored
Mar 11, 2016
by
Tim Olshansky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #120 from rockwotj/master
Added getBuildsArtifact method
parents
68489e45
8d160022
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+23
-0
GitlabHTTPRequestor.java
src/main/java/org/gitlab/api/http/GitlabHTTPRequestor.java
+2
-2
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
e42ba831
...
...
@@ -612,6 +612,29 @@ public class GitlabAPI {
}
/**
* Get build artifacts of a project build
*
* @param project The Project
* @param build The build
* @throws IOException on gitlab api call error
*/
public
byte
[]
getBuildArtifact
(
GitlabProject
project
,
GitlabBuild
build
)
throws
IOException
{
return
getBuildArtifact
(
project
.
getId
(),
build
.
getId
());
}
/**
* Get build artifacts of a project build
*
* @param projectId The Project's Id
* @param buildId The build's Id
* @throws IOException on gitlab api call error
*/
public
byte
[]
getBuildArtifact
(
Integer
projectId
,
Integer
buildId
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
sanitizeProjectId
(
projectId
)
+
GitlabBuild
.
URL
+
"/"
+
buildId
+
"/artifacts"
;
return
retrieve
().
to
(
tailUrl
,
byte
[].
class
);
}
/**
* Creates a private Project
*
...
...
src/main/java/org/gitlab/api/http/GitlabHTTPRequestor.java
View file @
e42ba831
...
...
@@ -321,10 +321,10 @@ public class GitlabHTTPRequestor {
private
<
T
>
T
parse
(
HttpURLConnection
connection
,
Class
<
T
>
type
,
T
instance
)
throws
IOException
{
InputStreamReader
reader
=
null
;
try
{
reader
=
new
InputStreamReader
(
wrapStream
(
connection
,
connection
.
getInputStream
()),
"UTF-8"
);
if
(
byte
[].
class
==
type
)
{
return
type
.
cast
(
IOUtils
.
toByteArray
(
reader
));
return
type
.
cast
(
IOUtils
.
toByteArray
(
wrapStream
(
connection
,
connection
.
getInputStream
())
));
}
reader
=
new
InputStreamReader
(
wrapStream
(
connection
,
connection
.
getInputStream
()),
"UTF-8"
);
String
data
=
IOUtils
.
toString
(
reader
);
if
(
type
!=
null
)
{
return
GitlabAPI
.
MAPPER
.
readValue
(
data
,
type
);
...
...
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