forked from eficode/ClearCaseUCMPlugin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from wolfgarnet/master
Fix for issue JENKINS-13970
- Loading branch information
Showing
2 changed files
with
71 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package net.praqma.hudson; | ||
|
||
import net.praqma.hudson.scm.CCUCMScm; | ||
import net.praqma.hudson.scm.CCUCMState.State; | ||
import hudson.Extension; | ||
import hudson.model.AbstractBuild; | ||
import hudson.model.Run; | ||
import hudson.model.listeners.RunListener; | ||
import hudson.scm.SCM; | ||
|
||
@Extension | ||
public class CCUCMRunListener extends RunListener<Run> { | ||
|
||
public CCUCMRunListener() { | ||
super( Run.class ); | ||
} | ||
|
||
@Override | ||
public void onFinalized( Run r ) { | ||
AbstractBuild<?, ?> build = null; | ||
SCM scm = null; | ||
|
||
if( r instanceof AbstractBuild ) { | ||
try { | ||
/* I don't even know if this works... */ | ||
build = (AbstractBuild<?, ?>)r; | ||
scm = build.getProject().getScm(); | ||
} catch( Exception e ) { | ||
System.out.println( "Ok, that didn't work..." ); | ||
return; | ||
} | ||
|
||
if( scm instanceof CCUCMScm ) { | ||
String jobName = build.getParent().getDisplayName().replace( ' ', '_' ); | ||
int jobNumber = build.getNumber(); | ||
State state = CCUCMScm.ccucm.getState( jobName, jobNumber ); | ||
|
||
state.remove(); | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains 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