I am trying to fetch Jenkins job result using the following code:
pipeline {
agent { label 'Agent_Name' }
stages {
stage('Build') {
steps {
def res=build job: 'App_Build', parameters: [string(name: 'App', value: 'WindowsApp')]
}
}
}
}
However, it looks like if I add "def res=" then the job fails with the following error:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
If I remove def res=, then it works fine. Also, if I keep only def res=buid..... line in pipeline script, then it works fine too.
How can I fix this error? I need to get the result from the App_Build job and run the pipeline in stages.