New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Post-action fails when running multiple builds in the same step with configuration-cache enabled #441
Comments
Thanks for the report. The error is happening when attempting to read the build result files, that capture various details about each Gradle invocation. These will be located in
You can use the core upload-artifact action to save this directory. Something like:
That should help work out why the action is failing to parse these files in the post-action step. |
Thanks for coming back so quickly, yes this is a repeated failure. I've attached the build results folder at the bottom, its worth noting that the RUNNER_TEMP variable doesn't seem to exist. I actually found the address of the folder by connecting via ssh to the machine the grepping the filesystem. Turns out its the following on my ubuntu runner:
|
Thanks for that. I can see that the build results data is duplicated in some of the JSON files eg:
Looking at the code I can see how this could happen if 2 builds share the same "invocation ID", and I'll add a guard to prevent this from happening. However, I'm surprised that you have 2 builds starting at the exact same |
OK so I've managed to reproduce this failure. It occurs when:
The problem is that we use the Step ID + build timestamp to uniquely identify a build. But the configuration-cache results in the same timestamp being used for the 2 subsequent builds in the same step. We then write both build results to the same file, resulting in invalid JSON when we subsequently load those results. A temporary workaround is to enable build scan publishing for these builds. That works because this results in the existing results file being overwritten instead of appended. |
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
That would make sense as I'm using the gradle profiler to benchmark, so I'm running the build n many times in order to get an average. I'll have a look into whether I can enable scans in the profiler, though normally I wouldn't do this as actually doing 5 warm up builds and 15 measured builds which is quite a few build scans 😅 |
I've just released |
@bigdaz not only does it work, but it took my benchmarking workflow from 15 minutes down to 5 minutes. So big thank you for this 😄 |
I'm attempting to configure this action in conjunction with using the gradle profiler
I'm running the workflow on the standard github ubuntu-latest runner
My config is the following:
But I'm getting the following failure in the Post Setup Gradle step:
Post job cleanup. In final post-action step, saving state and writing summary Warning: Unhandled error in Gradle post-action - job will continue: SyntaxError: Unexpected token { in JSON at position 310 SyntaxError: Unexpected token { in JSON at position 310 at JSON.parse (<anonymous>) at /home/runner/work/_actions/gradle/gradle-build-action/v[2](https://github.com/CharlieTap/motdujour/actions/runs/3119036265/jobs/5058738131#step:12:2)/dist/post/index.js:64660:21 at Array.map (<anonymous>) at loadBuildResults (/home/runner/work/_actions/gradle/gradle-build-action/v2/dist/post/index.js:64657:44) at Object.<anonymous> (/home/runner/work/_actions/gradle/gradle-build-action/v2/dist/post/index.js:66201:67) at Generator.next (<anonymous>) at /home/runner/work/_actions/gradle/gradle-build-action/v2/dist/post/index.js:6615[3](https://github.com/CharlieTap/motdujour/actions/runs/3119036265/jobs/5058738131#step:12:3):71 at new Promise (<anonymous>) at __webpack_modules__.8652.__awaiter (/home/runner/work/_actions/gradle/gradle-build-action/v2/dist/post/index.js:661[4](https://github.com/CharlieTap/motdujour/actions/runs/3119036265/jobs/5058738131#step:12:4)9:12) at Object.complete (/home/runner/work/_actions/gradle/gradle-build-action/v2/dist/post/index.js:6619[5](https://github.com/CharlieTap/motdujour/actions/runs/3119036265/jobs/5058738131#step:12:5):[12](https://github.com/CharlieTap/motdujour/actions/runs/3119036265/jobs/5058738131#step:12:12))
The text was updated successfully, but these errors were encountered: