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

Timestamps disappear without any reason inside podTemplate

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • kubernetes-plugin
    • None
    • kubernetes-1.22.1

      I found this problem after updating from kubernetes:1.17.2 to kubernetes:1.18.1.

      The timestamp stop appearing for code running inside podTemplate. Not sure if this problem could be related with other plugins, but it is only happening inside podTemplate.

      Code to replicate the behavior:

      timestamps{
          Integer echoNumbers = 3
          node("master") {
              for (i = 0; i <echoNumbers; i++) {
                  sh "echo \"Pre POD hello ${i}\" && sleep 1"
              }
          }
          podTemplate(showRawYaml: false, label: "alpine1", cloud: "Build farm", containers: [
                      containerTemplate(name: 'alpine', image: 'alpine', ttyEnabled: true, command: "cat")]) {
              node ("alpine1") {
                  for (i = 0; i <echoNumbers; i++) {
                    sh "echo \"POD hello ${i}\" && sleep 1"
                  }
              }
          }
          node("master") {
              for (i = 0; i <echoNumbers; i++) {
                  sh "echo \"POST POD hello ${i}\" && sleep 1"
              }
          }
      }

       

      Console log:

      Running in Durability level: MAX_SURVIVABILITY
      [Pipeline] Start of Pipeline
      [Pipeline] timestamps
      [Pipeline] {
      [Pipeline] node
      17:44:27  Running on Jenkins in /var/jenkins_home/jobs/***/workspace
      [Pipeline] {
      [Pipeline] sh
      17:44:27  + echo Pre POD hello 0
      17:44:27  Pre POD hello 0
      17:44:27  + sleep 1
      [Pipeline] sh
      17:44:28  + echo Pre POD hello 1
      17:44:28  Pre POD hello 1
      17:44:28  + sleep 1
      [Pipeline] sh
      17:44:30  + echo Pre POD hello 2
      17:44:30  Pre POD hello 2
      17:44:30  + sleep 1
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] podTemplate
      [Pipeline] {
      [Pipeline] node
      17:44:46  Still waiting to schedule task
      17:44:46  'alpine1-q8mvp-wbn4z' is offline
      17:44:48  Agent alpine1-q8mvp-wbn4z is provisioned from template Kubernetes Pod Template
      17:44:48  Running on alpine1-q8mvp-wbn4z in /home/jenkins/agent/workspace/***
      [Pipeline] {
      [Pipeline] sh
      17:44:49  + echo 'POD hello 0'
      17:44:49  POD hello 0
      17:44:49  + sleep 1
      [Pipeline] sh
      + echo 'POD hello 1'
      POD hello 1
      + sleep 1
      [Pipeline] sh
      + echo 'POD hello 2'
      POD hello 2
      + sleep 1
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] }
      [Pipeline] // podTemplate
      [Pipeline] node
      17:44:53  Running on Jenkins in /var/jenkins_home/jobs/CII_2854_test_timestamp/workspace
      [Pipeline] {
      [Pipeline] sh
      17:44:53  + echo POST POD hello 0
      17:44:53  POST POD hello 0
      17:44:53  + sleep 1
      [Pipeline] sh
      17:44:55  + echo POST POD hello 1
      17:44:55  POST POD hello 1
      17:44:55  + sleep 1
      [Pipeline] sh
      17:44:56  + echo POST POD hello 2
      17:44:56  POST POD hello 2
      17:44:56  + sleep 1
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] }
      [Pipeline] // timestamps
      [Pipeline] End of Pipeline
      Finished: SUCCESS
      
      

       

      In the log, it can be seen that POD hello 1 and POD hello 2 don't have timestamps

       

            vlatombe Vincent Latombe
            sermelo Sergio Merino
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: