Skip to content
Permalink
Browse files

JENKINS-29033

  • Loading branch information
MadsNielsen committed Jun 23, 2015
1 parent b13856a commit 775c2d3b435ea67efb91eb4363f802be26d93fa4
Showing with 1,879 additions and 69 deletions.
  1. +6 −0 pom.xml
  2. +16 −1 src/main/java/net/praqma/hudson/CCUCMBuildAction.java
  3. +0 −1 src/main/java/net/praqma/hudson/Config.java
  4. +0 −1 src/main/java/net/praqma/hudson/LoggerListener.java
  5. +24 −0 src/main/java/net/praqma/hudson/PromotionListAction.java
  6. +7 −22 src/main/java/net/praqma/hudson/notifier/CCUCMNotifier.java
  7. +14 −0 src/main/java/net/praqma/hudson/notifier/PollOthersRemotePostBuild.java
  8. +299 −0 src/main/java/net/praqma/hudson/notifier/PollSubscribeRemotePostBuild.java
  9. +6 −6 src/main/java/net/praqma/hudson/notifier/RemotePostBuild.java
  10. +79 −0 src/main/java/net/praqma/hudson/remoting/GetConsideredBaselinesForSubscribe.java
  11. +84 −0 src/main/java/net/praqma/hudson/remoting/GetDetermineResultForSubscribe.java
  12. +0 −1 src/main/java/net/praqma/hudson/remoting/RemoteUtil.java
  13. +166 −30 src/main/java/net/praqma/hudson/scm/CCUCMScm.java
  14. +9 −0 src/main/java/net/praqma/hudson/scm/Polling.java
  15. +57 −0 src/main/java/net/praqma/hudson/scm/pollingmode/ComponentSelectionCriteriaRequirement.java
  16. +160 −0 src/main/java/net/praqma/hudson/scm/pollingmode/JobNameRequirement.java
  17. +0 −1 src/main/java/net/praqma/hudson/scm/pollingmode/PollChildMode.java
  18. +7 −0 src/main/java/net/praqma/hudson/scm/pollingmode/PollRebaseMode.java
  19. +5 −0 src/main/java/net/praqma/hudson/scm/pollingmode/PollSelfMode.java
  20. +214 −0 src/main/java/net/praqma/hudson/scm/pollingmode/PollSubscribeMode.java
  21. +60 −2 src/main/java/net/praqma/hudson/scm/pollingmode/PollingMode.java
  22. +32 −0 src/main/java/net/praqma/hudson/scm/pollingmode/Requirement.java
  23. +6 −0 ...in/resources/net/praqma/hudson/scm/pollingmode/ComponentSelectionCriteriaRequirement/config.jelly
  24. +9 −0 src/main/resources/net/praqma/hudson/scm/pollingmode/JobNameRequirement/config.jelly
  25. +4 −0 src/main/resources/net/praqma/hudson/scm/pollingmode/JobNameRequirement/help-ignores.html
  26. +3 −0 src/main/resources/net/praqma/hudson/scm/pollingmode/JobNameRequirement/help-jobName.html
  27. +28 −0 src/main/resources/net/praqma/hudson/scm/pollingmode/PollSubscribeMode/config.jelly
  28. +2 −2 src/test/java/net/praqma/hudson/test/CCUCMRule.java
  29. +1 −1 src/test/java/net/praqma/hudson/test/integration/self/BaselinesFound.java
  30. +0 −1 src/test/java/net/praqma/hudson/test/integration/self/Polling.java
  31. +188 −0 src/test/java/net/praqma/hudson/test/integration/subscribe/BaselinesFound.java
  32. +87 −0 ...test/java/net/praqma/hudson/test/integration/subscribe/ClearCaseUCMConfigurationComponentDTO.java
  33. +16 −0 src/test/java/net/praqma/hudson/test/integration/subscribe/ClearCaseUCMConfigurationDTO.java
  34. +147 −0 src/test/java/net/praqma/hudson/test/integration/subscribe/ClearcaseUCMCompatability.java
  35. +20 −0 src/test/java/net/praqma/hudson/test/integration/subscribe/CompatabilityCompatible.java
  36. +41 −0 src/test/java/net/praqma/hudson/test/integration/subscribe/ExternalData.java
  37. +82 −0 src/test/java/net/praqma/hudson/test/integration/subscribe/MongoExternalDataSourceRule.java
