[
https://issues.apache.org/jira/browse/MBUILDCACHE-67?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17750888#comment-17750888
]
ASF GitHub Bot commented on MBUILDCACHE-67:
-------------------------------------------
kbuntrock opened a new pull request, #92:
URL: https://github.com/apache/maven-build-cache-extension/pull/92
### Description of this pull request
https://issues.apache.org/jira/projects/MBUILDCACHE/issues/MBUILDCACHE-67
- Fix artefact restoration error was not executing the regular project build
as expected
- Fix non-lazy artefact restoration was in fact partially lazy
- Added an IT test on this
Draft until PR-MBUILDCACHE-64 is merged since I want to factorize a function
in the IT test (see the related todo).
### MR checklist
Following this checklist to help us incorporate your
contribution quickly and easily:
- [x] Make sure there is a [MBUILDCACHE JIRA
issue](https://issues.apache.org/jira/browse/MBUILDCACHE) filed
for the change (usually before you start working on it). Trivial
changes like typos do not
require a JIRA issue. Your pull request should address just this
issue, without
pulling in other changes.
- [x] Each commit in the pull request should have a meaningful subject line
and body.
- [x] Format the pull request title like `[MBUILDCACHE-XXX] - Fixes bug in
ApproximateQuantiles`,
where you replace `MBUILDCACHE-XXX` with the appropriate JIRA issue.
Best practice
is to use the JIRA issue title in the pull request title and in the
first line of the
commit message.
- [x] Write a pull request description that is detailed enough to
understand what the pull request does, how, and why.
- [x] Run `mvn clean verify` to make sure basic checks pass. A more
thorough check will
be performed on your pull request automatically.
- [x] You have run the [Core IT][core-its] successfully.
If your pull request is about ~20 lines of code you don't need to sign an
[Individual Contributor License
Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the [Apache License Version 2.0, January
2004](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.
- [x] I hereby declare this contribution to be licenced under the [Apache
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
- [x] In any other case, please file an [Apache Individual Contributor
License Agreement](https://www.apache.org/licenses/icla.pdf).
[core-its]: https://maven.apache.org/core-its/core-it-suite/
> Any error in restoring from the cache should resume the non cache build
> -----------------------------------------------------------------------
>
> Key: MBUILDCACHE-67
> URL: https://issues.apache.org/jira/browse/MBUILDCACHE-67
> Project: Maven Build Cache Extension
> Issue Type: Bug
> Affects Versions: 1.0.1
> Reporter: Kevin Buntrock
> Priority: Major
>
> If any error arise during the restoration of artefacts from the cache, the
> build should continue as it would usually do without the cache. In fact, it's
> even what the extension says "Cannot restore cache, continuing with normal
> build."
> But it's a lie, the build goes straight to the phase where it saves the
> generated artefact in cache. ;)
> {code:java}
> [DEBUG] Hash calculated, item: dependency, hash: 14eab0591a006938
> [INFO] Project inputs calculated in 97 ms. XX checksum [a0d7876d9bceb494]
> calculated in 50 ms.
> [INFO] Attempting to restore project
> io.github.kbuntrock.sample:openapi-plugin-sample-backend from build cache
> [DEBUG] Checking local build info:
> C:\Users\kbuntrock\.m2\build-cache\v1\io.github.kbuntrock.sample\openapi-plugin-sample-backend\a0d7876d9bceb494\local\buildinfo.xml
> [INFO] Local build found by checksum a0d7876d9bceb494
> [INFO] Found cached build, restoring
> io.github.kbuntrock.sample:openapi-plugin-sample-backend from cache by
> checksum a0d7876d9bceb494
> [DEBUG] Cached build details:
> Build{dto=org.apache.maven.buildcache.xml.build.Build@63cf9de0}
> [DEBUG] Cannot restore cache, continuing with normal build.
> java.lang.RuntimeException: Made-up error : restoring artefact is impossible.
> at
> org.apache.maven.buildcache.CacheControllerImpl.restoreProjectArtifacts
> (CacheControllerImpl.java:312)
> at
> org.apache.maven.buildcache.BuildCacheMojosExecutionStrategy.restoreProject
> (BuildCacheMojosExecutionStrategy.java:171)
> at org.apache.maven.buildcache.BuildCacheMojosExecutionStrategy.execute
> (BuildCacheMojosExecutionStrategy.java:124)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:159)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> (LifecycleModuleBuilder.java:105)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> (LifecycleModuleBuilder.java:73)
> at
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
> (SingleThreadedBuilder.java:53)
> at org.apache.maven.lifecycle.internal.LifecycleStarter.execute
> (LifecycleStarter.java:118)
> at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
> at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
> at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
> at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
> at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
> at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
> at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
> at jdk.internal.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:77)
> at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke (Method.java:568)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced
> (Launcher.java:283)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launch
> (Launcher.java:226)
> at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode
> (Launcher.java:407)
> at org.codehaus.plexus.classworlds.launcher.Launcher.main
> (Launcher.java:348)
> [INFO] Cannot restore project artifacts, continuing with non cached build
> [INFO] Saved Build to local file:
> C:\Users\kbuntrock\.m2\build-cache\v1\io.github.kbuntrock.sample\openapi-plugin-sample-backend\a0d7876d9bceb494\local\buildinfo.xml
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 0.629 s
> [INFO] Finished at: 2023-08-02T23:21:36+02:00
> [INFO]
> ------------------------------------------------------------------------
> [DEBUG] Save cache-report to local file:
> C:\Users\kbuntrock\Developpement\sample\target\maven-incremental\cache-report.662d75e1-1a0e-407a-85aa-21da4d207498.xml
> {code}
> While trying to reproduce the error with a more convenient use case, it seems
> that erasing the artefact from the repository (local in my case) does not
> throw any restoration error (the build is set by default to "lazyRestore =
> false").
> Here is a screenshot of a normal execution where the artefact is correctly
> loaded :
> {code:java}
> [INFO] Found cached build, restoring
> io.github.kbuntrock.sample:openapi-plugin-sample-backend from cache by
> checksum a0d7876d9bceb494
> [DEBUG] Cached build details:
> Build{dto=org.apache.maven.buildcache.xml.build.Build@5befbac1}
> [DEBUG] Downloading artifact openapi-plugin-sample-backend
> [DEBUG] Downloaded artifact openapi-plugin-sample-backend to:
> C:\Users\kbuntrock\.m2\build-cache\v1\io.github.kbuntrock.sample\openapi-plugin-sample-backend\a0d7876d9bceb494\local\openapi-plugin-sample-backend.jar
> [INFO] Skipping plugin execution (cached): resources:resources
> [INFO] Skipping plugin execution (cached): compiler:compile {code}
> And the log of an execution where the file is missing on the filesystem. We
> can see a missing line but no further effect on the cached build.
> {code:java}
> [INFO] Found cached build, restoring
> io.github.kbuntrock.sample:openapi-plugin-sample-backend from cache by
> checksum a0d7876d9bceb494
> [DEBUG] Cached build details:
> Build{dto=org.apache.maven.buildcache.xml.build.Build@5befbac1}
> [DEBUG] Downloading artifact openapi-plugin-sample-backend
> [INFO] Skipping plugin execution (cached): resources:resources
> [INFO] Skipping plugin execution (cached): compiler:compile{code}
> If the artefact is used in a dependant module build, the expected error arise
> : " Error retrieving artifact file: Missing file for cached build, cannot
> restore.". But since we are not in lazy restore, we exept it earlier.
>
> I would suggest to correct / test the two bugs in the MR since it will be far
> easier to do so (it is why I created only one issue).
>
> NB : The bugfix MR will follow.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)