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

18 views
Skip to first unread message

john levin

unread,
Aug 26, 2020, 8:53:50 AM8/26/20
to Jenkins Users

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.


john levin

unread,
Aug 26, 2020, 1:50:23 PM8/26/20
to jenkins...@googlegroups.com
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, <smart...@gmail.com> 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 jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a425f6c3-b16f-435d-91a6-66fadf18e05cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages