Using params.item in agent docker section ...

11 views
Skip to first unread message

Eric Tan

unread,
Oct 6, 2017, 1:53:13 AM10/6/17
to Jenkins Users
Hi

Is there a way to use parameters in the agent docker section like:

pipeline {

    parameters {

        string(name: 'OS_PORT', defaultValue: '8888')

        string(name: 'CONTAINER_PORT', defaultValue: '8888')

   }

   agent { 

        docker {

            image 'someimage'

            // args '-p 8888:8888'

            args '-p ${params.OS_PORT}:${params.CONTAINER_PORT}'

        }

    }


}


It does not work above.

Thanks

Michael Pailloncy

unread,
Oct 6, 2017, 4:01:25 PM10/6/17
to jenkins...@googlegroups.com
Hi,

To enable String interpolation, you need to use double quotes instead of simple quotes, otherwise variables are not resolved.

Cheers

--
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-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5c63e393-3da6-49a4-ad99-7e9814bbe828%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages