Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-notify before build starts #74

Open
jeff-minard-ck opened this issue Nov 5, 2015 · 7 comments
Open

Pre-notify before build starts #74

jeff-minard-ck opened this issue Nov 5, 2015 · 7 comments

Comments

@jeff-minard-ck
Copy link

I'd like to have know if this plugin could send notifications for job runs that are queued, but not yet running.

The problem I'm seeing is that we have a limited number of Jenkins executors. Users create 15 PRs in stash. Each PR triggers a notification to Jenkins. Jenkins queues up all of these jobs. However, it does not trigger the stash rest api that a job has started -- thus the PR at stash looks like no build job has been triggered. The stash side doesn't see the "build in progress" till the job is finally picked up.

Ideally the stash notifier could "ping back" to Stash once the job is queued, not once it's begun.

Is that possible?

@scaytrase
Copy link
Member

Current Stash API knows only three statuses

"state": "<INPROGRESS|SUCCESSFUL|FAILED>",

As the build step there is nothing to do with these ones as they triggered only at the time the job actually starts.

The internet says that BuildWrapper could be implemented, but this a kind of research for me.

@jeff-minard-ck
Copy link
Author

Yeah, I want to set state=inprogress over at stash when the job call is received as jenkins not when job actually starts building. This way when there's a long queue, stash will show that the build has "started" (effectively been queued up to run).

@byF
Copy link

byF commented Jan 6, 2016

This is actually a bug; once a job is in a queue, it should be marked as pending in Stash.

There is an option to use BuildWrapper (I'm not sure I understand well what the class does though) or to use QueueListener. Either case, this will require quite extensive decomposition of StashNotifier class.

It might be also interesting to go completely in the way of Listeners (i.e. use BuildStepListener instead of Notifier) and rewrite the plugin completely.

@scaytrase
Copy link
Member

Decomposition is an option. I hope I'll get this and start 2.0 branch sometimes

@scaytrase
Copy link
Member

The general question for pre-build state is that what to do with job state if it was cancelled. No one status represent this situation. Currently I see no option to unmark the state.

Until we have a decision - pre-build notifying is not an option

@proski
Copy link
Contributor

proski commented Feb 19, 2019

The general question for pre-build state is that what to do with job state if it was cancelled. No one status represent this situation. Currently I see no option to unmark the state.

Canceling the build from the queue is not much different from aborting the build during the first second. The build has not completed, and will not complete, but the code under test is not to blame.

Abort marks the build as FAILED, and so should the cancel. That's not optimal, obviously, but far better than reporting SUCCESS (which could allow merging untested code) or INPROGRESS (which could make the user wait for the results instead of taking action).

We could ask Atlassian to add more codes in the future versions.

In the meantime, maybe the detailed status could be added to the message, e.g. cancelled by Jenkins @ http://jenkins/ or aborted by Jenkins @ http://jenkins/

For matrix builds that report results from the child jobs only, nothing needs to be reported on cancel.

@IanKL
Copy link

IanKL commented May 4, 2022

I've created a request to add options including QUEUED to the BuildState enum: https://jira.atlassian.com/browse/BSERV-13304

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants