How can I get the status of already completed builds?
The code below starts the build, but I just need to know the build status by name. I need to find out the names of the failed builds in order to send the data in one message to the mail.
Map buildResults = [:]
Boolean failedJobs = false
void nofify_email(Map results) {
    echo "TEST SIMULATE notify: ${results.toString()}"
}
Boolean buildJob(String jobName, Map results) {
    def jobBuild = **build job: jobName**, propagate: false
    def jobResult = jobBuild.getResult()
    echo "Build of '${jobName}' returned result: ${jobResult}"
    results[jobName] = jobResult
    return jobResult == 'SUCCESS'
}
pipeline {
    agent any
    stages {
        stage('Parallel Builds') {
            steps {
                parallel(
                        "testJob1": {
                            script {
                                if (!buildJob('testJob1', buildResults)) {
                                    failedJobs = true
                                }
                            }
                        },
                )
            }
        }
I couldn't find anything to replace build job
 
    