jenkinsci / gitlab-plugin

A Jenkins plugin for interfacing with GitLab
https://plugins.jenkins.io/gitlab-plugin/
GNU General Public License v2.0
1.44k stars 612 forks source link

updateGitlabCommitStatus in post step is ignored #1659

Open Ketec opened 1 month ago

Ketec commented 1 month ago

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<branch>#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