Hi Carlos,

Yes, I'm well aware that containerTemplate is deprecated. Does it follow that containerTemplates is also deprecated? The warning message implies that this is not the case, so it is somewhat unclear.

Regardless of this, I am still interested to know what the correct syntax is, since yaml is expanding my env vars to null (https://issues.jenkins-ci.org/browse/JENKINS-53472) I'm not able to use that as a drop-in replacement. I can workaround this by generating a static yaml file from a template with variables expanded by something external, but it's not as neat.

Kind regards,

Matt

On 08/09/18 07:54, Carlos Sanchez wrote:
https://github.com/jenkinsci/kubernetes-plugin/blob/master/README.md#declarative-pipeline

Note that it was previously possible to define containerTemplate but that has been deprecated in favor of the yaml format.

containerTemplates also works but yaml syntax is preferred



On Sat, Sep 8, 2018 at 12:56 AM Matt Buckland <[email protected] <mailto:[email protected]>> wrote:

    Hello list,

    I'm running jenkins inside k8s:
    jenkins/jenkins:lts
    jenkins/jnlp-slave:3.23-1
    kubernetes-plugin: 1.12.4

    I'm using the following to define my agent:

       agent {
         kubernetes {
           label "${JOB_NAME}"
           inheritFrom 'default'
           containerTemplate {
             name 'jnlp'
             image
    
'${ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com/jenkins/jnlp-slave:${AGENT_IMAGE_TAG}
    <http://amazonaws.com/jenkins/jnlp-slave:$%7BAGENT_IMAGE_TAG%7D>'
             resourceRequestCpu '200m'
             resourceLimitCpu '1'
             resourceRequestMemory '256Mi'
             resourceLimitMemory '1Gi'
           }



    In the logs I have this message:

    Sep 07, 2018 5:11:34 PM
    org.csanchez.jenkins.plugins.kubernetes.pipeline.KubernetesDeclarativeAgent
    getAsArgs
    WARNING: containerTemplate option in declarative pipeline is
    deprecated, use containerTemplates


    I've not been able to find any documentation or examples showing how
    to use this containerTemplates option (note the "s" on the end).
    I've tried things such as:

           containerTemplates [
             containerTemplate {
               name 'jnlp'
               image
    
'${ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com/jenkins/jnlp-slave:${AGENT_IMAGE_TAG}
    <http://amazonaws.com/jenkins/jnlp-slave:$%7BAGENT_IMAGE_TAG%7D>'
               resourceRequestCpu '200m'
               resourceLimitCpu '1'
               resourceRequestMemory '256Mi'
               resourceLimitMemory '1Gi'
             }
           ]


    and various other combinations, but I can't get it to work.

    Anyone have any suggestions?

    Many thanks,

    Matt

-- 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 [email protected]
    <mailto:[email protected]>.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/jenkinsci-users/c98259fd-1aa4-40a1-890d-cb157cf3bf5b%40googlegroups.com
    
<https://groups.google.com/d/msgid/jenkinsci-users/c98259fd-1aa4-40a1-890d-cb157cf3bf5b%40googlegroups.com?utm_medium=email&utm_source=footer>.
    For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/R_WpAZtl6qE/unsubscribe. To unsubscribe from this group and all its topics, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CALHFn6MkJMQsSudHjs55zADR%2BQWhJT_HCqZM_RBGKaDrScUmfQ%40mail.gmail.com <https://groups.google.com/d/msgid/jenkinsci-users/CALHFn6MkJMQsSudHjs55zADR%2BQWhJT_HCqZM_RBGKaDrScUmfQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/112abd15-c230-d306-ad50-0725bb28afd4%40fascinatedcow.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to