Search code examples
jenkinsjenkins-pipeline

Jenkins finish pipeline as pending


I'm using Jenkins for builds and wanted to know if this scenario was possible. We have an external system that sends us a webhook request when a job completes (success or failure). I want a pipeline in Jenkins to run, start the request and then finish but not show status as "SUCCESS". I want it to still be pending. Is this possible? When the webhook request comes in, I would like that to dictate on the PR in GitHub how the pipeline did. Is this possible in Jenkins? I'm seeing currentBuild.currentResult but that doesn't have a PENDING status. Is this not possible?

Reason for this is I want the webhook to come back and tell Jenkins for that PR whether it was a success or failure.

I read the following for this:

setting status of a build in jenkins


Solution

  • It sounds like you are looking for the webhook-step plugin. It can pause the pipeline waiting for a webhook to be called. Plugin popularity tells you how uncommon this pattern is.

    You don't have to wait on a hook, if setting it up is more trouble than it's worth. Polling the PR status in a loop might be easier...

    But if you are asking whether a Jenkins pipeline status can be changed after the pipeline has completed then the answer is no - completed pipelines don't have an "unresolved" status.