Skip to content

Commit

Permalink
[fixed JENKINS-14746] Ensure publisher + test
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgarnet committed Mar 22, 2013
1 parent 9ea21da commit 15ad9e5
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 39 deletions.
Expand Up @@ -142,7 +142,7 @@ public boolean checkout( AbstractBuild<?, ?> build, Launcher launcher, FilePath
}



ensurePublisher( build );
boolean performResult = false;
try {
performResult = acrs.perform( build, launcher, workspace, listener, reconfigure );
Expand Down Expand Up @@ -171,24 +171,18 @@ public boolean checkout( AbstractBuild<?, ?> build, Launcher launcher, FilePath
justConfigured = false;
build.getProject().save();

/*
* If not aborted, add publisher
*/
boolean added = false;
for( Publisher p : build.getParent().getPublishersList() ) {
if( p instanceof ConfigurationRotatorPublisher ) {
added = true;
break;
}
}
if( !added ) {
build.getProject().getPublishersList().add( new ConfigurationRotatorPublisher() );
}

return true;
}
}

public void ensurePublisher( AbstractBuild build ) throws IOException {
Describable describable = build.getProject().getPublishersList().get( ConfigurationRotatorPublisher.class );
if( describable == null ) {
logger.info( "Adding publisher to project" );
build.getProject().getPublishersList().add( new ConfigurationRotatorPublisher() );
}
}

