Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-13852] Allow upstream SVN parameters to be passed down…
…stream

Added an option to allow upstream svn parameters to be passed
to downstream builds.
  • Loading branch information
cjo9900 committed Nov 29, 2012
1 parent 70aa20b commit ff23938
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 7 deletions.
Expand Up @@ -16,23 +16,45 @@

public class SubversionRevisionBuildParameters extends AbstractBuildParameters {

@DataBoundConstructor
private boolean includeUpstreamParameters = false;

public SubversionRevisionBuildParameters() {
this(false);
}

@DataBoundConstructor
public SubversionRevisionBuildParameters(boolean includeUpstreamParameters ) {
this.includeUpstreamParameters = includeUpstreamParameters;
}

public boolean getIncludeUpstreamParameters() {
return includeUpstreamParameters;
}
@Override
public Action getAction(AbstractBuild<?,?> build, TaskListener listener) {

SubversionTagAction tagAction =
build.getAction(SubversionTagAction.class);
if (tagAction == null) {
SubversionTagAction tagAction = build.getAction(SubversionTagAction.class);
RevisionParameterAction revisionAction = build.getAction(RevisionParameterAction.class);

List<SvnInfo> infos = new ArrayList<SvnInfo>();

if (tagAction == null ) {
listener.getLogger().println(
"[parameterizedtrigger] no SubversionTagAction found -- is this project an SVN project ?");
return null;
} else {
infos.addAll(tagAction.getTags().keySet());
}

List<SvnInfo> infos = new ArrayList<SvnInfo>(tagAction.getTags().keySet());
return new RevisionParameterAction(infos);
if(includeUpstreamParameters == true) {
if (revisionAction == null ) {
listener.getLogger().println(
"[parameterizedtrigger] no RevisionParameterAction found -- project did not have SVN parameters passed to it?");
} else {
infos.addAll(revisionAction.getRevisions());
}
}
//if infos is empty don't return an action.
return (infos.size() == 0 ) ? null : new RevisionParameterAction(infos);
}

@Extension
Expand Down
@@ -1,2 +1,5 @@
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:entry field="includeUpstreamParameters" title="${%Include/passthrough Upstream SVN Revisons}">
<f:checkbox default="false" />
</f:entry>
</j:jelly>
@@ -0,0 +1,4 @@
<div>
This option passes through the subversion parameters that were passed
into this build from upstream builds, so that they can be used on downstream projects.
</div>
@@ -0,0 +1,3 @@
<div>
This parameter passes the Subversion revisions that were used in this build to the downstream builds.
</div>

0 comments on commit ff23938

Please sign in to comment.