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

Build hangs using inheritFrom without a label

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • kubernetes-ci-plugin
    • None
    • Jenkins ver. 2.150.1
      Kubernetes Plugin: 1.13.2

      Problem Statement

      The build hangs when using inheritFrom in a declarative pipeline (have not tested in a script pipeline) and you either

      • set an identical label to the one defined in the Pod Template
      • omit the label tag meaning the inherited label is used (i.e. also identical)

      The problem is, however, that there is no information that something is wrong. The build just hangs.

      To Reproduce

      Use the following (uncomment label to make it work):

      pipeline {
          agent {
              kubernetes {
                  inheritFrom 'nodejs'
                  // THIS WOULD FAIL --> label 'jenkins-nodejs'
                  // THIS WOULD BE OK --> label 'my-agent'
                  containerTemplate {
                      name 'nodejs'
                      image 'jenkinsxio/builder-nodejs8x:0.1.187'
                  }
                  defaultContainer 'nodejs'
              }
          }
          stages {
              stage('Npm Check') {
                  steps {
                      sh 'npm -v'
                  }
              }
          }
          post {
              always {
                  cleanWs()
              }
          }
      }
      

      From the Jenkins log:

      Jan 16, 2019 5:01:51 PM org.jenkinsci.plugins.jx.resources.BuildSyncRunListener upsertBuild
      INFO: Updated  pipeline activity .....
      Jan 16, 2019 5:01:53 PM com.elasticbox.jenkins.k8s.services.task.ScheduledPoolingTask execute
      INFO: Pooling task: WaitForThePodToBeRunningTask finished successfully
      Jan 16, 2019 5:01:53 PM com.elasticbox.jenkins.k8s.services.slavesprovisioning.chain.steps.WaitForPodToBeRunning handle
      INFO: Pod is up and running
      Jan 16, 2019 5:01:59 PM com.elasticbox.jenkins.k8s.plugin.clouds.KubernetesCloud canProvision
      INFO: Checking label: jenkins-jx-base
      ...
      ...
      ...
      Jan 16, 2019 5:02:00 PM com.elasticbox.jenkins.k8s.plugin.clouds.KubernetesCloud canProvision
      INFO: Checking label: jenkins-swift
      Jan 16, 2019 5:02:00 PM com.squareup.okhttp.internal.Platform$JdkWithJettyBootPlatform getSelectedProtocol
      INFO: ALPN callback dropped: SPDY and HTTP/2 are disabled. Is alpn-boot on the boot class path?
      Jan 16, 2019 5:02:53 PM com.elasticbox.jenkins.k8s.services.task.ScheduledPoolingTask execute
      SEVERE: Timeout reached(60 secs) executing task: WaitForTheSlaveToBeOnlineTask
      Jan 16, 2019 5:02:53 PM com.elasticbox.jenkins.k8s.services.slavesprovisioning.chain.steps.WaitForSlaveToBeOnline handle
      SEVERE: Error waiting for the Jenkins slave to be online
      Jan 16, 2019 5:02:53 PM com.elasticbox.jenkins.k8s.services.SlaveProvisioningServiceImpl slaveProvision
      SEVERE: Error provisioning Pod Jenkins slave
      Jan 16, 2019 5:02:57 PM hudson.slaves.NodeProvisioner$2 run
      WARNING: Unexpected exception encountered while provisioning agent Jenkins Kubernetes Slave
      com.elasticbox.jenkins.k8s.services.error.ServiceException: Error waiting for the Jenkins slave to be online
      	at com.elasticbox.jenkins.k8s.services.slavesprovisioning.chain.steps.WaitForSlaveToBeOnline.handle(WaitForSlaveToBeOnline.java:64)
      	at com.elasticbox.jenkins.k8s.services.SlaveProvisioningServiceImpl.slaveProvision(SlaveProvisioningServiceImpl.java:55)
      	at com.elasticbox.jenkins.k8s.plugin.clouds.KubernetesCloud$1.call(KubernetesCloud.java:172)
      	at com.elasticbox.jenkins.k8s.plugin.clouds.KubernetesCloud$1.call(KubernetesCloud.java:169)
      	at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
      	at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: com.elasticbox.jenkins.k8s.services.task.TaskException: Timeout reached(60 secs) executing task: WaitForTheSlaveToBeOnlineTask
      	at com.elasticbox.jenkins.k8s.services.task.ScheduledPoolingTask.execute(ScheduledPoolingTask.java:86)
      	at com.elasticbox.jenkins.k8s.services.slavesprovisioning.chain.steps.WaitForSlaveToBeOnline.handle(WaitForSlaveToBeOnline.java:58)
      	... 9 more
      

            gsanchezu Guillermo Sanchez Urien
            lostinberlin Steve Boardwell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: