Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
e19ea7f1
Commit
e19ea7f1
authored
Jun 14, 2023
by
Jeremie Bresson
Browse files
Merge branch 'main' into 6.x
parents
ac507c26
7599f28d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/JobApi.java
View file @
e19ea7f1
...
@@ -139,9 +139,22 @@ public class JobApi extends AbstractApi implements Constants {
...
@@ -139,9 +139,22 @@ public class JobApi extends AbstractApi implements Constants {
* @throws GitLabApiException if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Job
>
getJobsForPipeline
(
Object
projectIdOrPath
,
long
pipelineId
)
throws
GitLabApiException
{
public
List
<
Job
>
getJobsForPipeline
(
Object
projectIdOrPath
,
long
pipelineId
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
return
getJobsForPipeline
(
projectIdOrPath
,
pipelineId
,
(
Boolean
)
null
);
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"pipelines"
,
pipelineId
,
"jobs"
);
}
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Job
>>()
{}));
/**
* Get a list of jobs in a pipeline.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/pipelines/:pipeline_id/jobs</code></pre>
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path to get the pipelines for
* @param pipelineId the pipeline ID to get the list of jobs for
* @param includeRetried Include retried jobs in the response
* @return a list containing the jobs for the specified project ID and pipeline ID
* @throws GitLabApiException if any exception occurs during execution
*/
public
List
<
Job
>
getJobsForPipeline
(
Object
projectIdOrPath
,
long
pipelineId
,
Boolean
includeRetried
)
throws
GitLabApiException
{
return
getJobsForPipeline
(
projectIdOrPath
,
pipelineId
,
null
,
includeRetried
);
}
}
/**
/**
...
@@ -156,7 +169,26 @@ public class JobApi extends AbstractApi implements Constants {
...
@@ -156,7 +169,26 @@ public class JobApi extends AbstractApi implements Constants {
* @throws GitLabApiException if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Job
>
getJobsForPipeline
(
Object
projectIdOrPath
,
long
pipelineId
,
JobScope
scope
)
throws
GitLabApiException
{
public
List
<
Job
>
getJobsForPipeline
(
Object
projectIdOrPath
,
long
pipelineId
,
JobScope
scope
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
().
withParam
(
"scope"
,
scope
).
withParam
(
PER_PAGE_PARAM
,
getDefaultPerPage
());
return
getJobsForPipeline
(
projectIdOrPath
,
pipelineId
,
scope
,
false
);
}
/**
* Get a list of jobs in a pipeline.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/pipelines/:pipeline_id/jobs</code></pre>
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path to get the pipelines for
* @param pipelineId the pipeline ID to get the list of jobs for
* @param scope the scope of jobs, one of: CREATED, PENDING, RUNNING, FAILED, SUCCESS, CANCELED, SKIPPED, MANUAL
* @param includeRetried Include retried jobs in the response
* @return a list containing the jobs for the specified project ID and pipeline ID
* @throws GitLabApiException if any exception occurs during execution
*/
public
List
<
Job
>
getJobsForPipeline
(
Object
projectIdOrPath
,
long
pipelineId
,
JobScope
scope
,
Boolean
includeRetried
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"scope"
,
scope
)
.
withParam
(
"include_retried"
,
includeRetried
)
.
withParam
(
PER_PAGE_PARAM
,
getDefaultPerPage
());
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"pipelines"
,
pipelineId
,
"jobs"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"pipelines"
,
pipelineId
,
"jobs"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Job
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Job
>>()
{}));
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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