Skip to content

Commit

Permalink
Slightly better version of JENKINS-30795, should work in all cases
Browse files Browse the repository at this point in the history
  • Loading branch information
MadsNielsen committed Oct 28, 2015
1 parent bc5d766 commit 332154b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
12 changes: 6 additions & 6 deletions pom.xml
Expand Up @@ -119,7 +119,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javancss-maven-plugin</artifactId>
<version>2.0</version>
<version>2.1</version>
<executions>
<execution>
<phase>package</phase>
Expand All @@ -137,7 +137,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javancss-maven-plugin</artifactId>
<version>2.0</version>
<version>2.1</version>
</plugin>
</plugins>
</reporting>
Expand All @@ -154,7 +154,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javancss-maven-plugin</artifactId>
<version>2.0-beta-2</version>
<version>2.1</version>
</plugin>
</plugins>
</reporting>
Expand Down Expand Up @@ -187,7 +187,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
<version>2.17</version>
<configuration>
<enableRulesSummary>false</enableRulesSummary>
</configuration>
Expand Down Expand Up @@ -387,8 +387,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>

Expand Down
19 changes: 16 additions & 3 deletions src/main/java/net/praqma/hudson/scm/CCUCMScm.java
Expand Up @@ -29,6 +29,7 @@
import net.praqma.clearcase.exceptions.DeliverException;
import net.praqma.clearcase.exceptions.DeliverException.Type;
import net.praqma.clearcase.exceptions.UnableToInitializeEntityException;
import net.praqma.clearcase.exceptions.UnableToLoadEntityException;
import net.praqma.clearcase.ucm.entities.*;
import net.praqma.clearcase.ucm.entities.Project;
import net.praqma.clearcase.ucm.view.SnapshotView;
Expand Down Expand Up @@ -277,10 +278,22 @@ public boolean checkout(AbstractBuild<?, ?> build, Launcher launcher, FilePath w
} catch (CCUCMException e) {

logger.warning(e.getMessage());
/* If the promotion level is not set, ANY, use the last found Baseline, or the manual build was triggered */
if (mode.getPromotionLevel() == null || build.getCause(UserIdCause.class) != null) {
CCUCMBuildAction last = getLastAction(build.getProject());
Baseline updated = null;
if(last != null) {
try {
updated = Baseline.get(last.getBaseline().getFullyQualifiedName()).load(true);
} catch (UnableToInitializeEntityException | UnableToLoadEntityException ex) {
logger.log(Level.WARNING, "Unable to reload previous baseline", ex);
}
}

/*
If the promotion level is not set, ANY, use the last found Baseline. Alternatively, if the baseline that was last built has not been altered (Rejected/Promoted)
the we assume we can safely do the same again.
*/
if (mode.getPromotionLevel() == null || (updated != null && mode.getPromotionLevel().equals(updated.getPromotionLevel()))) {
logger.fine("Configured to use the latest always.");
CCUCMBuildAction last = getLastAction(build.getProject());
if (last != null) {
action.setBaseline(last.getBaseline());
} else {
Expand Down

0 comments on commit 332154b

Please sign in to comment.