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

            Hide
            csanchez Carlos Sanchez added a comment -

            check the logs for entries {{containers=[ContainerTemplate ... }}
            https://github.com/jenkinsci/kubernetes-plugin/#debugging

            Show
            csanchez Carlos Sanchez added a comment - check the logs for entries {{containers=[ContainerTemplate ... }} https://github.com/jenkinsci/kubernetes-plugin/#debugging
            Hide
            sushantp Sushant Pradhan added a comment - - edited

            This is what i see in logs:

            $ kubectl logs pods/mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x                                                                                             
            Warning: JnlpProtocol3 is disabled by default, use JNLP_PROTOCOL_OPTS to alter the behavior                                                                                         
            Mar 04, 2019 5:56:29 PM hudson.remoting.jnlp.Main createEngine                                                                                                                      
            INFO: Setting up agent: mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x                                                                                                      
            Mar 04, 2019 5:56:29 PM hudson.remoting.jnlp.Main$CuiListener                                                                                                                 
            INFO: Jenkins agent is running in headless mode.                                                                                                                                    
            Mar 04, 2019 5:56:29 PM hudson.remoting.Engine startEngine                                                                                                                          
            INFO: Using Remoting version: 3.27                                                                                                                                                  
            Mar 04, 2019 5:56:29 PM hudson.remoting.Engine startEngine                                                                                                                          
            WARNING: No Working Directory. Using the legacy JAR Cache location: /home/jenkins/.jenkins/cache/jars                                                                               
            Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status                                                                                                                
            INFO: Locating server among [http://xxx.cje.svc.cluster.local/xxx/]                                                                                           
            Mar 04, 2019 5:56:30 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve                                                                                             
            INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping, Diagnostic-Ping, OperationsCenter2]                                                                    
            Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status                                                                                                                
            INFO: Agent discovery successful                                                                                                                                                    
              Agent address: xxx.cje.svc.cluster.local                                                                                                                               
              Agent port:    50001                                                                                                                                                              
              Identity:      a3:5c:32:24:ef:55:c5:ec:20:1d:04:a5:f2:4e:96:31                                                                                                                    
            Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status                                                                                                                
            INFO: Handshaking                                                                                                                                                                   
            Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status                                                                                                                
            INFO: Connecting to xxx.cje.svc.cluster.local:50001                                                                                                                      
            Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status                                                                                                                
            INFO: Trying protocol: JNLP4-connect                                                                                                                                                
            Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status                                                                                                                
            INFO: Remote identity confirmed: a3:5c:32:24:ef:55:c5:ec:20:1d:04:a5:f2:4e:96:31                                                                                                    
            Mar 04, 2019 5:56:32 PM hudson.remoting.jnlp.Main$CuiListener status                                                                                                                
            INFO: Connected
            $ kubectl logs pods/mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x jnlp                                                                                        
            Warning: JnlpProtocol3 is disabled by default, use JNLP_PROTOCOL_OPTS to alter the behavior                                                                                         
            Mar 04, 2019 5:56:29 PM hudson.remoting.jnlp.Main createEngine                                                                                                                      
            INFO: Setting up agent: mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x                                                                                                      
            Mar 04, 2019 5:56:29 PM hudson.remoting.jnlp.Main$CuiListener                                                                                                                 
            INFO: Jenkins agent is running in headless mode.                                                                                                                                    
            Mar 04, 2019 5:56:29 PM hudson.remoting.Engine startEngine                                                                                                                          
            INFO: Using Remoting version: 3.27                                                                                                                                                  
            Mar 04, 2019 5:56:29 PM hudson.remoting.Engine startEngine                                                                                                                          
            WARNING: No Working Directory. Using the legacy JAR Cache location: /home/jenkins/.jenkins/cache/jars                                                                               
            Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status                                                                                                                
            INFO: Locating server among [http://xxx.cje.svc.cluster.local/xxx/]                                                                                           
            Mar 04, 2019 5:56:30 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve                                                                                             
            INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping, Diagnostic-Ping, OperationsCenter2]                                                                    
            Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status                                                                                                                
            INFO: Agent discovery successful                                                                                                                                                    
              Agent address: xxx.cje.svc.cluster.local                                                                                                                               
              Agent port:    50001                                                                                                                                                              
              Identity:      a3:5c:32:24:ef:55:c5:ec:20:1d:04:a5:f2:4e:96:31                                                                                                                    
            Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status                                                                                                                
            INFO: Handshaking                                                                                                                                                                   
            Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status                                                                                                                
            INFO: Connecting to xxx.cje.svc.cluster.local:50001                                                                                                                      
            Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status                                                                                                                
            INFO: Trying protocol: JNLP4-connect                                                                                                                                                
            Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status                                                                                                                
            INFO: Remote identity confirmed: a3:5c:32:24:ef:55:c5:ec:20:1d:04:a5:f2:4e:96:31                                                                                                    
            Mar 04, 2019 5:56:32 PM hudson.remoting.jnlp.Main$CuiListener status                                                                                                                
            INFO: Connected             
            

             

            And the describe pod:

            ubectl describe pods/mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x 
            Name:               mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x
            Namespace:          cje
            Priority:           0
            PriorityClassName:  <none>
            Node:               ip-10-19-3-11.us-east-1.compute.internal/10.19.3.11
            Start Time:         Mon, 04 Mar 2019 17:56:28 +0000
            Labels:             jenkins=slave
                                jenkins/mypod-d5965026-b597-4fe9-88d6-cd2d1679d039=true
                                some-label=some-label-value
            Annotations:        <none>
            Status:             Running
            IP:                 10.19.3.11
            Containers:
              jnlp:
                Container ID:  docker://352643427c7fb9790eefafa962e9dc700ba670a93988ae15a75c5b82881ea507
                Image:         jenkins/jnlp-slave:alpine
                Image ID:      docker-pullable://jenkins/jnlp-slave@sha256:8e330d8bc461440c797d543b9872e54b328da3ef3b052180bb5aed33204d4384
                Port:          <none>
                Host Port:     <none>
                Command:
                  /bin/sh
                Args:
                  /var/jenkins_config/jenkins-agent
                State:          Running
                  Started:      Mon, 04 Mar 2019 17:56:29 +0000
                Ready:          True
                Restart Count:  0
                Environment:
                  JENKINS_SECRET:      d3b20e203b3166858e18be08fb8a167132997e8e0dafafbfb76944225b56763454
                  JENKINS_AGENT_NAME:  mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x
                  JENKINS_NAME:        mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x
                  JENKINS_URL:         http://xxx.cje.svc.cluster.local/xxx/
                  HOME:                /home/jenkins
                Mounts:
                  /home/jenkins from workspace-volume (rw)
                  /var/jenkins_config from volume-0 (rw)
                  /var/run/secrets/kubernetes.io/serviceaccount from default-token-cprnd (ro)
            Conditions:
              Type              Status
              Initialized       True
              Ready             True
              ContainersReady   True
              PodScheduled      True
            Volumes:
              volume-0:
                Type:      ConfigMap (a volume populated by a ConfigMap)
                Name:      jenkins-agent
                Optional:  false
              workspace-volume:
                Type:    EmptyDir (a temporary directory that shares a pod's lifetime)
                Medium:
              default-token-cprnd:
                Type:        Secret (a volume populated by a Secret)
                SecretName:  default-token-cprnd
                Optional:    false
            QoS Class:       BestEffort
            Node-Selectors:  <none>
            Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                             node.kubernetes.io/unreachable:NoExecute for 300s
            Events:          <none>                                                                                                                                                        
                                                                                                                                                                                                
            
            

             

            It is not overriding my jnlp.

            May be my usage is incorrect. Can you share me a pipeline usage?

            Show
            sushantp Sushant Pradhan added a comment - - edited This is what i see in logs: $ kubectl logs pods/mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x Warning: JnlpProtocol3 is disabled by default , use JNLP_PROTOCOL_OPTS to alter the behavior Mar 04, 2019 5:56:29 PM hudson.remoting.jnlp.Main createEngine INFO: Setting up agent: mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x Mar 04, 2019 5:56:29 PM hudson.remoting.jnlp.Main$CuiListener INFO: Jenkins agent is running in headless mode. Mar 04, 2019 5:56:29 PM hudson.remoting.Engine startEngine INFO: Using Remoting version: 3.27 Mar 04, 2019 5:56:29 PM hudson.remoting.Engine startEngine WARNING: No Working Directory. Using the legacy JAR Cache location: /home/jenkins/.jenkins/cache/jars Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Locating server among [http: //xxx.cje.svc.cluster.local/xxx/] Mar 04, 2019 5:56:30 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping, Diagnostic-Ping, OperationsCenter2] Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Agent discovery successful Agent address: xxx.cje.svc.cluster.local Agent port: 50001 Identity: a3:5c:32:24:ef:55:c5:ec:20:1d:04:a5:f2:4e:96:31 Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Handshaking Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Connecting to xxx.cje.svc.cluster.local:50001 Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Trying protocol: JNLP4-connect Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Remote identity confirmed: a3:5c:32:24:ef:55:c5:ec:20:1d:04:a5:f2:4e:96:31 Mar 04, 2019 5:56:32 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Connected $ kubectl logs pods/mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x jnlp Warning: JnlpProtocol3 is disabled by default , use JNLP_PROTOCOL_OPTS to alter the behavior Mar 04, 2019 5:56:29 PM hudson.remoting.jnlp.Main createEngine INFO: Setting up agent: mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x Mar 04, 2019 5:56:29 PM hudson.remoting.jnlp.Main$CuiListener INFO: Jenkins agent is running in headless mode. Mar 04, 2019 5:56:29 PM hudson.remoting.Engine startEngine INFO: Using Remoting version: 3.27 Mar 04, 2019 5:56:29 PM hudson.remoting.Engine startEngine WARNING: No Working Directory. Using the legacy JAR Cache location: /home/jenkins/.jenkins/cache/jars Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Locating server among [http: //xxx.cje.svc.cluster.local/xxx/] Mar 04, 2019 5:56:30 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping, Diagnostic-Ping, OperationsCenter2] Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Agent discovery successful Agent address: xxx.cje.svc.cluster.local Agent port: 50001 Identity: a3:5c:32:24:ef:55:c5:ec:20:1d:04:a5:f2:4e:96:31 Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Handshaking Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Connecting to xxx.cje.svc.cluster.local:50001 Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Trying protocol: JNLP4-connect Mar 04, 2019 5:56:30 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Remote identity confirmed: a3:5c:32:24:ef:55:c5:ec:20:1d:04:a5:f2:4e:96:31 Mar 04, 2019 5:56:32 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Connected   And the describe pod: ubectl describe pods/mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x Name: mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x Namespace: cje Priority: 0 PriorityClassName: <none> Node: ip-10-19-3-11.us-east-1.compute.internal/10.19.3.11 Start Time: Mon, 04 Mar 2019 17:56:28 +0000 Labels: jenkins=slave jenkins/mypod-d5965026-b597-4fe9-88d6-cd2d1679d039= true some-label=some-label-value Annotations: <none> Status: Running IP: 10.19.3.11 Containers: jnlp: Container ID: docker: //352643427c7fb9790eefafa962e9dc700ba670a93988ae15a75c5b82881ea507 Image: jenkins/jnlp-slave:alpine Image ID: docker-pullable: //jenkins/jnlp-slave@sha256:8e330d8bc461440c797d543b9872e54b328da3ef3b052180bb5aed33204d4384 Port: <none> Host Port: <none> Command: /bin/sh Args: / var /jenkins_config/jenkins-agent State: Running Started: Mon, 04 Mar 2019 17:56:29 +0000 Ready: True Restart Count: 0 Environment: JENKINS_SECRET: d3b20e203b3166858e18be08fb8a167132997e8e0dafafbfb76944225b56763454 JENKINS_AGENT_NAME: mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x JENKINS_NAME: mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x JENKINS_URL: http: //xxx.cje.svc.cluster.local/xxx/ HOME: /home/jenkins Mounts: /home/jenkins from workspace-volume (rw) / var /jenkins_config from volume-0 (rw) / var /run/secrets/kubernetes.io/serviceaccount from default -token-cprnd (ro) Conditions: Type Status Initialized True Ready True ContainersReady True PodScheduled True Volumes: volume-0: Type: ConfigMap (a volume populated by a ConfigMap) Name: jenkins-agent Optional: false workspace-volume: Type: EmptyDir (a temporary directory that shares a pod's lifetime) Medium: default -token-cprnd: Type: Secret (a volume populated by a Secret) SecretName: default -token-cprnd Optional: false QoS Class : BestEffort Node-Selectors: <none> Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s node.kubernetes.io/unreachable:NoExecute for 300s Events: <none>   It is not overriding my jnlp. May be my usage is incorrect. Can you share me a pipeline usage?
            Hide
            csanchez Carlos Sanchez added a comment -
            Show
            csanchez Carlos Sanchez added a comment - look at the master logs https://github.com/jenkinsci/kubernetes-plugin/#debugging
            Hide
            sushantp Sushant Pradhan added a comment -

            All I can see in the time range when the job was running is:

             

            Mar 04, 2019 5:56:28 PM com.cloudbees.jenkins.plugins.kube.ListenableKubernetesLauncher launch
            INFO: Created Pod: mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x in namespace cje
            Mar 04, 2019 5:56:28 PM hudson.slaves.NodeProvisioner$2 run
            INFO: Kubernetes Pod Template provisioning successfully completed. We have now 2 computer(s)
            Mar 04, 2019 5:56:28 PM okhttp3.internal.platform.Platform log
            INFO: ALPN callback dropped: HTTP/2 is disabled. Is alpn-boot on the boot class path?
            Mar 04, 2019 5:56:30 PM hudson.TcpSlaveAgentListener$ConnectionHandler run
            WARNING: Connection #27 failed
            java.io.EOFException
             at java.io.DataInputStream.readFully(DataInputStream.java:197)
             at java.io.DataInputStream.readFully(DataInputStream.java:169)
             at hudson.TcpSlaveAgentListener$ConnectionHandler.run(TcpSlaveAgentListener.java:244)
            Mar 04, 2019 5:56:30 PM hudson.TcpSlaveAgentListener$ConnectionHandler run
            INFO: Accepted JNLP4-connect connection #28 from /10.19.3.11:60710
            Mar 04, 2019 5:56:40 PM org.csanchez.jenkins.plugins.kubernetes.pipeline.ContainerExecDecorator$1 doLaunch
            INFO: Created process inside pod: [mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x], container: [jnlp] with pid:[-1]
            Mar 04, 2019 6:26:41 PM okhttp3.internal.platform.Platform log
            INFO: ALPN callback dropped: HTTP/2 is disabled. Is alpn-boot on the boot class path?
            Mar 04, 2019 6:26:41 PM okhttp3.internal.platform.Platform log
            INFO: ALPN callback dropped: HTTP/2 is disabled. Is alpn-boot on the boot class path?
            Mar 04, 2019 6:26:43 PM org.csanchez.jenkins.plugins.kubernetes.pipeline.ContainerExecDecorator$1 doLaunch
            INFO: Created process inside pod: [mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x], container: [jnlp] with pid:[-1]
            Mar 04, 2019 6:26:43 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave _terminate
            INFO: Terminating Kubernetes instance for agent mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x
            

             

            Can you please provide me sample of how to configure bring your own jnlp both ui and pipeline?

             

             

             

            Show
            sushantp Sushant Pradhan added a comment - All I can see in the time range when the job was running is:   Mar 04, 2019 5:56:28 PM com.cloudbees.jenkins.plugins.kube.ListenableKubernetesLauncher launch INFO: Created Pod: mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x in namespace cje Mar 04, 2019 5:56:28 PM hudson.slaves.NodeProvisioner$2 run INFO: Kubernetes Pod Template provisioning successfully completed. We have now 2 computer(s) Mar 04, 2019 5:56:28 PM okhttp3.internal.platform.Platform log INFO: ALPN callback dropped: HTTP/2 is disabled. Is alpn-boot on the boot class path? Mar 04, 2019 5:56:30 PM hudson.TcpSlaveAgentListener$ConnectionHandler run WARNING: Connection #27 failed java.io.EOFException at java.io.DataInputStream.readFully(DataInputStream.java:197) at java.io.DataInputStream.readFully(DataInputStream.java:169) at hudson.TcpSlaveAgentListener$ConnectionHandler.run(TcpSlaveAgentListener.java:244) Mar 04, 2019 5:56:30 PM hudson.TcpSlaveAgentListener$ConnectionHandler run INFO: Accepted JNLP4-connect connection #28 from /10.19.3.11:60710 Mar 04, 2019 5:56:40 PM org.csanchez.jenkins.plugins.kubernetes.pipeline.ContainerExecDecorator$1 doLaunch INFO: Created process inside pod: [mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x], container: [jnlp] with pid:[-1] Mar 04, 2019 6:26:41 PM okhttp3.internal.platform.Platform log INFO: ALPN callback dropped: HTTP/2 is disabled. Is alpn-boot on the boot class path? Mar 04, 2019 6:26:41 PM okhttp3.internal.platform.Platform log INFO: ALPN callback dropped: HTTP/2 is disabled. Is alpn-boot on the boot class path? Mar 04, 2019 6:26:43 PM org.csanchez.jenkins.plugins.kubernetes.pipeline.ContainerExecDecorator$1 doLaunch INFO: Created process inside pod: [mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x], container: [jnlp] with pid:[-1] Mar 04, 2019 6:26:43 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave _terminate INFO: Terminating Kubernetes instance for agent mypod-d5965026-b597-4fe9-88d6-cd2d1679d039-4fj65-0897x   Can you please provide me sample of how to configure bring your own jnlp both ui and pipeline?      
            Hide
            csanchez Carlos Sanchez added a comment -

            You have to increase the logging level as explained in https://github.com/jenkinsci/kubernetes-plugin/#debugging to see the detailed logs

            your template should work, you have the examples in https://github.com/jenkinsci/kubernetes-plugin/#pipeline-support

            Show
            csanchez Carlos Sanchez added a comment - You have to increase the logging level as explained in https://github.com/jenkinsci/kubernetes-plugin/#debugging to see the detailed logs your template should work, you have the examples in https://github.com/jenkinsci/kubernetes-plugin/#pipeline-support
            Hide
            sushantp Sushant Pradhan added a comment -

            short-logs.txt

            The samples do not cover custom jnlp scenario,

            I have no luck making it work. Here is a quick snapshot from logs. It tries to merge both 

            Parsed pod template from yaml: Pod(..., containers=[Container(args=[], command=[/usr/local/bin/jenkins-slave], ... , image=1234567890.dkr.ecr.us-east-1.amazonaws.com/jenkins-slave:1.0.0, ...)
            Combining pod templates, parent: PodTemplate{..., containers=[ContainerTemplate{name='jnlp', image='jenkins/jnlp-slave:alpine', ...}
            Parsed pod template from yaml: Pod(..., containers=[Container(args=[], command=[/usr/local/bin/jenkins-slave], env=[], envFrom=[], image=1234567890.dkr.ecr.us-east-1.amazonaws.com/jenkins-slave:1.0.0, ...)
            Combining pods, parent: Pod(..., containers=[Container(args=[], command=[/usr/local/bin/jenkins-slave], env=[], envFrom=[], image=1234567890.dkr.ecr.us-east-1.amazonaws.com/jenkins-slave:1.0.0, ...)
            Combining pods, template: Pod(..., image=jenkins/jnlp-slave:alpine, ...)
            Pods combined: Pod(..., image=jenkins/jnlp-slave:alpine, ...)
            Pod built: Pod(..., image=jenkins/jnlp-slave:alpine, ...)
            
            

            and boom my jnlp is overwritten. Please see detailed log attached

            Show
            sushantp Sushant Pradhan added a comment - short-logs.txt The samples do not cover custom jnlp scenario, I have no luck making it work. Here is a quick snapshot from logs. It tries to merge both   Parsed pod template from yaml: Pod(..., containers=[Container(args=[], command=[/usr/local/bin/jenkins-slave], ... , image=1234567890.dkr.ecr.us-east-1.amazonaws.com/jenkins-slave:1.0.0, ...) Combining pod templates, parent: PodTemplate{..., containers=[ContainerTemplate{name= 'jnlp' , image= 'jenkins/jnlp-slave:alpine' , ...} Parsed pod template from yaml: Pod(..., containers=[Container(args=[], command=[/usr/local/bin/jenkins-slave], env=[], envFrom=[], image=1234567890.dkr.ecr.us-east-1.amazonaws.com/jenkins-slave:1.0.0, ...) Combining pods, parent: Pod(..., containers=[Container(args=[], command=[/usr/local/bin/jenkins-slave], env=[], envFrom=[], image=1234567890.dkr.ecr.us-east-1.amazonaws.com/jenkins-slave:1.0.0, ...) Combining pods, template: Pod(..., image=jenkins/jnlp-slave:alpine, ...) Pods combined: Pod(..., image=jenkins/jnlp-slave:alpine, ...) Pod built: Pod(..., image=jenkins/jnlp-slave:alpine, ...) and boom my jnlp is overwritten. Please see detailed log attached
            Hide
            csanchez Carlos Sanchez added a comment -

            so have you configured a parent pod template in Jenkins settings for all your pods that includes a jnlp container?

            Show
            csanchez Carlos Sanchez added a comment - so have you configured a parent pod template in Jenkins settings for all your pods that includes a jnlp container?
            Hide
            sushantp Sushant Pradhan added a comment - - edited

            I had the attached template with a name/label: alpine_small (different that the one used in my pipeline)

             

            I removed this template. Now I have no pod template in gui and still not able to make it work.

             

            My humble request: can you please share me configuration (both UI and pipeline) on how to make a custom jnlp (eg cloudbees/jnlp-slave-with-java-build-tools ) work with this plugin? 

            Adding the reference/example will go long way. 

             

            Global K8s pod template:

            None
            

            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: cloudbees/jnlp-slave-with-java-build-tools
                args: ['\$(JENKINS_SECRET)', '\$(JENKINS_NAME)']
            """
            ) {
                node (label) {
                  container('jnlp') {
                    sh "hostname"
                    sh "mvn --version"
                  }
                }
            }
            

            Error:

             

            [Pipeline] node
            Agent mypod-6b0f095c-4deb-4b1d-b318-cfa240f1aec6-grqzn-4xlpt is provisioned from template Kubernetes Pod Template
            Agent specification [Kubernetes Pod Template] (mypod-6b0f095c-4deb-4b1d-b318-cfa240f1aec6): 
            * [jnlp] jenkins/jnlp-slave:alpine
            yaml:
            
            apiVersion: v1
            kind: Pod
            metadata:
              labels:
                some-label: some-label-value
            spec:
              containers:
              - name: jnlp
                image: cloudbees/jnlp-slave-with-java-build-tools
                args: ['$(JENKINS_SECRET)', '$(JENKINS_NAME)']
            
            
            Running on mypod-6b0f095c-4deb-4b1d-b318-cfa240f1aec6-grqzn-4xlpt in /home/jenkins/workspace/XXX/builds/test-slave-inline
            [Pipeline] {
            [Pipeline] container
            [Pipeline] {
            [Pipeline] sh
            + hostname
            mypod-6b0f095c-4deb-4b1d-b318-cfa240f1aec6-grqzn-4xlpt
            [Pipeline] sh
            + mvn --version
            /home/jenkins/workspace/XXX/builds/test-slave-inline@tmp/durable-7653f8c5/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
            

             

            Show
            sushantp Sushant Pradhan added a comment - - edited I had the attached template with a name/label: alpine_small (different that the one used in my pipeline)   I removed this template. Now I have no pod template in gui and still not able to make it work.   My humble request: can you please share me configuration (both UI and pipeline) on how to make a custom jnlp (eg cloudbees/jnlp-slave-with-java-build-tools ) work with this plugin?  Adding the reference/example will go long way.    Global K8s pod template: None 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: cloudbees/jnlp-slave-with-java-build-tools args: [ '\$(JENKINS_SECRET)' , '\$(JENKINS_NAME)' ] """ ) { node (label) { container( 'jnlp' ) { sh "hostname" sh "mvn --version" } } } Error:   [Pipeline] node Agent mypod-6b0f095c-4deb-4b1d-b318-cfa240f1aec6-grqzn-4xlpt is provisioned from template Kubernetes Pod Template Agent specification [Kubernetes Pod Template] (mypod-6b0f095c-4deb-4b1d-b318-cfa240f1aec6): * [jnlp] jenkins/jnlp-slave:alpine yaml: apiVersion: v1 kind: Pod metadata: labels: some-label: some-label-value spec: containers: - name: jnlp image: cloudbees/jnlp-slave-with-java-build-tools args: [ '$(JENKINS_SECRET)' , '$(JENKINS_NAME)' ] Running on mypod-6b0f095c-4deb-4b1d-b318-cfa240f1aec6-grqzn-4xlpt in /home/jenkins/workspace/XXX/builds/test-slave-inline [Pipeline] { [Pipeline] container [Pipeline] { [Pipeline] sh + hostname mypod-6b0f095c-4deb-4b1d-b318-cfa240f1aec6-grqzn-4xlpt [Pipeline] sh + mvn --version /home/jenkins/workspace/XXX/builds/test-slave-inline@tmp/durable-7653f8c5/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  
            Hide
            csanchez Carlos Sanchez added a comment -

            Your example works fine.
            Do you have something in setting "Defaults Provider Template Name"

            Show
            csanchez Carlos Sanchez added a comment - Your example works fine. Do you have something in setting "Defaults Provider Template Name"
            Hide
            sushantp Sushant Pradhan added a comment -

            Hi Carlos, If you mean Kubernetes cloud configuration under Manage Jenkins > Configure System. I have global configuration specified:

            Show
            sushantp Sushant Pradhan added a comment - Hi Carlos, If you mean Kubernetes cloud configuration under Manage Jenkins > Configure System. I have global configuration specified:
            Hide
            martinm82 Martin M added a comment - - edited

            I am having the same problem as Carlos. 

            Agent k8s-docker-pod-rn3k8 is provisioned from template Kubernetes Pod Template
            Agent specification [Kubernetes Pod Template] (docker): 
            * [jnlp] jenkins/jnlp-slave:alpine
            yaml:
            ---
            apiVersion: "v1"
            kind: "Pod"
            metadata:
              annotations: {}
              labels:
                jenkins/docker: "true"
            spec:
              containers:
              - name: jnlp
                args: ['\$(JENKINS_SECRET)', '\$(JENKINS_NAME)']
                image: "jenkins/jnlp-agent-docker:latest"
                imagePullPolicy: "Always"
                securityContext:
                  privileged: true
                  runAsGroup: 0
                tty: true
                volumeMounts:
                - mountPath: "/var/run/docker.sock"
                  name: "docker-sock"
                  readOnly: false
              restartPolicy: "Never"
              volumes:
              - hostPath:
                  path: "/var/run/docker.sock"
                name: "docker-sock"
            
            Building remotely on k8s-docker-pod-rn3k8 (docker) in workspace /home/jenkins/workspace/Playground/test
            + ls -lrt /var/run/
            total 4
            srw-rw----    1 root     117              0 Apr 15 11:18 docker.sock
            drwxr-xr-x    3 root     root          4096 Apr 24 09:53 secrets
            + ls -lrt /usr/local/bin/
            total 8
            -rwxr-xr-x    1 root     root            87 Feb  5 20:39 docker-java-home
            -rwxr-xr-x    1 root     root          3741 Mar 11 14:17 jenkins-slave
            

            As you can see the /usr/local/bin folder does not contain the expected docker binary.

            I think the problem occurs at the moment you provide a raw pod template. Unfortunately I cannot use the fields since I need to set specific options in the security context.

            Show
            martinm82 Martin M added a comment - - edited I am having the same problem as Carlos.  Agent k8s-docker-pod-rn3k8 is provisioned from template Kubernetes Pod Template Agent specification [Kubernetes Pod Template] (docker): * [jnlp] jenkins/jnlp-slave:alpine yaml: --- apiVersion: "v1" kind: "Pod" metadata: annotations: {} labels: jenkins/docker: " true " spec: containers: - name: jnlp args: [ '\$(JENKINS_SECRET)' , '\$(JENKINS_NAME)' ] image: "jenkins/jnlp-agent-docker:latest" imagePullPolicy: "Always" securityContext: privileged: true runAsGroup: 0 tty: true volumeMounts: - mountPath: "/ var /run/docker.sock" name: "docker-sock" readOnly: false restartPolicy: "Never" volumes: - hostPath: path: "/ var /run/docker.sock" name: "docker-sock" Building remotely on k8s-docker-pod-rn3k8 (docker) in workspace /home/jenkins/workspace/Playground/test + ls -lrt / var /run/ total 4 srw-rw---- 1 root 117 0 Apr 15 11:18 docker.sock drwxr-xr-x 3 root root 4096 Apr 24 09:53 secrets + ls -lrt /usr/local/bin/ total 8 -rwxr-xr-x 1 root root 87 Feb 5 20:39 docker-java-home -rwxr-xr-x 1 root root 3741 Mar 11 14:17 jenkins-slave As you can see the /usr/local/bin folder does not contain the expected docker binary. I think the problem occurs at the moment you provide a raw pod template. Unfortunately I cannot use the fields since I need to set specific options in the security context.
            Hide
            martinm82 Martin M added a comment -

            Ok, I got it working now. This seems to be a bug actually.

            So what I did now is I filled out only the "Container template" field "Docker Image" and "Name"

            and added additionally the raw pod template

            So the key here is to define the name and image in the fields.

            Show
            martinm82 Martin M added a comment - Ok, I got it working now. This seems to be a bug actually. So what I did now is I filled out only the "Container template" field "Docker Image" and "Name" and added additionally the raw pod template So the key here is to define the name and image in the fields.
            Hide
            jglick Jesse Glick added a comment -

            Working for me in the automated test attached. Perhaps reporter/commenters were using an older version of the plugin that lacked some fixes reported elsewhere?

            Show
            jglick Jesse Glick added a comment - Working for me in the automated test attached. Perhaps reporter/commenters were using an older version of the plugin that lacked some fixes reported elsewhere?
            Hide
            psy_kiran Sai Kiran added a comment -

            Sushant Pradhan Did you found any solution?

            Show
            psy_kiran Sai Kiran added a comment - Sushant Pradhan Did you found any solution?

              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: