Declarative pipeline to use agent as both docker & slave machines with label

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

Declarative pipeline to use agent as both docker & slave machines with label

john levin

Hello Everyone

I have a scenario like i need to run my CI builds in a container and this container should run on slave machines accordingly (i have same image in all my slave machines). But pipeline is accepting either agent as docker or slave machines.


--
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/a425f6c3-b16f-435d-91a6-66fadf18e05cn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Declarative pipeline to use agent as both docker & slave machines with label

john levin
Hello,

The answer is straight forward, I missed somehow.

Under agent just include label options

pipeline {
    agent {
        docker { image 'node:14-alpine'
                 label '<label_name>' }
    }

Thank you

On Wed, 26 Aug, 2020, 6:23 pm john levin, <[hidden email]> wrote:

Hello Everyone

I have a scenario like i need to run my CI builds in a container and this container should run on slave machines accordingly (i have same image in all my slave machines). But pipeline is accepting either agent as docker or slave machines.


--
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/a425f6c3-b16f-435d-91a6-66fadf18e05cn%40googlegroups.com.

--
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/CAGJXh7rhEfTrpyUOLQHxcL8J%2BkE7JHzTHdrpspwm%3D4tXbQbgXg%40mail.gmail.com.