Add UnsupportedCommand: Handling unsupported additional behavior of git operations in JGit#937
Closed
rishabhBudhouliya wants to merge 39 commits intojenkinsci:masterfrom
Closed
Add UnsupportedCommand: Handling unsupported additional behavior of git operations in JGit#937rishabhBudhouliya wants to merge 39 commits intojenkinsci:masterfrom
rishabhBudhouliya wants to merge 39 commits intojenkinsci:masterfrom
Conversation
a "NONE" string Also, size which is decided to switch implementation has been increased to 50K because 5 MiB is experimentally an approximation where behavior of jgit starts to change.
Note: The current test cases target only the scenario with heuristic 1, i.e the cache determination option.
a "NONE" string Also, size which is decided to switch implementation has been increased to 50K because 5 MiB is experimentally an approximation where behavior of jgit starts to change.
Note: The current test cases target only the scenario with heuristic 1, i.e the cache determination option.
- Change in design of handling extension API results: Add the ability to throw exceptions for `getSizeOfRepository` in the Extension Point. Add additional checks on receiving the results from implemented extensions to look for a non-zero without exceptions "size" result from other plugins implementing the extension point.
- Having no cache but available extensions from other plugins - Having a cached directory to recommend the appropriate git implementation - In the event of having an extension: - Returning size > 5 MiB - Returning size < 5 MiB - Not applicable to the provided remote URL from git plugin - Throwing exceptions while estimating the size of repo
…/git-plugin into size-estimator
… repo URL, the plugin will get the size from the first one. Ideally, for a particular remote URL - only one plugin should return size of the repository.
The process of recommending an optimal git impl is in two stages: Stage 1: Determine if the user additional behavior contains a feature which is not supported by JGit - see UnsupportedCommand usage Stage 2: Instantiating GitToolChooser to recommend a git tool Here, the GitToolChooser uses the repository URL to determine a recommendation for the git implementation.
This method can be called by an extension to convey if a certain extension feature is supported by JGit or not. After this information is provided by the an extenions or multiple extensions, the command can determine if JGit is to be used or not. Even if one extension is not supporting a feature, JGit will not be recommended.
By implementing this method, this extension is conveying that in the case a user wants to use timeout, JGit will not be able to perform the git client operations as it is not yet supported.
…le feature While instantiating the class using a repo url, the class will also need a decision to determine if JGit has to be recommended in the case of a scenario where an extension is not supported by JGit.
MarkEWaite
requested changes
Aug 14, 2020
Contributor
MarkEWaite
left a comment
There was a problem hiding this comment.
Ready to use released git client plugin. Other comments are optional.
| <dependency> | ||
| <groupId>org.jenkins-ci.plugins</groupId> | ||
| <artifactId>git-client</artifactId> | ||
| <version>3.3.3-SNAPSHOT</version> |
Contributor
There was a problem hiding this comment.
Released Aug 13, 2020.
Suggested change
| <version>3.3.3-SNAPSHOT</version> | |
| <version>3.4.0</version> |
| ext.determineSupportForJGit(this, unsupportedCommand); | ||
| } | ||
|
|
||
| listener.getLogger().println("Using Performance Improvement"); |
Contributor
There was a problem hiding this comment.
Isn't this inferred by the next message?
Suggested change
| listener.getLogger().println("Using Performance Improvement"); |
| } | ||
|
|
||
| /** | ||
| * Called when support of JGit for a particular or multiple extensions is to be determined |
Contributor
There was a problem hiding this comment.
Suggested change
| * Called when support of JGit for a particular or multiple extensions is to be determined | |
| * Called when support of JGit for a particular or multiple extensions is to be determined. | |
| * Updates the passed unsupportedCommand with the evaluation results. |
| /** | ||
| * Called when support of JGit for a particular or multiple extensions is to be determined | ||
| * @param scm GitSCM object | ||
| * @param unsupportedCommand UnsupportedCommand object |
Contributor
There was a problem hiding this comment.
Suggested change
| * @param unsupportedCommand UnsupportedCommand object | |
| * @param unsupportedCommand UnsupportedCommand used to report compatibility of requested extensions with the potential git implementations |
| @Override | ||
| public void determineSupportForJGit(GitSCM scm, UnsupportedCommand cmd) { | ||
| List<RemoteConfig> repos = scm.getRepositories(); | ||
| cmd.lfsRemote(repos.get(0).getName()); |
Contributor
There was a problem hiding this comment.
Since repos.get() returns a list of entries, shouldn't this iterate over the list?
Suggested change
| cmd.lfsRemote(repos.get(0).getName()); | |
| cmd.lfsRemote(repos.get(0).getName()); |
| title __IMPL's Class Diagram__\n | ||
|
|
||
| namespace { | ||
| namespace udson.plugins.git { |
Contributor
There was a problem hiding this comment.
If you're storing a UML representation like this, shouldn't the namespace match the package name?
Suggested change
| namespace udson.plugins.git { | |
| namespace hudson.plugins.git { |
|
Carry Forwarded to #931 . This PR can be closed. |
Contributor
|
Closed in favor of #931 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enabling GitToolChooser to recommend a git implementation knowing if the implementation is compatible with certain features of git
The introduction of UnsupportedCommand allows us to solve cases where JGit might not be supported and GitToolChooser might suggest JGit because of the size rule. The GitToolChooser can use this command to know if JGit can be user or not.
This working of this command and its usage has been explained below:
Using UnsupportedCommand in Git Plugin
Add a method in GitSCMExtension:
determineSupportForJGitThis method acts as a way for the extensions to convey their support for JGit over certain functionalities.
Add implementation of
determineSupportForGitfor various extensions: GitLFSPull, SparseCheckoutPaths, SubmoduleOption, CheckoutOption etc.These implementations will put information into an
unsupportedCommandobject about the compatibility of a certain extension feature with JGit.An example of how GitToolChooser will work within the Git Plugin
Refer to this commit.
Checklist
Types of changes
Further comments
If this is a relatively large or complex change, start the discussion by explaining why you chose the solution you did and what alternatives you considered.