@@ -418,6 +418,12 @@
<artifactId>praqmajutils</artifactId>
<version>0.1.33</version>
</dependency>

<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>compatibility-action-storage</artifactId>
<version>1.0</version>
</dependency>

<dependency>
<groupId>net.praqma</groupId>
@@ -11,11 +11,13 @@
import net.praqma.clearcase.ucm.view.SnapshotView;
import net.praqma.hudson.scm.Polling;
import net.praqma.hudson.scm.Unstable;
import net.praqma.hudson.scm.pollingmode.PollingMode;

public class CCUCMBuildAction implements Action {

private AbstractBuild<?, ?> build;
private transient TaskListener listener;
private PollingMode mode;

private Stream stream;
private Component component;
@@ -354,7 +356,6 @@ public String toString() {
return stream + ", " + component + ", " + promotionLevel + " = " + baseline;
}


public String stringify() {
StringBuilder sb = new StringBuilder();
sb.append( "Stream : " + stream + "\n" );
@@ -388,5 +389,19 @@ public void setRebaseTargets(List<Baseline> rebaseTargets) {
public void setNewFoundationStructure(List<Baseline> newFoundationStructure) {
this.newFoundationStructure = newFoundationStructure;
}

/**
* @return the mode
*/
public PollingMode getMode() {
return mode;
}

/**
* @param mode the mode to set
*/
public void setMode(PollingMode mode) {
this.mode = mode;
}

}
@@ -40,7 +40,6 @@ public static Stream devStream( String pvob ) throws ScmException {
public static Stream getIntegrationStream( Baseline bl, String buildProject ) throws ScmException {
Stream stream = null;
Project project = null;

/*
* If the build project was not given as a parameter to the job, try to
* find hudson, Hudson, jenkins or Jenkins
@@ -1,6 +1,5 @@
package net.praqma.hudson;

import hudson.Extension;
import hudson.model.Run;
import hudson.model.TaskListener;
import hudson.model.listeners.RunListener;
@@ -0,0 +1,24 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.praqma.hudson;

import hudson.model.InvisibleAction;
import java.util.List;
import net.praqma.clearcase.ucm.entities.Baseline;

/**
*
* @author Mads
*/
public class PromotionListAction extends InvisibleAction {

public final List<Baseline> baselines;

public PromotionListAction(List<Baseline> baselines) {
this.baselines = baselines;
}

}
@@ -9,7 +9,6 @@
import org.kohsuke.stapler.StaplerRequest;

import net.praqma.clearcase.ucm.entities.Baseline;
import net.praqma.clearcase.ucm.entities.Stream;
import net.praqma.clearcase.util.ExceptionUtils;
import net.praqma.hudson.CCUCMBuildAction;
import net.praqma.hudson.Config;
@@ -31,7 +30,6 @@
import hudson.tasks.BuildStepMonitor;
import hudson.tasks.Notifier;
import hudson.tasks.Publisher;
import net.praqma.clearcase.Rebase;
import net.praqma.clearcase.ucm.entities.Component;
import net.praqma.hudson.exception.TemplateException;
import net.praqma.hudson.remoting.RebaseCancelTask;
@@ -96,7 +94,6 @@ public boolean perform( AbstractBuild<?, ?> build, Launcher launcher, BuildListe
if( baseline != null ) {
out.println( String.format ( "%s Processing baseline", "["+Config.nameShort + "]"));
status.setErrorMessage( action.getError() );

try {
processBuild( build, launcher, listener, action );
if( action.doSetDescription() ) {
@@ -108,7 +105,6 @@ public boolean perform( AbstractBuild<?, ?> build, Launcher launcher, BuildListe
logger.fine( String.format( "Setting build description to: %s", status.getBuildDescr() ) );
build.setDescription( status.getBuildDescr() );
}

}

} catch( NotifierException ne ) {
@@ -175,12 +171,6 @@ private void processBuild( AbstractBuild<?, ?> build, Launcher launcher, BuildLi

CCUCMBuildAction action = build.getAction( CCUCMBuildAction.class );

/* Initialize variables for post build steps */
Stream targetstream = null;
targetstream = pstate.getBaseline().getStream();
Stream sourcestream = targetstream;
Baseline sourcebaseline = pstate.getBaseline();
Baseline targetbaseline = sourcebaseline;
logger.fine(String.format("NTBC: %s",pstate.doNeedsToBeCompleted()));

/*
@@ -208,8 +198,8 @@ private void processBuild( AbstractBuild<?, ?> build, Launcher launcher, BuildLi
if( treatSuccessful && pstate.doCreateBaseline() ) {

try {
targetbaseline = createBaselineOnSuccess(workspace, pstate, build, currentWorkspace, pstate.getBaseline().getComponent());
action.setCreatedBaseline( targetbaseline );
Baseline succesBaseline = createBaselineOnSuccess(workspace, pstate, build, currentWorkspace, pstate.getBaseline().getComponent());
action.setCreatedBaseline( succesBaseline );

} catch( Exception e ) {
ExceptionUtils.print( e, out, false );
@@ -260,9 +250,6 @@ private void processBuild( AbstractBuild<?, ?> build, Launcher launcher, BuildLi
}
}
}
if( pstate.getPolling().isPollingOther() || pstate.getPolling().isPollingRebase() ) {
targetstream = pstate.getStream();
}

//Complete the rebase
try {
@@ -276,8 +263,8 @@ private void processBuild( AbstractBuild<?, ?> build, Launcher launcher, BuildLi
pstate.setWorkspace( workspace );
NameTemplate.validateTemplates( pstate, build.getWorkspace() );
String name = NameTemplate.parseTemplate( pstate.getNameTemplate(), pstate, build.getWorkspace() );
targetbaseline = RemoteUtil.createRemoteBaseline( currentWorkspace, name, pstate.getStream(), pstate.getViewPath() );
action.setCreatedBaseline( targetbaseline );
Baseline createdRebaseBaseline = RemoteUtil.createRemoteBaseline( currentWorkspace, name, pstate.getStream(), pstate.getViewPath() );
action.setCreatedBaseline( createdRebaseBaseline );
}

} else if ( !treatSuccessful && pstate.getPolling().isPollingRebase()) {
@@ -303,15 +290,13 @@ private void processBuild( AbstractBuild<?, ?> build, Launcher launcher, BuildLi
logger.fine( String.format( "Remote post build step" ) );
out.println( String.format( "%s Performing common post build steps",logShortPrefix ) );

//Do not promote source when polling rebase.
boolean skipPromote = pstate.getPromotionLevel() == null || pstate.getPolling().isPollingRebase();
status = currentWorkspace.act( new RemotePostBuild( buildResult, status, listener, pstate.doMakeTag(), pstate.doRecommend(), pstate.getUnstable(), skipPromote, sourcebaseline, targetbaseline, sourcestream, targetstream, build.getParent().getDisplayName(), Integer.toString( build.getNumber() ), pstate.getRebaseTargets() ) );
status = currentWorkspace.act(pstate.getMode().postBuildFinalizer(build, listener, status));
//status = currentWorkspace.act( new RemotePostBuild( buildResult, status, listener, pstate.doMakeTag(), pstate.doRecommend(), pstate.getUnstable(), skipPromote, sourcebaseline, targetbaseline, sourcestream, targetstream, build.getParent().getDisplayName(), Integer.toString( build.getNumber() ), pstate.getRebaseTargets() ) );
} catch( Exception e ) {
status.setStable( false );
logger.log( Level.WARNING, "", e );
out.println( String.format( "%s Error: Post build failed", logShortPrefix ) );
Throwable cause = net.praqma.util.ExceptionUtils.unpackFrom( IOException.class, e );

ExceptionUtils.print( cause, out, true );
}

@@ -340,7 +325,7 @@ private Baseline createBaselineOnSuccess(String workspace, CCUCMBuildAction psta
targetbaseline = RemoteUtil.createRemoteBaseline( currentWorkspace, name, component, pstate.getViewPath() );
return targetbaseline;
}

/**
* This class is used by Hudson to define the plugin.
*
@@ -0,0 +1,14 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.praqma.hudson.notifier;

/**
*
* @author Mads
*/
public class PollOthersRemotePostBuild {

}

0 comments on commit 775c2d3

Please sign in to comment.
You can’t perform that action at this time.