jenkinsci / ontrack-plugin

ontrack plug-in for Jenkins
https://plugins.jenkins.io/ontrack/
MIT License
9 stars 6 forks source link

Validation step in a parallel stage in a scripted build returns a wrong result #47

Closed dcoraboeuf closed 6 years ago

dcoraboeuf commented 6 years ago

Given such a pipeline:

node ("docker") {
    stage("Build") {
        sleep time: 1, unit: 'SECONDS'
        ontrackBuild project: 'test', branch: 'master', build: "$BUILD_NUMBER"
    }
    stage("Tests") {
        parallel([
            "Test 1": {
                stage("Test 1") {
                    node("docker") {
                        try {
                            sleep time: 5, unit: 'SECONDS'
                            sh 'exit 1'
                        } finally {
                            ontrackValidate project: 'test', branch: 'master', build: "$BUILD_NUMBER", validationStamp: 'VS1', buildResult: currentBuild.currentResult
                        }
                    }
                }
            },
            "Test 2": {
                stage("Test 2") {
                    node("docker") {
                        sleep time: 15, unit: 'SECONDS'
                        ontrackValidate project: 'test', branch: 'master', build: "$BUILD_NUMBER", validationStamp: 'VS2', buildResult: currentBuild.currentResult
                    }
                }
            }
        ])
    }
}

The "VS1" validation stamp for stage "Test 1" will report "Passed" when "Failed" is expected.

The current build result cannot be used, only the current stage's status can be used.

dcoraboeuf commented 6 years ago

Correction of status is now OK:

image

However, the refactoring of the stage detection has lost us the duration.

dcoraboeuf commented 6 years ago

Fixed in 2.33.3