Best way to say "never mind" in a pipeline script?

16 views
Skip to first unread message

David Karr

unread,
Dec 21, 2018, 3:38:36 PM12/21/18
to Jenkins Users
First some background, although my actual question is likely pretty simple.

I have a situation where there are two different jobs that could run for particular projects. I have a multibranch pipeline that runs for master and release branches, what I might call "target" branches,being the target of a merge.  I also have a plain pipeline that gets spawned from BitBUcket for pull requests (using the "Pull Request Notification" BitBucket mechanism). This gets spawned for ordinary pull requests, but we also have "automerge" set for release branches, so when you merge a PR to a release branch, it automerges to master.  That also results in a pull request, but the branch is a release branch.  At the point the PR is merged to the release branch, it causes two builds to be spawned, one on the multibranch pipeline, and one on the plain pipeline.  I'd really like to just skip the build on the plain pipeline in this case.  There is no "branch filter" in the Pull Request Notification system, so the only time I can do something about this is in the pipeline script.  It's simple to detect this situation in the pipeline script, but what I want to determine is how to abort the script automatically at this point without making it look like an "error".  I don't know how to abort the entire pipeline script in the script itself, without throwing an exception.  Throwing an exception doesn't seem quite right.
Reply all
Reply to author
Forward
0 new messages