Using "skipped" as commit status returns HTTP 400 Bad Request
Jenkins and plugins versions report
Environment
Jenkins: 2.375.1 OS: Linux - 5.15.0-60-generic Java: 17.0.5 - Eclipse Adoptium (OpenJDK 64-Bit Server VM) [...] git:5.0.0 git-client:4.1.0 git-server:99.va_0826a_b_cdfa_d github:1.36.1 github-api:1.303-400.v35c2d8258028 github-branch-source:1701.v00cc8184df93 gitlab-plugin:1.7.6
What Operating System are you using (both controller, and any agents involved in the problem)?
Ubuntu 20.04
Reproduction steps
- Setup GitLab Plugin like this.
- Use
updateGitlabCommitStatus name: 'Pipeline Entering - 6', state: 'Skipped'Following stage was used:
stage('Pipeline Entering - Echo') {
steps {
echo('PIPELINE RUNNING - Frontend');
updateGitlabCommitStatus name: 'Pipeline Entering - 1', state: 'pending'
updateGitlabCommitStatus name: 'Pipeline Entering - 2', state: 'running'
updateGitlabCommitStatus name: 'Pipeline Entering - 3', state: 'canceled'
updateGitlabCommitStatus name: 'Pipeline Entering - 4', state: 'success'
updateGitlabCommitStatus name: 'Pipeline Entering - 5', state: 'failed'
updateGitlabCommitStatus name: 'Pipeline Entering - 6', state: 'skipped'
}
}
- Have a HTTP 400: Bad Request error in build log.
Expected Results
I expected that GitLab correctly shows that this CommitStatus was skipped.
Actual Results
The CommitStatus doesn't show up at all and an error shows up in the build log of Jenkins.

[console output]
[...]
[Pipeline] { (Pipeline Entering - Echo)
[Pipeline] echo
PIPELINE RUNNING - Frontend
[Pipeline] updateGitlabCommitStatus
[Pipeline] updateGitlabCommitStatus
[Pipeline] updateGitlabCommitStatus
[Pipeline] updateGitlabCommitStatus
[Pipeline] updateGitlabCommitStatus
[Pipeline] updateGitlabCommitStatus
Failed to update Gitlab commit status for project '28': HTTP 400 Bad Request'
[...]
Anything else?
If anything else is needed, please let me know.
Thanks @t0rb3n for reporting this! Let us look into this matter and get back to you soon.
this may be because "skipped" is not a valid GitLab status. GitLab commit status can have the following values: running pending success failed cancelled
Hi @prince-panwar I think accoring to our codebase we do have the "skipped" build state in the following list:
- pending
- running
- canceled
- success
- failed
- skipped
This could indeed be a bug if that is the case.
But @t0rb3n I do noticed you have not provided the rest of the script so we cannot check more thoroughly. Could you try to see if your script matches with the following code snippet?:
pipeline {
agent any
stages {
stage('Pipeline Entering - Echo') {
steps {
echo('PIPELINE RUNNING - Frontend');
updateGitlabCommitStatus name: 'Pipeline Entering - 1', state: 'pending'
updateGitlabCommitStatus name: 'Pipeline Entering - 2', state: 'running'
updateGitlabCommitStatus name: 'Pipeline Entering - 3', state: 'canceled'
updateGitlabCommitStatus name: 'Pipeline Entering - 4', state: 'success'
updateGitlabCommitStatus name: 'Pipeline Entering - 5', state: 'failed'
updateGitlabCommitStatus name: 'Pipeline Entering - 6', state: 'skipped'
}
}
}
}
Thank you everyone for your fast answer. @prince-panwar Are you sure? According to this documentation from GitLab there are even more. Although I am not sure if this also applies to external running jobs. Edit: He seems to be right, as the API docs only provide the ones he wrote.
@krisstern Yes, we use agent any and pretty much nothing else, so this matches.
Also forgot to tell that we are running GitLab 15.8.
@t0rb3n I have had a second look at the tutorial page you referenced, and it is very out-of-date with the warning/message:
Deprecation Notice: This tutorial is out-of-date and is only preserved for educational purposes. These steps no longer work on the GitLab Demo Systems.
So for something that actually works you may want to try the README.md file of this repo at https://github.com/jenkinsci/gitlab-plugin#declarative-pipeline-jobs. They offer a standard syntax as follows:
pipeline {
agent any
post {
failure {
updateGitlabCommitStatus name: 'build', state: 'failed'
}
success {
updateGitlabCommitStatus name: 'build', state: 'success'
}
aborted {
updateGitlabCommitStatus name: 'build', state: 'canceled'
}
}
options {
gitLabConnection('your-gitlab-connection-name')
}
triggers {
gitlab(triggerOnPush: true, triggerOnMergeRequest: true, branchFilterType: 'All')
}
stages {
stage("build") {
steps {
updateGitlabCommitStatus name: 'build', state: 'running'
echo "hello world"
}
}
}
[...]
}
NB: Note that post {...} syntax here after the agent any line.
There are special steps to take if any one of the following applies in your case:
- You use the "Merge When Pipeline Succeeds" option for Merge Requests in GitLab, and
- Your Declarative Pipeline jobs have more than one stage, and
- You use a gitlabCommitStatus step in each stage to send status to GitLab...
So I would think you can try something like:
pipeline {
agent any
post {
failure {
updateGitlabCommitStatus name: 'build', state: 'failed'
}
success {
updateGitlabCommitStatus name: 'build', state: 'success'
}
aborted {
updateGitlabCommitStatus name: 'build', state: 'canceled'
}
}
options {
gitLabConnection('your-gitlab-connection-name')
}
triggers {
gitlab(triggerOnPush: true, triggerOnMergeRequest: true, branchFilterType: 'All')
}
stages {
stage('build') {
steps {
echo('PIPELINE RUNNING - Frontend');
updateGitlabCommitStatus name: 'build', state: 'running'
}
}
}
}
@krisstern Thank you for your answer. I found the documentation of this repo not too well explained which is why I used this older one. (Although I have to say, I just started using Jenkins last week, so that may be why I found it confusing. Since we are using multiple stages the provided example isn't too helpful imo. Especially the post part isn't really doable with multiple stages if you want to correctly show which stage failed. But again, this may just be my limited knowledge.)
But nonetheless the pipeline works just fine. Everything shows up like expected with the exception of the skipped status but that wouldn't have been solved with the README anyway :)
Thanks for your feedback @t0rb3n! We will review our README.md and maybe make more detailed documentation like a GitHub pages site so that users can have more detailed documentation on how to use the plugin in the near future. We really appreciate your constructive comments.
Hey @krisstern, Is this still open? If so, could you help me navigate and get this resolved? Thanks
Hi @techsavvyash Yes, this issue is still open. We are looking for help to add details to the relevant README.md document, for example.
Okay, can you direct me to where the documentation is required to be added?
Hi @techsavvyash Most details are already in this thread.