Skip to content

Commit

Permalink
Fix for JENKINS-14725
Browse files Browse the repository at this point in the history
  • Loading branch information
fbelzunc committed Dec 10, 2014
1 parent be86a0e commit b3ff6d1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .gitignore
Expand Up @@ -8,3 +8,8 @@ work
/.classpath
/.project
/.settings
.idea
*.iml
/target
.DS_Store
**/.DS_Store
6 changes: 6 additions & 0 deletions pom.xml
Expand Up @@ -51,6 +51,12 @@
<artifactId>subversion</artifactId>
<version>2.4.4</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>promoted-builds</artifactId>
<version>2.10</version>
<optional>true</optional>
</dependency>
</dependencies>

</project>
Expand Down
15 changes: 14 additions & 1 deletion src/main/java/jenkins/plugins/svnmerge/IntegrationPublisher.java
Expand Up @@ -10,6 +10,7 @@
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.BuildStepMonitor;
import hudson.tasks.Publisher;
import jenkins.model.Jenkins;
import org.kohsuke.stapler.DataBoundConstructor;

import java.io.IOException;
Expand Down Expand Up @@ -38,7 +39,7 @@ public boolean perform(AbstractBuild<?,?> build, Launcher launcher, final BuildL
if(build.getResult().isWorseThan(Result.SUCCESS))
return true;

IntegrateAction ia = build.getAction(IntegrateAction.class);
IntegrateAction ia= getIntegrateAction(build);
if(ia==null) {
listener.getLogger().println("Upstream Subversion URL is not specified. Configuration problem?");
return false;
Expand All @@ -64,4 +65,16 @@ public boolean isApplicable(Class<? extends AbstractProject> jobType) {
return true;
}
}

public IntegrateAction getIntegrateAction(AbstractBuild build) {
IntegrateAction ia = build.getAction(IntegrateAction.class);
//JENKINS-14725 If this is a promotion build, then we need to get the rootBuild
if (Jenkins.getInstance().getPlugin("promoted-builds")!=null) {
if(build instanceof hudson.plugins.promoted_builds.Promotion){
AbstractBuild<?,?> rootBuild = build.getRootBuild();
ia = rootBuild.getAction(IntegrateAction.class);
}
}
return ia;
}
}

0 comments on commit b3ff6d1

Please sign in to comment.