'jenkinsfile doesn't retrieve downstream build ID on ABORT or FAILURE

I am writing a groovy code in a Jenkinsfile, In a stage, I am building another pipeline this way,

stage("1"){
  steps{
    script{
      def u1Results = build job: 'ChildPipeline1', parameters: [string(name : 'PARAM', value: "1")] 
      print u1Results.number 
      }
     }
    }

u1Results.number works when ChildPipeline1 succeeds, but no clue to get the ChildPipeline1 build ID if it was aborted or failed normally, Even if I added a post-class to the stage

I'd like to know the build-id of ChildPipeline1 anyway.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source