Quantcast

Declarative Pipeline - Agent wonderment

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Declarative Pipeline - Agent wonderment

Danny Rehelis
Help me understand this please, in case my Pipeline looks like this -

pipeline {
    agent none
    stages {
        stage ('Stage #1') {
agent { label 'builder' }
            steps {
echo "Hello World"
}
}
        stage ('Stage #2') {
agent { label 'builder' }
            steps {
echo "Hello World"
}
}
}
}

Will the second stage run on the same builder labeled server instance (same one from first stage) or will pick any other possibly idle labeled server available at the time?
Is it possible to force "stickiness" for explicitly configured agents?

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAObRFCUJrs_BrOqrDXH62E_27JpL3bBQDJf%3DWsWkdEO%3D8CmKdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Declarative Pipeline - Agent wonderment

Christopher Orr
On Thu, 20 Apr 2017, at 15:02, Danny Rehelis wrote:

> Help me understand this please, in case my Pipeline looks like this -
>
>         stage ('Stage #1') {
> agent { label 'builder' }
>         stage ('Stage #2') {
> agent { label 'builder' }
>
> Will the second stage run on the same builder labeled server instance
> (same one from first stage) or will pick any other possibly idle labeled server
> available at the time?
> Is it possible to force "stickiness" for explicitly configured agents?

In this case, there's no guarantee that the two builds will run in the
same workspace, or even on the same agent, if there are multiple agents
with the 'builder' label.

For stickiness, you'd probably have to define your `agent` once at the
top level of the Pipeline, and then maybe do `agent none` in the stages
where you don't need that agent (not entirely sure whether that works).

Regards,
Chris

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1493111797.3897618.955339536.6BB709B6%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.
Loading...