Skip to content

Commit

Permalink
[JENKINS-11766] Maven RedeployPublisher: fix promoted-builds deployme…
Browse files Browse the repository at this point in the history
…nt to Maven

Add some indirection to allow the promoted-builds plugin's
RedeployBatchTaskPublisher to override getMavenBuild() and return the
promotion target's MavenModuleSetBuild object.

Also requires a fix in promoted-builds.

Signed-off-by: Michael Smith <msmith@cbnco.com>

Originally-Committed-As: e5c96723f3d77ada3c8a1e4da161d8e5134365c2
  • Loading branch information
Michael Smith authored and kohsuke committed Jan 4, 2012
1 parent d59a61b commit 608c35f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/main/java/hudson/maven/RedeployPublisher.java
Expand Up @@ -314,20 +314,23 @@ public String call() throws IOException {


/**
* Obtains the {@link MavenAbstractArtifactRecord} that we'll work on.
* Obtains the {@link MavenModuleSetBuild} that we'll work on, or null.
* <p>
* This allows promoted-builds plugin to reuse the code for delayed deployment.
*/
protected MavenAbstractArtifactRecord getAction(AbstractBuild<?, ?> build) {
return build.getAction(MavenAbstractArtifactRecord.class);
protected MavenModuleSetBuild getMavenBuild(AbstractBuild<?, ?> build) {
return (build instanceof MavenModuleSetBuild)
? (MavenModuleSetBuild) build
: null;
}

protected List<MavenAbstractArtifactRecord> getActions(AbstractBuild<?, ?> build, BuildListener listener) {
List<MavenAbstractArtifactRecord> actions = new ArrayList<MavenAbstractArtifactRecord>();
if (!(build instanceof MavenModuleSetBuild)) {
MavenModuleSetBuild mavenBuild = getMavenBuild(build);
if (mavenBuild == null) {
return actions;
}
for (Entry<MavenModule, MavenBuild> e : ((MavenModuleSetBuild)build).getModuleLastBuilds().entrySet()) {
for (Entry<MavenModule, MavenBuild> e : mavenBuild.getModuleLastBuilds().entrySet()) {
MavenAbstractArtifactRecord a = e.getValue().getAction( MavenAbstractArtifactRecord.class );
if (a == null) {
listener.getLogger().println("No artifacts are recorded for module" + e.getKey().getName() + ". Is this a Maven project?");
Expand Down

0 comments on commit 608c35f

Please sign in to comment.