-
Notifications
You must be signed in to change notification settings - Fork 53
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
fix fallback URL #457
fix fallback URL #457
Conversation
// See: https://github.blog/2021-09-01-improving-git-protocol-security-github/ | ||
connectionURL = connectionURL.replace("git://", "https://"); | ||
} | ||
try { | ||
cloneImpl(connectionURL, scmTag, checkoutDirectory); | ||
break; | ||
return; // checkout was ok |
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.
fixes the actual bug where if the first clone failed and a subsequent one passed, the exception would still be thrown as lastException
would not be null
further down when the loop exited.
@@ -440,12 +440,15 @@ public static void cloneFromScm( | |||
PluginSourcesUnavailableException lastException = null; | |||
for (String connectionURL : connectionURLs) { | |||
if (connectionURL != null) { | |||
if (StringUtils.startsWith(connectionURL, "scm:git:")) { |
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.
code was moved up here so that cloneImpl
only has to deal with real git
URLs, making the logging more user friendly
966b4e0
to
9efda77
Compare
9efda77
to
18b3dee
Compare
This also tidies up the cloneImpl so that it is only expcted to work with valid Git URLs which makes the logging and commands run cleaer
18b3dee
to
42208b1
Compare
* @param connectionURL The connection URL, in a format such as | ||
* scm:git:https://github.com/jenkinsci/mailer-plugin.git or | ||
* https://github.com/jenkinsci/mailer-plugin.git | ||
* @param gitURL The git native URL, see the <a |
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.
makes the logging easier to follow if it spits out the URL that is actually going to be used for the git fetch
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.
Whoops, sorry about that! Thanks for the quick fix.
if the fallbackURL succeeded the exception of any prior attempts was still thrown.
fixes #456
amends #404
tested locally with an upcoming security release using the jenkinsci-cert repo. (plugin name, tag and sha redacted)