-
Notifications
You must be signed in to change notification settings - Fork 268
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
[JENKINS-35227] added support for AdditionalCredentials to SubversionSCMSource #189
base: master
Are you sure you want to change the base?
Changes from 4 commits
3685c38
11db817
fa29350
3540bb6
4a9730b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,9 @@ | |
import hudson.scm.FilterSVNAuthenticationManager; | ||
import hudson.scm.SubversionRepositoryStatus; | ||
import hudson.scm.SubversionSCM; | ||
import hudson.scm.SubversionSCM.AdditionalCredentials; | ||
import hudson.scm.subversion.SvnHelper; | ||
import hudson.scm.subversion.UpdateUpdater; | ||
import hudson.security.ACL; | ||
import hudson.util.EditDistance; | ||
import hudson.util.FormValidation; | ||
|
@@ -68,6 +70,8 @@ | |
import org.kohsuke.stapler.DataBoundConstructor; | ||
import org.kohsuke.stapler.QueryParameter; | ||
import org.kohsuke.stapler.StaplerRequest; | ||
import org.kohsuke.accmod.Restricted; | ||
import org.kohsuke.accmod.restrictions.NoExternalUse; | ||
import org.tmatesoft.svn.core.SVNDirEntry; | ||
import org.tmatesoft.svn.core.SVNException; | ||
import org.tmatesoft.svn.core.SVNNodeKind; | ||
|
@@ -121,6 +125,8 @@ public class SubversionSCMSource extends SCMSource { | |
private final String remoteBase; | ||
|
||
private String credentialsId = ""; // TODO null would be a better default, but need to check null safety on usages | ||
|
||
private List<AdditionalCredentials> additionalCredentials; | ||
|
||
private String includes = DescriptorImpl.DEFAULT_INCLUDES; | ||
|
||
|
@@ -159,6 +165,18 @@ public String getCredentialsId() { | |
public void setCredentialsId(String credentialsId) { | ||
this.credentialsId = credentialsId; | ||
} | ||
@DataBoundSetter | ||
public void setAdditionalCredentials(List<AdditionalCredentials> additionalCredentials) { | ||
this.additionalCredentials = additionalCredentials; | ||
} | ||
//without getter jelly will crash | ||
@Restricted(NoExternalUse.class) | ||
public List<AdditionalCredentials> getAdditionalCredentials() { | ||
if(additionalCredentials==null) { | ||
return Collections.emptyList(); | ||
} | ||
return(additionalCredentials); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FindBugs will grumble about exposing external implementation. Either make it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for your comments. How do I make it restricted? Does adding "@restricted(NoExternalUse.class)" work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be better to just |
||
} | ||
|
||
/** | ||
* Gets the comma separated list of exclusions. | ||
|
@@ -689,7 +707,7 @@ public SubversionSCM build(@NonNull SCMHead head, | |
// name contains an @ so need to ensure there is an @ at the end of the name | ||
remote.append('@'); | ||
} | ||
return new SubversionSCM(remote.toString(), credentialsId, "."); | ||
return new SubversionSCM(SubversionSCM.ModuleLocation.parse(new String[]{remote.toString()}, new String[]{credentialsId}, new String[]{"."}, null,null), new UpdateUpdater(), null, null, null, null, null, null, false, false, additionalCredentials); | ||
} | ||
|
||
/** | ||
|
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.
from what I see it still may be null when you read data from the disk