Pipeline: Using timestamps() breaks getLogMatcher()

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      The following code works without timestamps() and fails with. getLogMatcher() apparently

      fails to get the real log with timestamps() active.

       

      @NonCPS
      def setBuildName(manager, currentBuild) {
              def m = manager.getLogMatcher('stage (.*)')
              if (m?.matches()) {
                      currentBuild.displayName = m.group(1)
              } else {
                      currentBuild.displayName = 'NO MATCH'
              }
      }
      
      pipeline {
              agent {
                      label "master"
              }
              options {
                      // Just here for easy comment/uncomment of timestamp()    
                      buildDiscarder(logRotator(numToKeepStr: '5'))
                      // timestamps()
              }
      
              stages {
                      stage('checkout') {
                              steps {
                                      sh "echo 'stage checkout"
                              }
                      }
                      
                      stage("preparation") {
                              steps {
                                      sh "echo 'stage preparation'"
                              }
                      }
      
                      stage("install") {
                              steps {
                                      script {
                                              setBuildName(manager, currentBuild)
                                      }
                              }
                      }
              }
      }
      

       

            Assignee:
            Unassigned
            Reporter:
            Michael jansen
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: