@@ -498,7 +498,7 @@ public List<CommitStatus> getCommitStatuses(Object projectIdOrPath, String sha,
498
498
499
499
MultivaluedMap <String , String > queryParams = (filter != null ?
500
500
filter .getQueryParams (page , perPage ).asMap () : getPageQueryParams (page , perPage ));
501
- Response response = get (Response .Status .OK , queryParams ,
501
+ Response response = get (Response .Status .OK , queryParams ,
502
502
"projects" , this .getProjectIdOrPath (projectIdOrPath ), "repository" , "commits" , sha , "statuses" );
503
503
return (response .readEntity (new GenericType <List <CommitStatus >>() {}));
504
504
}
@@ -515,7 +515,7 @@ public List<CommitStatus> getCommitStatuses(Object projectIdOrPath, String sha,
515
515
* @return a Pager containing the commit statuses for the specified project and sha that meet the provided filter
516
516
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
517
517
*/
518
- public Pager <CommitStatus > getCommitStatuses (Object projectIdOrPath , String sha ,
518
+ public Pager <CommitStatus > getCommitStatuses (Object projectIdOrPath , String sha ,
519
519
CommitStatusFilter filter , int itemsPerPage ) throws GitLabApiException {
520
520
521
521
if (projectIdOrPath == null ) {
@@ -567,6 +567,31 @@ public Stream<CommitStatus> getCommitStatusesStream(Object projectIdOrPath, Stri
567
567
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
568
568
*/
569
569
public CommitStatus addCommitStatus (Object projectIdOrPath , String sha , CommitBuildState state , CommitStatus status ) throws GitLabApiException {
570
+ return addCommitStatus (projectIdOrPath , sha , state , null , status );
571
+ }
572
+
573
+ /**
574
+ * <p>Add or update the build status of a commit. The following fluent methods are available on the
575
+ * CommitStatus instance for setting up the status:</p>
576
+ * <pre><code>
577
+ * withCoverage(Float)
578
+ * withDescription(String)
579
+ * withName(String)
580
+ * withRef(String)
581
+ * withTargetUrl(String)
582
+ * </code></pre>
583
+ *
584
+ * <pre><code>GitLab Endpoint: POST /projects/:id/statuses/:sha</code></pre>
585
+ *
586
+ * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance (required)
587
+ * @param sha a commit SHA (required)
588
+ * @param state the state of the status. Can be one of the following: PENDING, RUNNING, SUCCESS, FAILED, CANCELED (required)
589
+ * @param pipelineId The ID of the pipeline to set status. Use in case of several pipeline on same SHA (optional)
590
+ * @param status the CommitSatus instance hoilding the optional parms: ref, name, target_url, description, and coverage
591
+ * @return a CommitStatus instance with the updated info
592
+ * @throws GitLabApiException GitLabApiException if any exception occurs during execution
593
+ */
594
+ public CommitStatus addCommitStatus (Object projectIdOrPath , String sha , CommitBuildState state , Integer pipelineId , CommitStatus status ) throws GitLabApiException {
570
595
571
596
if (projectIdOrPath == null ) {
572
597
throw new RuntimeException ("projectIdOrPath cannot be null" );
@@ -585,6 +610,10 @@ public CommitStatus addCommitStatus(Object projectIdOrPath, String sha, CommitBu
585
610
.withParam ("coverage" , status .getCoverage ());
586
611
}
587
612
613
+ if (pipelineId != null ) {
614
+ formData .withParam ("pipeline_id" , pipelineId );
615
+ }
616
+
588
617
Response response = post (Response .Status .OK , formData , "projects" , getProjectIdOrPath (projectIdOrPath ), "statuses" , sha );
589
618
return (response .readEntity (CommitStatus .class ));
590
619
}
@@ -837,7 +866,7 @@ public Commit revertCommit(Object projectIdOrPath, String sha, String branch) th
837
866
"projects" , getProjectIdOrPath (projectIdOrPath ), "repository" , "commits" , sha , "revert" );
838
867
return (response .readEntity (Commit .class ));
839
868
}
840
-
869
+
841
870
/**
842
871
* Cherry picks a commit in a given branch.
843
872
*
0 commit comments