public void setConfigurationByAction( AbstractProject<?, ?> project, ConfigurationRotatorBuildAction action ) throws IOException {
acrs.setConfigurationByAction( project, action );
reconfigure = true;
Expand Down
Expand Up @@ -57,7 +57,8 @@ public boolean perform( AbstractBuild<?, ?> build, Launcher launcher, BuildListe
return AbstractPostConfigurationRotator.doit( build.getWorkspace(), listener, action );

} else {
out.println( ConfigurationRotator.LOGGERNAME + "Action was null, unable to set compatability of configuration" );
out.println( ConfigurationRotator.LOGGERNAME + "Action was null, unable to set compatibility of configuration" );
hadNothingToDo( build );
}
} else {
out.println( ConfigurationRotator.LOGGERNAME + "SCM not part of ConfigRotator" );
Expand All @@ -66,6 +67,17 @@ public boolean perform( AbstractBuild<?, ?> build, Launcher launcher, BuildListe
return true;
}

public void hadNothingToDo( AbstractBuild build ) throws IOException {
String d = build.getDescription();
if( d != null ) {
build.setDescription( ( d.length() > 0 ? d + "<br/>" : "" ) + "Nothing to do" );
} else {
build.setDescription( "Nothing to do" );
}

build.setResult( Result.NOT_BUILT );
}

@Override
public boolean needsToRunAfterFinalized() {
return false;
Expand Down
Expand Up @@ -50,7 +50,6 @@ public class ClearCaseUCM extends AbstractConfigurationRotatorSCM implements Ser
*
* Parse config
* Each line represents a {@link Component}, {@link Stream}, {@link Baseline} and a {@Plevel plevel}
* @param config
*/
@DataBoundConstructor
public ClearCaseUCM( String pvobName ) {
Expand Down Expand Up @@ -230,7 +229,6 @@ public void printConfiguration( PrintStream out, AbstractConfiguration cfg ) {
* exists. The checks is done only with regards to configuration rotation, eg.
* not using the same component twice.
* 1) is a Clear Case UCM component used more than once in the configuration?
* @param out is the console log
* @param cfg config rotator configuration
* @throws AbortException
*/
Expand Down
43 changes: 22 additions & 21 deletions src/test/resources/setup.xml
@@ -1,12 +1,13 @@
<ccenv>
<var name="pvobname" value="cc12_PVOB" />
<var name="vobname" value="cc12" />
<ccenv name="Basic">
<var name="name" value="crot" />
<var name="pvobname" value="${name}_PVOB" />
<var name="vobname" value="${name}" />

<vob tag="${pvobname}" comment="PVOB" ucmproject="true" stgloc="-auto" mounted="true"/>
<vob tag="${vobname}" stgloc="-auto" mounted="true"/>
<!-- <hlink name="AdminVOB" from="vob:cc1" to="vob:${pvobname}" /> -->
<view tag="${vobname}_setupview" stgloc="-auto"/>
<context mvfs="m:\" view="${vobname}_setupview" vob="${vobname}"/>
<vob storetag="pvobname" tag="\${pvobname}" linuxtag="/vobs/${pvobname}" comment="PVOB" ucmproject="true" stgloc="-auto" mounted="true"/>
<vob storetag="vobname" tag="\${vobname}" linuxtag="/vobs/${vobname}" stgloc="-auto" mounted="true"/>

<view tag="${name}_setupview" stgloc="-auto"/>
<context mvfs="m:\" linux="/view" view="${name}_setupview" vob="${vobname}"/>

<component root="" comment="" name="_System" pvob="${pvobname}" />
<component root="" comment="" name="_Server" pvob="${pvobname}" />
Expand All @@ -15,9 +16,9 @@
<component root="Model" comment="" name="Model" pvob="${pvobname}" />
<component root="Clientapp" comment="" name="Clientapp" pvob="${pvobname}" />

<folder name="${vobname}" in="RootFolder" pvob="${pvobname}" />
<folder name="one_folder" in="RootFolder" pvob="${pvobname}" />

<project name="${vobname}_bootstrap" comment="" model="SIMPLE" pvob="${pvobname}" in="${vobname}">
<project name="bootstrap" comment="" model="SIMPLE" pvob="${pvobname}" in="one_folder">
<components>
<component name="Service" pvob="${pvobname}" />
<component name="Model" pvob="${pvobname}" />
Expand All @@ -28,7 +29,7 @@
</policies>
</project>

<stream name="${vobname}_bootstrap_int" in="${vobname}_bootstrap" comment="" pvob="${pvobname}" type="integration">
<stream name="bootstrap_int" in="bootstrap" comment="" pvob="${pvobname}" type="integration">
<baselines>
<baseline name="_System_INITIAL" pvob="${pvobname}" />
<baseline name="_Server_INITIAL" pvob="${pvobname}" />
Expand All @@ -39,11 +40,11 @@
</baselines>
</stream>

<view tag="${vobname}_bootstrap_int" stgloc="-auto">
<stream name="${vobname}_bootstrap_int" pvob="${pvobname}" />
<view tag="${name}_bootstrap_int" stgloc="-auto">
<stream name="bootstrap_int" pvob="${pvobname}" />
</view>

<context mvfs="m:\" view="${vobname}_bootstrap_int" vob="${vobname}"/>
<context mvfs="m:\" linux="/view" view="${name}_bootstrap_int" vob="${vobname}"/>

<baseline name="_Server_1.0" label="none" comment="" component="_Server" pvob="${pvobname}">
<dependencies>
Expand All @@ -67,7 +68,7 @@
</baseline>


<project name="${vobname}_one" comment="" pvob="${pvobname}" in="${vobname}">
<project name="one" comment="" pvob="${pvobname}" in="one_folder">
<components>
<component name="Service" pvob="${pvobname}" />
<component name="Model" pvob="${pvobname}" />
Expand All @@ -78,13 +79,13 @@
</policies>
</project>

<stream name="${vobname}_one_int" in="${vobname}_one" comment="" pvob="${pvobname}" type="integration">
<stream name="one_int" in="one" comment="" pvob="${pvobname}" type="integration">
<baselines>
<baseline name="_System_1.0" pvob="${pvobname}" />
</baselines>
</stream>

<project name="jenkins" comment="" pvob="${pvobname}" in="${vobname}">
<project name="jenkins" comment="" pvob="${pvobname}" in="one_folder">
<policies>
<policy>POLICY_INTERPROJECT_DELIVER</policy>
</policies>
Expand All @@ -93,13 +94,13 @@
<stream name="jenkins_int" in="jenkins" comment="" pvob="${pvobname}" type="integration">
</stream>

<view tag="${vobname}_one_int" stgloc="-auto">
<stream name="${vobname}_one_int" pvob="${pvobname}" />
<view tag="${name}_one_int" stgloc="-auto">
<stream name="one_int" pvob="${pvobname}" />
</view>

<context mvfs="m:\" view="${vobname}_one_int" vob="${vobname}"/>
<context mvfs="m:\" linux="/view" view="${name}_one_int" vob="${vobname}"/>

<activity comment="" headline="Adding initial files into components" in="${vobname}_one_int" name="initial_files" pvob="${pvobname}" />
<activity comment="" headline="Adding initial files into components" in="one_int" name="initial_files" pvob="${pvobname}" />

<setactivity activity="initial_files" pvob="${pvobname}" />

Expand Down

0 comments on commit 15ad9e5

Please sign in to comment.