Repository navigation
Conversation
Yes, but you didn't introduce new classes in - let's say - The thing is don't get here is the one you explained above:
Why? If snapshots have been |
|
From my understanding, it should be possible to manage 2 different caches:
That's what I was trying to achieve previously. If we remove the cache from the JDK setup step, I'm afraid we'll have to fetch all the project dependencies on each and every run, and this will take longer than reinstalling with tests skipped. Don't you think? |
… scenario Per maintainer feedback on microcks#2117: my earlier removal of cache: maven was unproven (fork CI never added a new class) and sacrificed the ~400 MB Maven Central global cache. Restore cache: maven on every actions/setup-java in build-verify.yml and build-container.yml. Keep the per-job workaround removed. Add a synthetic CacheRepoProbe class in commons/util referenced from MicrocksApplication so downstream jobs can only compile if the new build-install SNAPSHOT actually made it through the cache. Expected outcomes on CI: - Green: the workaround was redundant; dual-cache works as intended; drop the probe + open the cleaner PR. - Red: dual-cache really does conflict; revert this commit's cache: maven and the previous PR shape (drop cache: maven) becomes the necessary fix. This commit is temporary and will be amended out before merge. Signed-off-by: Git-HimanshuRathi <[email protected]>
…-install
Root cause: in build-install, the actions/cache step was the LAST
step in the job — positioned AFTER `mvn -B clean install`. Because
actions/cache RESTORES at the position it is encountered (and only
SAVES at job end), the restore ran AFTER the build. The primary key
maven-repo-${run_id} did not yet exist for the current run, so
restore-keys fell back to a PRIOR run's maven-repo-* cache and
extracted stale SNAPSHOTs ON TOP of the freshly installed ones. The
job-end save then captured the stale state under the current run_id.
Downstream jobs (package-webapp, integration-tests, fuzzing-tests,
javadoc-check) restored that stale cache and could not find newly
added classes — exactly the symptom from May's log:
"Cache restored from key: maven-repo-147564147" ← prior run id
The per-job `mvn -B -DskipTests install` workaround landed in
cbf5d85/63e70f5/dce1290 was masking the bug by forcing a rebuild.
Fix: move the Cache Maven dependencies step BEFORE the
`mvn -B clean install` step in build-install (matching the order
every downstream job already used). The restore now uses any
prior cache as a starting point; mvn install then installs fresh
SNAPSHOTs which overwrite the stale ones; the job-end save captures
the fresh state under the current run_id. Drop the per-job
reinstall workaround from package-webapp, integration-tests,
fuzzing-tests, and javadoc-check.
cache: maven on actions/setup-java is intentionally kept — it
provides a separate global cache (keyed on pom.xml hashes) that
survives across CI runs and is independent of the per-run
actions/cache, so Maven Central downloads do not need to repeat
on every run. It is not the source of the dual-cache conflict.
Validated empirically on Git-HimanshuRathi/microcks by adding a
new class in commons/util referenced from webapp:
- Without this fix: package-webapp / javadoc-check fail with
"cannot find symbol" on the new class (bug reproduced).
- With this fix: all 5 build-verify jobs green.
Signed-off-by: Git-HimanshuRathi <[email protected]>
a3e2a1e to
8d04bbf
Compare
|
@lbroudoux You were right original diagnosis was wrong. Pushed an experimental probe class in
Real root cause: in The workaround was forcing a fresh Fix: move the cache step before the build in |
|
@lbroudoux anything wrong with this PR ? |
Nothing wrong, but not time to review this in details for this week. Thanks for your patience! |
lbroudoux
left a comment
There was a problem hiding this comment.
I am wondering if we couldn't also remove the install done in build-containers? Can you check this?
Summary
Closes #1594.
cache: mavenfrom everyactions/setup-javainvocation inbuild-verify.ymlandbuild-container.yml. The explicitactions/cache@v5block (keyed ongithub.run_id) becomes the single source of truth for~/.m2/repository.mvn -B -DskipTests installworkaround frompackage-webapp,integration-tests,fuzzing-tests, andjavadoc-check. It was masking the symptom; with the dual cache gone, the cached SNAPSHOTs frombuild-installnow restore cleanly.Why
Two caches were active for
~/.m2/repository:actions/setup-javawithcache: maven(keyed on**/pom.xmlhashes)actions/cache@v5block (keyed ongithub.run_id)setup-javaruns first and restores its pom-hash-keyed cache — likely a stale repo from an earlier unrelated run since pom hashes rarely change. The explicitactions/cachestep then layers on top, but the resulting state can miss the SNAPSHOT artifactsbuild-installjust installed. That's why downstream jobs needed the workaround.GitHub's own setup-java caveat calls this anti-pattern out: when you manage
~/.m2/repositorywith an explicitactions/cache, don't also setcache: mavenon setup-java.Scope
build-verify.yml: 5×cache: mavenremoved, 4× workaroundmvn installremoved.build-container.yml: 1×cache: mavenremoved. Itsmvn -Pprod -DskipTests installstep is the actual job (producing the prod jar with the Angular UI for the container image), not a workaround — left untouched.package-native.yml: unchanged. It usescache: mavenwithout an explicitactions/cacheblock, so it isn't exhibiting the dual-cache conflict.Test plan
build-install,package-webapp,integration-tests,fuzzing-tests,javadoc-check) green without the workaround.