We have a pipeline that includes a long-running build. At the beginning of the build, the build tool checks multiple Git remote repositories for changes.
To invalidate the cache during runs and re-run the check against remotes, we added a cache buster as described here. We also need the pipeline to export artifacts back to the client before exiting with the exit code returned by the build as described here:
dagger shell <<'EOM'
result=$(build-latest)
$result | artifacts | export "build"
.exit $($result | exit-code)
EOM
The issue I'm having now is that the build is executed twice, which seems logical given that we added a cache buster.
Is there a pattern or solution for stopping the cache buster to break at a certain point in the DAG? For example, once I have the build result—which is just a struct holding the artifacts directory and the exit-code integer—can I prevent the complete pipeline from being executed again once Sync is called? Are there recommendations besides the current time to use as cache buster variable (e.g some session id) so that we only invalide the cache once per session?