-
Notifications
You must be signed in to change notification settings - Fork 114
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
Fetch only the recent commits when cloning a remote Git repository for mirroring #808
Conversation
As you told me via chat, jgit requires Java 11+. Central Dogma builds everything with Java 8, and thus we get compilation errors. To fix this, we need to update the Java version from 8 to 11, but we cannot update the client library's Java version just yet, because many users are still using Java 8. What's tricky about the upgrade is that our users sometimes pull in Central Dogma server as a dependency for testing purposes. We can't force them to upgrade their tests to Java 11. Therefore, I'd like to suggest the following workaround:
What do you think? |
I heard from @minwoox et al that there might be a few more breaking changes between jGit 5 and 6. Those changes are basically package renaming. Please let me know if you ever encounter such compilation or runtime error. We'll need to use reflection again there as well. |
There were two classes when I was creating the PR: https://github.com/line/centraldogma/pull/702/files#diff-858d35514fceb503e11dca2402c0c61a0d21b4f3481d6955ba5af10391b069e7R44 We probably need two separate classes (e.g. |
Thanks @minwoox, yes @trustin, there are 2 classes I have updated in this pr too, I am dealing with it. |
server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitMirror.java
Show resolved
Hide resolved
server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitMirror.java
Show resolved
Hide resolved
|
server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitWithAuth5.java
Outdated
Show resolved
Hide resolved
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #808 +/- ##
============================================
- Coverage 65.66% 65.50% -0.16%
- Complexity 3292 3293 +1
============================================
Files 351 353 +2
Lines 13751 13796 +45
Branches 1491 1492 +1
============================================
+ Hits 9029 9037 +8
- Misses 3876 3909 +33
- Partials 846 850 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
So far so good! Could you:
|
Oh and please make sure the distribution directory ( |
OK, how can I do this? |
server-jgit6/build.gradle
Outdated
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(11) | ||
} | ||
} |
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.
Should we set the Java version java11
flag instead which will automatically set the compile target version https://github.com/line/gradle-scripts#setting-a-target-version-with-the-javad-flag
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.
You need to update master
branch first and refer to the following link as an example.
https://github.com/line/armeria/blob/ab7488bafc2912445f026fb6d02420f134937073/settings.gradle#L28
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.
Hello, what do you mean about update master branch first
, you mean create another pull request? I guess I need to update on /setting.gradle
in this 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.
It looks like we can't use java11
flag in this case because other non-java11
modules optionally depends on it, e.g. :it
and :dist
.
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 guess he meant doing git merge master
in this PR. I did it for you 😉
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 is likely we can fix buildJdkVersion
to 17 and run tests with 8, 11, 17 to take advantage of javaN
flag.
./gradlew test -PbuildJdkVersion=17 -PtestJavaVersion=8
Let me update actions_build.yml
and gradle scripts and push them to this PR.
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.
Great! Thank you
server-jgit6/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitWithAuth6.java
Outdated
Show resolved
Hide resolved
server-jgit6/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitWithAuth6.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitMirror.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitWithAuth.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitWithAuth.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitWithAuth5.java
Outdated
Show resolved
Hide resolved
@thachlp Could you resolve the conflicts? |
sure |
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.
👍
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.
Thanks, @thachlp! 🚀🥳
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.
Looks good, left some minor comments/questions
server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/Git5WithAuth.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitMirror.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitMirror.java
Show resolved
Hide resolved
server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitWithAuth.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitMirror.java
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.
Verified the flaky tests CI job passes in my local. Thanks @thachlp ! 🙇 👍 🚀
Motivation
From
jgit
6.3.x we can limit the fetch graph bysetDepth
, it will help improve performance.Modification
server-jgit6
for jgit 6.x version.GitWithAuth
for supportGitWithAuth5
andGitWithAuth6
.GitWithAuth5
that implementsGitWithAuth
with jGit5.GitWithAuth
with jGit6.Result
jre 11
and jgit 5.x forjre 8
.