Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-56375

custom jnlp not working

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • kubernetes-plugin
    • None
    • 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

        1. image-2019-03-06-08-43-05-008.png
          74 kB
          Sushant Pradhan
        2. image-2019-03-06-12-53-17-500.png
          5 kB
          Sushant Pradhan
        3. image-2019-03-06-12-54-40-898.png
          5 kB
          Sushant Pradhan
        4. Screenshot 2019-04-24 at 13.47.32.png
          237 kB
          Martin M
        5. Screenshot 2019-04-24 at 13.49.09.png
          162 kB
          Martin M
        6. short-logs.txt
          16 kB
          Sushant Pradhan

            jglick Jesse Glick
            sushantp Sushant Pradhan
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: