Using params.item in agent docker section ...

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

Using params.item in agent docker section ...

Eric Tan
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

--
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/5c63e393-3da6-49a4-ad99-7e9814bbe828%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Using params.item in agent docker section ...

Michael Pailloncy
Hi,

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

Cheers

2017-10-06 7:53 GMT+02:00 Eric Tan <[hidden email]>:
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

--
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/5c63e393-3da6-49a4-ad99-7e9814bbe828%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/CAPO77c05jmUuNEtxy%2BcfXHUpbmUOfpZz5eD3bHBg%2B%2Bhmjo1F4w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.