Skip to content

Conversation

@ptzafrir
Copy link
Owner

@ptzafrir ptzafrir commented Feb 9, 2019

No description provided.

MarkEWaite and others added 30 commits March 13, 2018 10:15
3.0.0-SNAPSHOT is reported as too old for git plugin dependency on 3.0.0-beta1
When using an ssh private key, the CliGitAPIImpl implementation previously
passed a "-l" command line argument from the username associated with
the ssh key.  OpenSSH implementations prior to OpenSSH 7.7 would only use
that command line argument if no username were included in the ssh URI.

OpenSSH 7.7 changes the ssh command line argument parsing rules.
Previously, the last user name specified would be used, including the
user name in the URL.  With OpenSSH 7.7, the first user name specified
is used, even if a user name is specified in the URL.

The command line:

    ssh -l jenkins git@github.com:jenkinsci/git-client-plugin.git

uses the username 'git' with OpenSSH versions before 7.7 and uses the
username 'jenkins' with OpenSSH 7.7.

OpenSSH 7.7 is included in Windows Git 2.17 and in OpenBSD 6.3.

The CredentialsTest class can test this case.
* JENKINS-48258 Use a copy of ssh file

* Corrected exception handling as per bug report

* Fixed error

* Fixed error
Command line git 2.17.0 changed the case of a word in a message and
caused tests to fail.  Case insensitive comparisons are good enough for
these tests.

Also replaced several duplicated locations with a method that is easier
to read and produces a better diagnostic on failure.
…17.0

Ignore case in git exception message substring asserts
The JGit implementation has deprecated getRef and replaced it with
two implementations, one for exactRef() and one for findRef().  In
this case, the ref is being formed into an exact reference, so the
exactRef() call is the correct choice.
Remove redundant check for null ref in branch checkout

Also rename doCheckout methods to more clearly say what they do.

Add null ref check to tests
Reduce unnecessary reimplementation of LsRemoteCommand in the
JGitAPIImpl source code.
…th-christian-halstrick

JGit improvements from Christian Halstrick review
When using an ssh private key, the CliGitAPIImpl implementation previously
passed a "-l" command line argument from the username associated with
the ssh key.  OpenSSH implementations prior to OpenSSH 7.7 would only use
that command line argument if no username were included in the ssh URI.

OpenSSH 7.7 changes the ssh command line argument parsing rules.
Previously, the last user name specified would be used, including the
user name in the URL.  With OpenSSH 7.7, the first user name specified
is used, even if a user name is specified in the URL.

The command line:

    ssh -l jenkins git@github.com:jenkinsci/git-client-plugin.git

uses the username 'git' with OpenSSH versions before 7.7 and uses the
username 'jenkins' with OpenSSH 7.7.

OpenSSH 7.7 is included in Windows Git 2.17 and in OpenBSD 6.3.

The CredentialsTest class can test this case.
…-arg-precedence-change

[JENKINS-50573] Adapt to openssh 7.7 arg precedence change
Use sshd 2.4 in test

Not a compile time dependency
JGit 4.5 handles absence of username from the ssh URL differently than
JGit 4.11.

The ssh URL github.com:MarkEWaite/tasks.git with the username argument
"git" is handled correctly by JGit 4.11 and incorrectly by JGit 4.5.

JGit 4.5 handles conflicts between the username embedded in the ssh
URL and the username argument differently than JGit 4.11.

The ssh URL git@github.com:MarkEWaite/tasks.git with the username
argument "jenkins" is handled correctly by JGit 4.11 and incorrectly
by JGit 4.5.

JGit 4.5 honors the username argument instead of the username embedded
in the ssh URL.

JGit 4.11 honors the username embedded in the ssh URL instead of the
username argument.

Secure shell versions prior to OpenSSH 7.7 honored the username
embedded in the ssh URL instead of the username argument.  That is the
definitive behavior.

Git plugin changes have been made to cause OpenSSH 7.7 (and later) to
honor the username embedded in the ssh URL instead of the username
argument.  Those changes should keep consistent behavior across all
versions of OpenSSH and all supported versions of command line git.
JGit 4.5 handles absence of username from the ssh URL differently than
JGit 4.11.

The ssh URL github.com:MarkEWaite/tasks.git with the username argument
"git" is handled correctly by JGit 4.11 and incorrectly by JGit 4.5.

JGit 4.5 handles conflicts between the username embedded in the ssh
URL and the username argument differently than JGit 4.11.

The ssh URL git@github.com:MarkEWaite/tasks.git with the username
argument "jenkins" is handled correctly by JGit 4.11 and incorrectly
by JGit 4.5.

JGit 4.5 honors the username argument instead of the username embedded
in the ssh URL.

JGit 4.11 honors the username embedded in the ssh URL instead of the
username argument.

Secure shell versions prior to OpenSSH 7.7 honored the username
embedded in the ssh URL instead of the username argument.  That is the
definitive behavior.

Git plugin changes have been made to cause OpenSSH 7.7 (and later) to
honor the username embedded in the ssh URL instead of the username
argument.  Those changes should keep consistent behavior across all
versions of OpenSSH and all supported versions of command line git.
…ls-test-exclusion

Narrow jgit exclusion in credentials test
MarkEWaite and others added 30 commits October 20, 2018 04:12
Depend on Jenkins 2.107.3 and test 2.121.3
Use a JenkinsRule for every test instead of using a single JenkinsRule
for all the tests.  This will dramatically slow test performance.
The switch from a single JenkinsRule instance at the class level to a
JenkinsRule per credentials test slows the individual tests but should
allow more total tests to be executed because the 180 second JenkinsRule
timeout won't be reached inside any single JenkinsRule test.

Still want to limit the total execution time of the CredentialsTest
class to not exceed 3 minutes.  Otherwise, total test execution time
becomes too long.
…ntials-test-reporting-failure

Stable 2.7 fix credentials test reporting failure
Step 1 to fix JENKINS-29977

Requires git plugin 4.0.0 changes to retain compatibility with current behavior.
Use cat (Linux) and type (Windows) of files rather than echo of strings
to send username and password to the git ssh commands to reduce the risk
and complication of shell escaping username and password text provided
by end users.
The Linux based ssh commands perform expansion of '%' in arguments to ssh,
even if the '%' character is in the name of the file or directory.
Command line git shallow clone is only workable with command line git
1.9 and newer.  Earlier versions cause strange behaviors in the plugin.
Rather than complicate things with spurious failures on older command
line git implementations (like CentOS 6 and CentOS 7).
[JENKINS-47514] Don't let shell process password characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.