This is an automated email from the ASF dual-hosted git repository. ppkarwasz pushed a commit to branch fix/purge-snapshot-cache in repository https://gitbox.apache.org/repos/asf/logging-parent.git
commit f7d792a7db97233c4bd03e5c68152ecabfe38692 Author: Piotr P. Karwasz <[email protected]> AuthorDate: Sun Jul 26 09:27:27 2026 +0200 Purge snapshots from the Maven cache in reproducibility checks The local Maven repository restored from the GitHub Actions cache contains the reference artifacts resolved by `artifact:compare` in previous runs. Since snapshots are not updated on every resolution, these stale copies shadow the reference repository and make the comparison meaningless. Purge all `*-SNAPSHOT` directories from the local repository before the build, warning about each file found, and purge them again after the build so they are not saved to the cache. Assisted-By: Claude Fable 5 <[email protected]> --- .../workflows/verify-reproducibility-reusable.yaml | 30 ++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/verify-reproducibility-reusable.yaml b/.github/workflows/verify-reproducibility-reusable.yaml index 63f0298..8700502 100644 --- a/.github/workflows/verify-reproducibility-reusable.yaml +++ b/.github/workflows/verify-reproducibility-reusable.yaml @@ -112,13 +112,13 @@ jobs: NEXUS_URL: ${{ inputs.nexus-url }} REFERENCE_ARTIFACT_NAME: ${{ inputs.reference-artifact-name }} run: | - REFERENCE_REPO="" - if [ -n "$NEXUS_URL" ] && [ -n "$REFERENCE_ARTIFACT_NAME" ]; then echo '::error::Provide exactly one of `nexus-url` or `reference-artifact-name`, not both.' exit 1 fi + echo '::group::Determine reference repository' + REFERENCE_REPO="" # Computes the URI of the local repository, if `reference-artifact-name` was given. if [ -n "$REFERENCE_ARTIFACT_NAME" ]; then TEMP_DIR="$RUNNER_TEMP" @@ -134,12 +134,38 @@ jobs: echo '::error::Either `nexus-url` or `reference-artifact-name` must be provided.' exit 1 fi + echo "Using reference repository: $REFERENCE_REPO" + echo '::endgroup::' + + echo '::group::Purge snapshots from the local Maven repository' + # Snapshot artifacts restored from the GitHub Actions cache shadow the reference repository during resolution, + # so their presence means the cache was polluted by a previous run. + if [ -d ~/.m2/repository ]; then + find ~/.m2/repository -type d -name '*-SNAPSHOT' -prune | while IFS= read -r dir; do + find "$dir" -type f | while IFS= read -r file; do + echo "::warning::Purging stale snapshot file: $file" + done + rm -rf "$dir" + done + fi + echo '::endgroup::' + ./mvnw \ --show-version --batch-mode --errors --no-transfer-progress \ -DskipTests=true \ -Dreference.repo="${REFERENCE_REPO}" \ clean verify artifact:compare + # Remove all snapshots from the local Maven repository before it is saved to the GitHub Actions cache, + # so that the reference artifacts resolved by `artifact:compare` do not contaminate the cache. + - name: Purge snapshots from Maven cache + if: always() + shell: bash + run: | + if [ -d ~/.m2/repository ]; then + find ~/.m2/repository -type d -name '*-SNAPSHOT' -prune -exec rm -rf {} + + fi + # Upload reproducibility results if the build fails. - name: Upload reproducibility results if: failure()
