-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Bump Gradle to 8.5, fix cache. #4139
base: master
Are you sure you want to change the base?
Conversation
bde6b73
to
d9f4877
Compare
Note: shift from port 5000 -> 5001 is because macOS is running AirPlay Receiver on the same port (settings -> Airdrop & Handoff -> AirPlay Receiver) |
Thanks for splitting it up! |
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.
I understand that maybe you switching 5000 -> 5001 was needed for some local mac development, but it really does pollute this PR with a HUGE number of changed. Once again making it hard to review. I think isolating the logical changes in here from that massive change would make it easier to read and review (and not accidentally miss something).
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildDockerTask.java
Outdated
Show resolved
Hide resolved
7df6a84
to
e12e973
Compare
Agree: removed the 5000 -> 5001 changes. |
jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/LocalBaseImageStepsTest.java
Outdated
Show resolved
Hide resolved
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildDockerTask.java
Show resolved
Hide resolved
49f88fb
to
19daba5
Compare
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.
okay cool, I think I got through most of this, just a few questions
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ExtraDirectoryParameters.java
Outdated
Show resolved
Hide resolved
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/FilesTaskV2.java
Show resolved
Hide resolved
...plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/SkaffoldWatchParameters.java
Outdated
Show resolved
Hide resolved
...in/src/test/java/com/google/cloud/tools/jib/gradle/GradleProjectPropertiesExtensionTest.java
Outdated
Show resolved
Hide resolved
Note: there's one more deprecated thing in place:
This is coming from the researchgate plugin:
There's no update to the version we're using (v3.0.2) at time of writing |
Yeah it's okay about the research gate plugin. We'll deal with that later |
jib-cli/src/integration-test/resources/jarTest/spring-boot/build-layered.gradle
Outdated
Show resolved
Hide resolved
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildDockerTask.java
Show resolved
Hide resolved
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ExtraDirectoryParameters.java
Outdated
Show resolved
Hide resolved
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.
I think we're getting close! Added just a few questions. Thanks again so much for your patience @wwadge! Will take a look at the windows issue.
jib-maven-plugin/src/test/resources/maven/projects/war_servlet25/pom-tomcat.xml
Outdated
Show resolved
Hide resolved
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/GradleProjectProperties.java
Outdated
Show resolved
Hide resolved
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/GradleProjectProperties.java
Outdated
Show resolved
Hide resolved
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/GradleProjectProperties.java
Outdated
Show resolved
Hide resolved
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ExtraDirectoryParameters.java
Outdated
Show resolved
Hide resolved
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/GradleProjectProperties.java
Show resolved
Hide resolved
Looks like we're getting a slightly different error message now:
Hm it looks like the returned file path is resolving to the absolute path instead of the expected |
7732789
to
8a62443
Compare
I changed the way from(..) was implemented, let's try again with the new implementation that I just pushed |
6e2e981
to
dd08d58
Compare
|
assertThat( | ||
testJibExtension.getSkaffold().getWatch().getExcludes().getFiles().stream() | ||
.map(File::toPath) | ||
.collect(Collectors.toSet())) | ||
.containsExactly(root.resolve("watch4").toAbsolutePath()); | ||
} | ||
|
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.
It looks like there is some inconsistency in how windows and other systems resolve paths; the former resolves to the absolute path whereas the latter resolves to the relative path. For consistent test behavior, can we always test on the absolute path with the help of toAbsolutePath()
?
jib/jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibExtensionTest.java
Lines 511 to 514 in 440bd48
assertThat(testJibExtension.getExtraDirectories().getPaths().get(0).getFrom()) | |
.isEqualTo(Paths.get("/foo")); | |
assertThat(testJibExtension.getExtraDirectories().getPaths().get(1).getFrom()) | |
.isEqualTo(Paths.get("/bar/baz")); |
Same as what is being done in testSkaffold()
. cc/ @loosebazooka
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.
These docs have this to say:
Never use new File(relative path) unless passed to file() or files() or from() or other methods being defined in terms of file() or files(). Otherwise this creates a path relative to the current working directory (CWD). Gradle can make no guarantees about the location of the CWD, which means builds that rely on it may break at any time.
Adding toAbsolutePath() to that test....
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.
Stacktrace:
com.google.cloud.tools.jib.gradle.JibExtensionTest > testProperties FAILED
expected: C:\foo
but was : C:\tmpfs\src\github\jib\jib-gradle-plugin\build\tmp\test\work\gradle10718998764490656projectDir\foo
at com.google.cloud.tools.jib.gradle.JibExtensionTest.testProperties(JibExtensionTest.java:525)
Added a few observations in #4159 (comment) after trying out a couple of things (including adjusting the tests to verify on the absolute path). The getFrom() method (pasted below) always resolves to the absolute path in both windows and ubuntu) when the file paths are provided through gradle properties but shows discrepancies when the path is provided through a System Property.
@Override
@InputFile
public Path getFrom() {
return from.getSingleFile().toPath();
}
Since this is not a blocker for Gradle 8.x updates, could we revert the logic of extra directories to how it was originally? This annotation is an interesting enhancement to explore but probably belongs in a separate issue due to the change in behavior that is yet to be understood further.
Hopefully this latest commit is close enough to how it was and works - I cannot revert completely because we used "project.file" previously. I will try to obtain a windows box to test if this one fails too for I'm still working a bit blind. |
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
One more kokoru run please - I reverted that .toAbsolutePath() bit we had added to our tests. Now that I reverted how I'm handling paths, I needed to revert that .toAbsolutePath() bit too. Seems to work on a local windows box. |
@mpeddada1 I think this is ready for another review |
import org.gradle.api.tasks.TaskContainer; | ||
import org.gradle.api.tasks.TaskProvider; | ||
import org.gradle.api.tasks.bundling.Jar; | ||
import org.gradle.util.GradleVersion; | ||
|
||
public class JibPlugin implements Plugin<Project> { | ||
|
||
@VisibleForTesting static final GradleVersion GRADLE_MIN_VERSION = GradleVersion.version("5.1"); | ||
@VisibleForTesting static final GradleVersion GRADLE_MIN_VERSION = GradleVersion.version("8.0"); |
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.
Unfortunately this is a breaking change for Jib, we still have customers on Gradle versions < 8, and we don't want to stop the support for them. Since javaPluginExtension.getSourceSets()
does not exist until Gradle 8, I don't think we have a way to add this feature without stop supporting Gradle 6 and 7 customers.
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.
Is this the only breaking change? We can make conditional calls to various things.
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.
It's from 7.1 according to: https://docs.gradle.org/current/javadoc/org/gradle/api/plugins/JavaPluginExtension.html#getSourceSets--
We're using it in very few places so I don't think it's very difficult to support older versions. I can attempt a patch to support as from v6 if you want though I understand if you wish to put this PR on hold till some arbitrary future date.
@wwadge Thanks for submitting this PR and all the effort! @loosebazooka Thanks for putting the effort reviewing the PR! Unfortunately, as I mentioned in the comment, after careful consideration, we don't want to introduce a breaking change for customers still use Gradle < 8 at this moment. So we can not accept this PR as it is right now, we may re-visit it once we feel comfortable to move the minimum supported version for jib to 8. We are really sorry for the back and forth in the past few months, please let us know if you have other suggestions! |
Updated #4069 to not touch junit.