@@ -498,7 +498,7 @@ public List<CommitStatus> getCommitStatuses(Object projectIdOrPath, String sha,
498498
499499 MultivaluedMap <String , String > queryParams = (filter != null ?
500500 filter .getQueryParams (page , perPage ).asMap () : getPageQueryParams (page , perPage ));
501- Response response = get (Response .Status .OK , queryParams ,
501+ Response response = get (Response .Status .OK , queryParams ,
502502 "projects" , this .getProjectIdOrPath (projectIdOrPath ), "repository" , "commits" , sha , "statuses" );
503503 return (response .readEntity (new GenericType <List <CommitStatus >>() {}));
504504 }
@@ -515,7 +515,7 @@ public List<CommitStatus> getCommitStatuses(Object projectIdOrPath, String sha,
515515 * @return a Pager containing the commit statuses for the specified project and sha that meet the provided filter
516516 * @throws GitLabApiException GitLabApiException if any exception occurs during execution
517517 */
518- public Pager <CommitStatus > getCommitStatuses (Object projectIdOrPath , String sha ,
518+ public Pager <CommitStatus > getCommitStatuses (Object projectIdOrPath , String sha ,
519519 CommitStatusFilter filter , int itemsPerPage ) throws GitLabApiException {
520520
521521 if (projectIdOrPath == null ) {
@@ -567,6 +567,31 @@ public Stream<CommitStatus> getCommitStatusesStream(Object projectIdOrPath, Stri
567567 * @throws GitLabApiException GitLabApiException if any exception occurs during execution
568568 */
569569 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 {
570595
571596 if (projectIdOrPath == null ) {
572597 throw new RuntimeException ("projectIdOrPath cannot be null" );
@@ -585,6 +610,10 @@ public CommitStatus addCommitStatus(Object projectIdOrPath, String sha, CommitBu
585610 .withParam ("coverage" , status .getCoverage ());
586611 }
587612
613+ if (pipelineId != null ) {
614+ formData .withParam ("pipeline_id" , pipelineId );
615+ }
616+
588617 Response response = post (Response .Status .OK , formData , "projects" , getProjectIdOrPath (projectIdOrPath ), "statuses" , sha );
589618 return (response .readEntity (CommitStatus .class ));
590619 }
@@ -837,7 +866,7 @@ public Commit revertCommit(Object projectIdOrPath, String sha, String branch) th
837866 "projects" , getProjectIdOrPath (projectIdOrPath ), "repository" , "commits" , sha , "revert" );
838867 return (response .readEntity (Commit .class ));
839868 }
840-
869+
841870 /**
842871 * Cherry picks a commit in a given branch.
843872 *
0 commit comments