-
-
Notifications
You must be signed in to change notification settings - Fork 273
[FIXED JENKINS-22568] Subversion polling does not work with parameters. #89
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,17 +65,10 @@ | |
| import hudson.Launcher; | ||
| import hudson.Util; | ||
| import hudson.init.InitMilestone; | ||
| import hudson.model.AbstractDescribableImpl; | ||
| import hudson.model.Descriptor; | ||
| import hudson.model.Item; | ||
| import hudson.model.ItemGroup; | ||
| import hudson.model.ModelObject; | ||
| import hudson.model.TaskListener; | ||
| import hudson.model.AbstractBuild; | ||
| import hudson.model.AbstractProject; | ||
| import hudson.model.Hudson; | ||
| import hudson.model.*; | ||
|
|
||
| import java.io.ByteArrayOutputStream; | ||
| import java.net.URLClassLoader; | ||
| import java.nio.charset.UnsupportedCharsetException; | ||
| import java.security.KeyStore; | ||
| import java.security.KeyStoreException; | ||
|
|
@@ -90,8 +83,6 @@ | |
| import hudson.util.ListBoxModel; | ||
| import jenkins.model.Jenkins; | ||
| import jenkins.model.Jenkins.MasterComputer; | ||
| import hudson.model.ParametersAction; | ||
| import hudson.model.Run; | ||
| import hudson.remoting.Callable; | ||
| import hudson.remoting.Channel; | ||
| import hudson.remoting.VirtualChannel; | ||
|
|
@@ -194,7 +185,6 @@ | |
| import com.trilead.ssh2.DebugLogger; | ||
| import com.trilead.ssh2.SCPClient; | ||
| import com.trilead.ssh2.crypto.Base64; | ||
| import hudson.model.Job; | ||
|
|
||
| /** | ||
| * Subversion SCM. | ||
|
|
@@ -1402,7 +1392,7 @@ else if (project.getLastBuild()!=null) { | |
| for (ModuleLocation loc: getLocations()) { | ||
| String url; | ||
| try { | ||
| url = loc.getSVNURL().toDecodedString(); | ||
| url = loc.getExpandedLocation(project).getSVNURL().toDecodedString(); | ||
| } catch (SVNException ex) { | ||
| ex.printStackTrace(listener.error(Messages.SubversionSCM_pollChanges_exception(loc.getURL()))); | ||
| return BUILD_NOW; | ||
|
|
@@ -2907,6 +2897,32 @@ public static List<ModuleLocation> parse(String[] remoteLocations, String[] cred | |
| return modules; | ||
| } | ||
|
|
||
| /** | ||
| * If a subversion remote uses $VAR or ${VAR} as a parameterized build, | ||
| * we expand the url. This will expand using the DEFAULT item. If there | ||
| * is a choice parameter, it will expand with the FIRST item. | ||
| */ | ||
| public ModuleLocation getExpandedLocation(Job<?, ?> project) { | ||
| String url = this.getURL(); | ||
| String returnURL = url; | ||
| for (JobProperty property : project.getProperties().values()) { | ||
| if (property instanceof ParametersDefinitionProperty) { | ||
| ParametersDefinitionProperty pdp = (ParametersDefinitionProperty) property; | ||
| for (String propertyName : pdp.getParameterDefinitionNames()) { | ||
| if (url.contains(propertyName)) { | ||
| ParameterDefinition pd = pdp.getParameterDefinition(propertyName); | ||
| String replacement = String.valueOf(pd.getDefaultParameterValue().createVariableResolver(null).resolve(propertyName)); | ||
| returnURL = returnURL.replace("${" + propertyName + "}", replacement); | ||
| returnURL = returnURL.replace("$" + propertyName, replacement); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return new ModuleLocation(returnURL, credentialsId, getLocalDir(), getDepthOption(), | ||
| isIgnoreExternalsOption()); | ||
| } | ||
|
|
||
| @Extension | ||
| public static class DescriptorImpl extends Descriptor<ModuleLocation> { | ||
|
|
||
|
|
@@ -3082,12 +3098,12 @@ public FormValidation doCheckLocal(@QueryParameter String value) throws IOExcept | |
| /** | ||
| * Property to control whether SCM polling happens from the slave or master | ||
| */ | ||
| private static boolean POLL_FROM_MASTER = Boolean.getBoolean(SubversionSCM.class.getName()+".pollFromMaster"); | ||
| private static boolean POLL_FROM_MASTER = Boolean.getBoolean(SubversionSCM.class.getName() + ".pollFromMaster"); | ||
|
Member
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. Avoid making formatting changes in PRs or really any commits. It makes diffs harder to read, |
||
|
|
||
| /** | ||
| * If set to non-null, read configuration from this directory instead of "~/.subversion". | ||
| */ | ||
| public static String CONFIG_DIR = System.getProperty(SubversionSCM.class.getName()+".configDir"); | ||
| public static String CONFIG_DIR = System.getProperty(SubversionSCM.class.getName() + ".configDir"); | ||
|
|
||
| /** | ||
| * Enables trace logging of Ganymed SSH library. | ||
|
|
||
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
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.
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 am sure there is a utility in Jenkins core to do macro expansion which you should be using.
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.
@christ66 could probably do that... but IIRC the correct utility is actually in a plugin because there are multiple ways to expand tokens or something... anywho I'll leave it up to @christ66 how he wants to respond