Merge pull request #134 from thommy101/CommitStatus

Fixes for pullrequest #127
This commit is contained in:
Owen Mehegan 2015-11-19 11:26:42 -08:00
commit 856ae9a9f7
2 changed files with 4 additions and 3 deletions

View File

@ -71,7 +71,8 @@ If you plan to use forked repositories, you will need to enable the GitLab CI in
* Click on *Web Hooks* * Click on *Web Hooks*
* Add a Web Hook for *Merge Request Events* and *Push Events* to ``http://JENKINS_URL/project/PROJECT_NAME`` <br/> * Add a Web Hook for *Merge Request Events* and *Push Events* to ``http://JENKINS_URL/project/PROJECT_NAME`` <br/>
**Note:** You do not need to select any "Trigger Events" as the Web Hook for Merge Request Events will alert Jenkins. **Note:** You do not need to select any "Trigger Events" as the Web Hook for Merge Request Events will alert Jenkins.
## Gitlab Configuration (≥ 8.1)
## GitLab Configuration (≥ 8.1)
GitLab 8.1 uses the same configuration as GitLab 8.0 GitLab 8.1 uses the same configuration as GitLab 8.0
* GitLab 8.1 has implemented a commit status api. To enable this check the ``Use GitLab CI features`` under the project settings. * GitLab 8.1 has implemented a commit status api. To enable this check the ``Use GitLab CI features`` under the project settings.

View File

@ -415,7 +415,7 @@ public class GitLabPushTrigger extends Trigger<Job<?, ?>> {
private void onCompletedPushRequest(Run run, GitLabPushCause cause) { private void onCompletedPushRequest(Run run, GitLabPushCause cause) {
if(addCiMessage) { if(addCiMessage) {
cause.getPushRequest().createCommitStatus(this.getDescriptor().getGitlab().instance(), run.getResult()==Result.SUCCESS?"success":"failure", Jenkins.getInstance().getRootUrl() + run.getUrl()); cause.getPushRequest().createCommitStatus(this.getDescriptor().getGitlab().instance(), run.getResult()==Result.SUCCESS?"success":"failed", Jenkins.getInstance().getRootUrl() + run.getUrl());
} }
} }
@ -456,7 +456,7 @@ public class GitLabPushTrigger extends Trigger<Job<?, ?>> {
} }
if(addCiMessage) { if(addCiMessage) {
cause.getMergeRequest().createCommitStatus(this.getDescriptor().getGitlab().instance(), run.getResult()==Result.SUCCESS?"success":"failure", Jenkins.getInstance().getRootUrl() + run.getUrl()); cause.getMergeRequest().createCommitStatus(this.getDescriptor().getGitlab().instance(), run.getResult()==Result.SUCCESS?"success":"failed", Jenkins.getInstance().getRootUrl() + run.getUrl());
} }
} }