Unverified Commit 394498f8 authored by Daz DeBoer's avatar Daz DeBoer
Browse files

Avoid appending to existing build-results file

When configuration-cache is enabled, the invocationId may not be unique, which can result in
mulitple builds writing to the same file. Rather than failing the post-action, we simply
ignore any subsequent build results with the same ID.

Fixes #441
parent c295a409
Loading
Loading
Loading
Loading
+2
Changes for src/resources/init-scripts/build-result-capture-service.plugin.groovy: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -54,6 +54,8 @@ abstract class BuildResultsRecorder implements BuildService<BuildResultsRecorder
        def buildResultsDir = new File(runnerTempDir, ".build-results")
        buildResultsDir.mkdirs()
        def buildResultsFile = new File(buildResultsDir, githubActionStep + getParameters().getInvocationId().get() + ".json")
        if (!buildResultsFile.exists()) {
            buildResultsFile << groovy.json.JsonOutput.toJson(buildResults)
        }
    }
}