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

custom jnlp not working

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Component/s: kubernetes-plugin
    • Labels:
      None
    • Environment:
      Jenkins: 2.150.3
      Kubernetes: 1.14.3
    • Similar Issues:

      Description

      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

        Attachments

          Issue Links

            Activity

            sushantp Sushant Pradhan created issue -
            csanchez Carlos Sanchez made changes -
            Field Original Value New Value
            Link This issue duplicates JENKINS-55096 [ JENKINS-55096 ]
            sushantp Sushant Pradhan made changes -
            Description I have this in my pipeline:
            {code:java}
            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"
                  }
                }
            }

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

             
            {code:java}
            [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/TDP/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
            {code}
            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
            I have this in my pipeline:
            {code:java}
            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"
                  }
                }
            }

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

             
            {code:java}
            [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
            {code}
            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
            sushantp Sushant Pradhan made changes -
            Attachment short-logs.txt [ 46285 ]
            csanchez Carlos Sanchez made changes -
            Link This issue is related to JENKINS-56082 [ JENKINS-56082 ]
            sushantp Sushant Pradhan made changes -
            Attachment image-2019-03-06-08-43-05-008.png [ 46296 ]
            sushantp Sushant Pradhan made changes -
            Attachment image-2019-03-06-12-53-17-500.png [ 46303 ]
            sushantp Sushant Pradhan made changes -
            Attachment image-2019-03-06-12-54-40-898.png [ 46304 ]
            martinm82 Martin M made changes -
            martinm82 Martin M made changes -
            csanchez Carlos Sanchez made changes -
            Link This issue is duplicated by JENKINS-57496 [ JENKINS-57496 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "PR #507 (Web Link)" [ 23101 ]
            jglick Jesse Glick made changes -
            Assignee Carlos Sanchez [ csanchez ] Jesse Glick [ jglick ]
            jglick Jesse Glick made changes -
            Resolution Cannot Reproduce [ 5 ]
            Status Open [ 1 ] Resolved [ 5 ]

              People

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

                Dates

                Created:
                Updated:
                Resolved: