jenkinsci / jenkinsci/gitlab-plugin

updateGitlabCommitStatus in post step is ignored

Open
#1,659 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
Java
Stars
1.4k
Forks
615
Avg merge
4h 32m
Merged PRs (30d)
10

Description

### Jenkins and plugins versions report

We have unstable stages that are purely informative. So i need to set the result as success when pipeline is "unstable".

```
post {
unstable {
echo 'updateGitlabCommitStatus'
updateGitlabCommitStatus name: 'jenkins', state: 'success'
}
}
```

However, the gitlab plugin seems to completely ignore it and marks pipeline as failed regardless at the end.

```
[Pipeline] echo
14:14:41 updateGitlabCommitStatus
[Pipeline] updateGitlabCommitStatus
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timestamps
[Pipeline] }

[Pipeline] // ansiColor
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] End of Pipeline
[GitLab Pipeline Status] Notifying branch build status: FAILED#14: This commit is unstable with partial failure.
[GitLab Pipeline Status] Notified
Finished: UNSTABLE
```

It seems to execute it's own notify always at the very end regardless of what you did manually.

Jenkins also does not allow setting pipeline to a "better" state manually.

### What Operating System are you using (both controller, and any agents involved in the problem)?

linux

### Reproduction steps

Add post step to override final pipeline status.

### Expected Results

It overrides the status to what i specified.

### Actual Results

It does not override and marks pipeline as failed.

### Anything else?

_No response_

### Are you interested in contributing a fix?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.