A build can start before the last one has finished?

16 views
Skip to first unread message

Jonathan Hodgson

unread,
Jul 5, 2016, 11:09:40 AM7/5/16
to Jenkins Users
Hi, 

I trigger builds of my pipeline project remotely using the /build page of the job (using a python script that sends various options as parameters)

This is working fine, but I just noticed that I could launch a new build while the last one was still running, and rather than waiting for the previous build to finish, it started building immediately.

This is an issue, because they're building in the same folders, which could cause a right mess with compilation.

Have I missed something?

On the other hand, I can see the benefit in being able to start the compilation stage of the next build once the previous one is in the testing phase.

I would have thought this is a fairly normal thing to want to do?

Antonio Muñiz

unread,
Jul 20, 2016, 11:57:30 AM7/20/16
to jenkins...@googlegroups.com
> This is an issue, because they're building in the same folders, which could cause a right mess with compilation.

If two calls to `node` (from the same job) matching the same node are
done concurrently then two separated workspaces will be allocated, so
there is no risk.

> On the other hand, I can see the benefit in being able to start the compilation stage of the next build once the previous one is in the testing phase.

Use the `lock` step (from `lockable-resources-plugin`):

stage 'Build'
lock ('compile-env') {
[...]
}
stage 'Test'
lock ('test-env') {
[...]
}

This way only one build will be inside a `lock` block concurrently.
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/e5c534a7-5fec-4464-b65f-760430dbd385%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Antonio Muñiz
Software Engineer
CloudBees, Inc.
Reply all
Reply to author
Forward
0 new messages