-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix build failure related to stale versions in the cache #1449
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,13 +4,13 @@ runs: | |
| using: "composite" | ||
| steps: | ||
|
|
||
| - name: run 'package' on the project | ||
| - name: run 'install' on the project | ||
| shell: bash | ||
| run: | | ||
| ./mvnw install -B \ | ||
| -Dskip.build.image=true \ | ||
| -DskipTests -DskipITs \ | ||
| -T 1C -q | ||
| -T 1C -U -q | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, but this is what we want here, since we already restored the cache at this point. So this just updates potentially libraries that are not part of our maven reactor, which is good. it's like we update
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. I will just point out there is the potential...due to bad timing that we could finish the build locally and install those snapshots but inbetween that time and this command we could publish new snapshots to repo.spring.io and pull down those as well (for k8s). Although the chance of that is quite small and I am not sure there is anything we can really do about it. |
||
|
|
||
| - name: find all classpath entries | ||
| shell: bash | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a fix that affects us in a totally different PR, but I want to have it in
3.0.x, so that you merge it tomainand I take it frommain.-nsumeans no-snapshot-update and it has bitten me in a PR where I renamed classes.To be more precise, there is an integration test that looks like this:
Now, in the branch where I am working,
Fabric8KubernetesDiscoveryClientexists, but inmainit is called:KubernetesDiscoveryClient.What happens is that the version that contains
KubernetesDiscoveryClientis already published in the spring repo as a SNAPSHOT, so without-nsuhere, it will go and download the version that will fail compilation. We needFabric8KubernetesDiscoveryClient, but getKubernetesDiscoveryClient.I hope it makes sense.
P.S. I don't understand why it did not happen until now, because that branch had a lot of successful builds, I assume you only recently started to publish
3.1.0-SNAPSHOT.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you saying its pulling down a snapshot version from the wrong branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, basically I need my own version that I build during the build phase, but without
-nsuit's pulling the version that exists in spring snapshot repos.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well then there is something else that is wrong then because it at the very least it should be pulling the version for the branch being built not a different version.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first I have to apologize: the fact that I did not understand 100% of what happens, rushed me into a PR that would have only partially solve the issue. I spent some time into figuring it out and now I can present my case.
Here it is:
Now suppose such a sequence of events:
libX-3.1.0-SNAPSHOTthat contains a class called:Fabric8KubernetesDiscoveryClientthat in turn is needed bylibY-3.1.0-SNAPSHOT.libX-3.1.0-SNAPSHOT, but it will have such amaven-metadata-local.xmlThis file decides if we should update our snapshots or not. Notice how
lastUpdatedis :20230920045240, or simpler:2023/09/20. So this is when we placed this file in our cache, and every time we restore the cache, this is what maven is going to know about it.Now the problem is that this dependency might be too old, the actual dependency stored in spring snapshot repo might be newer. If it is indeed newer, then we will try to download it and this is happens in our case.
libX-3.1.0-SNAPSHOTwithFabric8KubernetesDiscoveryClientlibX-3.1.0-SNAPSHOTwithoutFabric8KubernetesDiscoveryClientspring repo dependency is newer and this is what turns out being used, compilation failing as such.
What this PR does is to build the project after the cache is downloaded, in this manner maven will use the locally build snapshot, always.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it wasn't that we were pulling the wrong version of the dependencies, its that the cached version was using what was coming from spring snapshots and not what was built by the build?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exactly.