CopyPastor

Detecting plagiarism made easy.

Score: 0.8204056620597839; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2023-08-30
by ycr

Original Post

Original - Posted on 2020-10-08
by Alexander Dultsev



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Once you are out of a stage you can't change the stage status AFAIK. The better option is to refactor your Pipeline to something like below. Basically, run your stages in parallel.
```groovy pipeline { agent any stages { stage('Parallel Example') { parallel { stage('1') { steps { build_job_result = build job: "jobName", wait: true if (build_job_result == failed) { error "Build Failed" } } } stage('2') { steps { echo 'Do something else while the job runs' } } } } } } ```
I did it like this (to keep the catchError):
def boolean test_results = false pipeline { ... stage( 'x' ) { steps{ catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { <Do some dangerous stuff here> // // If we reached here the above step hasn't failed // script { test_results = true } } } } stage( 'y' ) { steps{ script{ if( test_results == true ) { } else { } } } } }

        
Present in both answers; Present only in the new answer; Present only in the old answer;