custom jnlp not working

XMLWordPrintable

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: Major
    • Component/s: kubernetes-plugin
    • None
    • Environment:
      Jenkins: 2.150.3
      Kubernetes: 1.14.3

      I have this in my pipeline:

      def label = "mypod-${UUID.randomUUID().toString()}"
      podTemplate(label: label, yaml: """
      apiVersion: v1
      kind: Pod
      metadata:
        labels:
          some-label: some-label-value
      spec:
        containers:
        - name: jnlp
          image: 1234567890.dkr.ecr.us-east-1.amazonaws.com/jenkins-slave:1.0.0
          command:
          - /usr/local/bin/jenkins-slave
          tty: true
          securityContext:
            runAsUser: 10000
            allowPrivilegeEscalation: false
      """
      ) {
          node (label) {
            container('jnlp') {
              sh "hostname"
              sh "mvn --version"
            }
          }
      }
      
      

      When I execute this, i expect that the maven version from my custom jnlp image gets printed, instead I get the following error:

       

      [Pipeline] node
      Agent mypod-6cf91ebc-71db-4c56-80c8-8f332d796ccf-413hd-m09jd is provisioned from template Kubernetes Pod Template
      Agent specification [Kubernetes Pod Template] (mypod-6cf91ebc-71db-4c56-80c8-8f332d796ccf): 
      * [jnlp] jenkins/jnlp-slave:alpine
      yaml:
      
      apiVersion: v1
      kind: Pod
      metadata:
        labels:
          some-label: some-label-value
      spec:
        containers:
        - name: jnlp
          image: 1234567890.dkr.ecr.us-east-1.amazonaws.com/jenkins-slave:1.0.0
          command:
          - /usr/local/bin/jenkins-slave
          tty: true
          securityContext:
            runAsUser: 10000
            allowPrivilegeEscalation: false
      
      
      Running on mypod-6cf91ebc-71db-4c56-80c8-8f332d796ccf-413hd-m09jd in /home/jenkins/workspace/TDP/builds/test-slaves
      [Pipeline] {
      [Pipeline] container
      [Pipeline] {
      [Pipeline] sh
      + hostname
      mypod-6cf91ebc-71db-4c56-80c8-8f332d796ccf-413hd-m09jd
      [Pipeline] sh
      + mvn --version
      /home/jenkins/workspace/ABC/builds/test-slaves@tmp/durable-ef4c2933/script.sh: line 1: mvn: not found
      [Pipeline] }
      [Pipeline] // container
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] }
      [Pipeline] // podTemplate
      [Pipeline] End of Pipeline
      [Office365connector] No webhooks to notify
      ERROR: script returned exit code 127
      Finished: FAILURE
      

      If you see the message above, it is still provisiong the jnlp:alpine image and using that as default.

       

      Can you please correct me if my usage is incorrect and the right way to override jnlp

            Assignee:
            Jesse Glick
            Reporter:
            Sushant Pradhan
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: