jenkinsci/stashnotifier-plugin

Add argument for buildResult

Closed this issue · 6 comments

I would like to have an argument for the buildResult which is reportet to bitbucket.

My use Case:
From pipeline A I'm stating an integration pipeline B with build(... wait: false, ...). Just after that call pipeline A terminates succesfully. From this moment on, it looks like (in Bitbucket) all the pipelines have been successfully completed. The notification about Pipeline B takes several minutes, until the checkouts in Pipeline B.
My preferred solution: Before calling build() in Pipeline A, I want to inform Bitbucket about Pipeline B, which is INPROGRESS.

You can submit custom SHA1 and project key to be notified into bitbucket server as notifier argument, see the readme section.

But from my POV this looks like single pipeline with stages since you strongly coupling inner pipelines.

Thanks for your reply.
I'm already using the custom SHA1 and project key. The notifications from Pipeline B are fine.
With a custom project key I'm even able to make the notification from Pipeline A (about starting Pipeline B) and update that notification from Pipeline B subsequently. But the notification from Pipeline A contains always the buildResult from Pipeline A (The status should be constant INPROGRESS when notified from Pipeline A).

You are right, it could be seen as stages. But the integration pipeline is triggered from 4 different repositories.

(The status should be constant INPROGRESS when notified from Pipeline A)

You can also override the build result and set it to inprogress manually in def call

INPROGRESS means "if (buildResult == null)" (StashNotifier.java) is true.
Unfortunately, "currentBuild.result = null" produces a java.lang.NullPointerException.

Hmmm, that's the argument that really matters. Ok, I'll think about it

I think its a good idea to add buildResult/buildState as argument. it help to track which part is success/failed on the bitbucket if we have multiple builds. Currently, if we do multiple notification to bitbucket, the result is depends on the currentBuild.result.

CMIIW