Skip to content
Permalink
Browse files

fixed JENKINS-24286

  • Loading branch information...
Andrius Ordojan
Andrius Ordojan committed Aug 18, 2014
1 parent ea3e467 commit dce9194b690213304c70be212a7fc7c2e30c6854
@@ -1,5 +1,7 @@
package org.jenkinsci.plugins.pretestedintegration;

import hudson.plugins.git.Branch;
import hudson.plugins.git.util.BuildData;
import org.jenkinsci.plugins.pretestedintegration.exceptions.EstablishWorkspaceException;
import org.jenkinsci.plugins.pretestedintegration.exceptions.IntegationFailedExeception;
import org.jenkinsci.plugins.pretestedintegration.exceptions.NextCommitFailureException;
@@ -160,7 +162,16 @@ public void handlePostBuild( AbstractBuild<?, ?> build, Launcher launcher, Build
Result result = build.getResult();
updateBuildDescription(build, launcher, listener);

BuildData gitBuildData = build.getAction(BuildData.class);
Branch gitDataBranch = gitBuildData.lastBuild.revision.getBranches().iterator().next();
String devBranchName = gitDataBranch.getName();
if (devBranchName.isEmpty() || devBranchName.contains("master")) {
listener.getLogger().println(LOG_PREFIX + "Using the master branch for development is not allowed.");
build.setResult(Result.FAILURE);
}

if (result != null && result.isBetterOrEqualTo(getRequiredResult())) {

listener.getLogger().println(LOG_PREFIX + "Commiting changes");
commit(build, launcher, listener);
listener.getLogger().println(LOG_PREFIX + "Deleting development branch");
@@ -40,10 +40,13 @@ public boolean needsToRunAfterFinalized() {
*/
@Override
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) {
listener.getLogger().println("Performing pre-verified post build steps");
PretestedIntegrationAction action = build.getAction(PretestedIntegrationAction.class);
if (action == null)
return true;

listener.getLogger().println("Performing pre-verified post build steps");
Boolean result = false;

try {
result = action.finalise(launcher, listener);
} catch (NullPointerException e) {

0 comments on commit dce9194

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