[TASK] bamboo-specs: Upgrade to 6.1 95/54295/5
authorChristian Kuhn <lolli@schwarzbu.ch>
Wed, 4 Oct 2017 21:02:31 +0000 (23:02 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 5 Oct 2017 09:45:59 +0000 (11:45 +0200)
The 6.0 to 6.1 upgrade allows us to specifiy last missing
pieces via bamboo specs: mostly job cleanups, plugin
configuration and plan permissions.

Change-Id: If26aeb45b1109ba9797f3807087201033ea1f368
Resolves: #82679
Releases: master, 8.7, 7.6
Reviewed-on: https://review.typo3.org/54295
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Build/bamboo/pom.xml
Build/bamboo/src/main/java/core/AbstractCoreSpec.java
Build/bamboo/src/main/java/core/NightlySpec.java
Build/bamboo/src/main/java/core/PreMergeSpec.java

index a47fddd..30c3f14 100644 (file)
@@ -5,7 +5,7 @@
   <parent>
     <groupId>com.atlassian.bamboo</groupId>
     <artifactId>bamboo-specs-parent</artifactId>
-    <version>6.0.2</version>
+    <version>6.1.0</version>
     <relativePath/>
   </parent>
 
index 8991020..f990b80 100644 (file)
@@ -16,8 +16,14 @@ package core;
 import java.util.ArrayList;
 
 import com.atlassian.bamboo.specs.api.builders.BambooKey;
+import com.atlassian.bamboo.specs.api.builders.permission.PermissionType;
+import com.atlassian.bamboo.specs.api.builders.permission.Permissions;
+import com.atlassian.bamboo.specs.api.builders.permission.PlanPermissions;
 import com.atlassian.bamboo.specs.api.builders.plan.Job;
+import com.atlassian.bamboo.specs.api.builders.plan.PlanIdentifier;
 import com.atlassian.bamboo.specs.api.builders.plan.artifact.Artifact;
+import com.atlassian.bamboo.specs.api.builders.plan.configuration.AllOtherPluginsConfiguration;
+import com.atlassian.bamboo.specs.api.builders.plan.configuration.PluginConfiguration;
 import com.atlassian.bamboo.specs.api.builders.requirement.Requirement;
 import com.atlassian.bamboo.specs.api.builders.task.Task;
 import com.atlassian.bamboo.specs.builders.task.CheckoutItem;
@@ -28,12 +34,17 @@ import com.atlassian.bamboo.specs.builders.task.TestParserTask;
 import com.atlassian.bamboo.specs.builders.task.VcsCheckoutTask;
 import com.atlassian.bamboo.specs.model.task.ScriptTaskProperties;
 import com.atlassian.bamboo.specs.model.task.TestParserTaskProperties;
+import com.atlassian.bamboo.specs.util.MapBuilder;
 
 /**
  * Abstract class with common methods of pre-merge and nightly plan
  */
 abstract public class AbstractCoreSpec {
 
+    protected static String bambooServerName = "https://bamboo.typo3.com:443";
+    protected static String projectName = "TYPO3 Core";
+    protected static String projectKey = "CORE";
+
     protected String composerRootVersionEnvironment = "COMPOSER_ROOT_VERSION=8.7.0";
 
     protected String testingFrameworkBuildPath = "vendor/typo3/testing-framework/Resources/Core/Build/";
@@ -63,11 +74,83 @@ abstract public class AbstractCoreSpec {
         " typo3InstallToolPassword=\"klaus\"";
 
     /**
+     * Default permissions on core plans
+     *
+     * @param projectName
+     * @param planName
+     * @return
+     */
+    protected PlanPermissions getDefaultPlanPermissions(String projectKey, String planKey) {
+        return new PlanPermissions(new PlanIdentifier(projectKey, planKey))
+            .permissions(new Permissions()
+            .groupPermissions("TYPO3 GmbH", PermissionType.ADMIN, PermissionType.VIEW, PermissionType.EDIT, PermissionType.BUILD, PermissionType.CLONE)
+            .groupPermissions("TYPO3 Core Team", PermissionType.VIEW, PermissionType.BUILD)
+            .loggedInUserPermissions(PermissionType.VIEW)
+            .anonymousUserPermissionView()
+        );
+    }
+
+    /**
+     * Default plan plugin configuration
+     *
+     * @return
+     */
+    protected PluginConfiguration getDefaultPlanPluginConfiguration() {
+        return new AllOtherPluginsConfiguration()
+            .configuration(new MapBuilder()
+            .put("custom", new MapBuilder()
+                .put("artifactHandlers.useCustomArtifactHandlers", "false")
+                .put("buildExpiryConfig", new MapBuilder()
+                    .put("duration", "30")
+                    .put("period", "days")
+                    .put("labelsToKeep", "")
+                    .put("expiryTypeResult", "true")
+                    .put("buildsToKeep", "")
+                    .put("enabled", "true")
+                    .build()
+                )
+                .build()
+            )
+            .build()
+        );
+    }
+
+    /**
+     * Default job plugin configuration
+     *
+     * @return
+     */
+    protected PluginConfiguration getDefaultJobPluginConfiguration() {
+        return new AllOtherPluginsConfiguration()
+            .configuration(new MapBuilder()
+                .put("repositoryDefiningWorkingDirectory", -1)
+                .put("custom", new MapBuilder()
+                    .put("auto", new MapBuilder()
+                        .put("regex", "")
+                        .put("label", "")
+                        .build()
+                    )
+                    .put("buildHangingConfig.enabled", "false")
+                    .put("ncover.path", "")
+                    .put("clover", new MapBuilder()
+                        .put("path", "")
+                        .put("license", "")
+                        .put("useLocalLicenseKey", "true")
+                        .build()
+                    )
+                    .build()
+                )
+                .build()
+            );
+    }
+
+    /**
      * Job composer validate
      */
     protected Job getJobComposerValidate() {
         return new Job("Validate composer.json", new BambooKey("VC"))
         .description("Validate composer.json before actual tests are executed")
+        .pluginConfigurations(this.getDefaultJobPluginConfiguration())
         .tasks(
             this.getTaskGitCloneRepository(),
             this.getTaskGitCherryPick(),
@@ -75,7 +158,8 @@ abstract public class AbstractCoreSpec {
                 .description("composer validate")
                 .executable("composer").argument("validate")
                 .environmentVariables(this.composerRootVersionEnvironment)
-        );
+        )
+        .cleanWorkingDirectory(true);
     }
 
     /**
@@ -87,6 +171,7 @@ abstract public class AbstractCoreSpec {
     protected Job getJobAcceptanceTestInstallMysql(Requirement requirement, String requirementIdentifier) {
         return new Job("Accept inst my " + requirementIdentifier, new BambooKey("ACINSTMY" + requirementIdentifier))
             .description("Install TYPO3 on mysql and create empty frontend page " + requirementIdentifier)
+            .pluginConfigurations(this.getDefaultJobPluginConfiguration())
             .tasks(
                 this.getTaskGitCloneRepository(),
                 this.getTaskGitCherryPick(),
@@ -110,7 +195,9 @@ abstract public class AbstractCoreSpec {
             .artifacts(new Artifact()
                 .name("Test Report")
                 .copyPattern("typo3temp/var/tests/AcceptanceReportsInstallMysql/")
-                .shared(false));
+                .shared(false)
+            )
+            .cleanWorkingDirectory(true);
     }
 
     /**
@@ -122,6 +209,7 @@ abstract public class AbstractCoreSpec {
     protected Job getJobAcceptanceTestInstallPgsql(Requirement requirement, String requirementIdentifier) {
         return new Job("Accept inst pg " + requirementIdentifier, new BambooKey("ACINSTPG" + requirementIdentifier))
         .description("Install TYPO3 on pgsql and load introduction package " + requirementIdentifier)
+        .pluginConfigurations(this.getDefaultJobPluginConfiguration())
         .tasks(
             this.getTaskGitCloneRepository(),
             this.getTaskGitCherryPick(),
@@ -145,7 +233,9 @@ abstract public class AbstractCoreSpec {
         .artifacts(new Artifact()
             .name("Test Report")
             .copyPattern("typo3temp/var/tests/AcceptanceReportsInstallPgsql/")
-            .shared(false));
+            .shared(false)
+        )
+        .cleanWorkingDirectory(true);
     }
 
     /**
@@ -161,6 +251,7 @@ abstract public class AbstractCoreSpec {
         for (int i=1; i<=numberOfChunks; i++) {
             jobs.add(new Job("Accept my " + requirementIdentifier + " 0" + i, new BambooKey("ACMY" + requirementIdentifier + "0" + i))
                 .description("Run acceptance tests" + requirementIdentifier)
+                .pluginConfigurations(this.getDefaultJobPluginConfiguration())
                 .tasks(
                     this.getTaskGitCloneRepository(),
                     this.getTaskGitCherryPick(),
@@ -193,6 +284,7 @@ abstract public class AbstractCoreSpec {
                     .copyPattern("typo3temp/var/tests/AcceptanceReports/")
                     .shared(false)
                 )
+                .cleanWorkingDirectory(true)
             );
         }
 
@@ -212,6 +304,7 @@ abstract public class AbstractCoreSpec {
         for (int i=0; i<numberOfChunks; i++) {
             jobs.add(new Job("Func mysql " + requirementIdentifier + " 0" + i, new BambooKey("FMY" + requirementIdentifier + "0" + i))
                 .description("Run functional tests on mysql DB " + requirementIdentifier)
+                .pluginConfigurations(this.getDefaultJobPluginConfiguration())
                 .tasks(
                     this.getTaskGitCloneRepository(),
                     this.getTaskGitCherryPick(),
@@ -234,6 +327,7 @@ abstract public class AbstractCoreSpec {
                 .requirements(
                     requirement
                 )
+                .cleanWorkingDirectory(true)
             );
         }
 
@@ -253,6 +347,7 @@ abstract public class AbstractCoreSpec {
         for (int i=0; i<numberOfChunks; i++) {
             jobs.add(new Job("Func mssql " + requirementIdentifier + " 0" + i, new BambooKey("FMS" + requirementIdentifier + "0" + i))
                 .description("Run functional tests on mysql DB " + requirementIdentifier)
+                .pluginConfigurations(this.getDefaultJobPluginConfiguration())
                 .tasks(
                     this.getTaskGitCloneRepository(),
                     this.getTaskGitCherryPick(),
@@ -275,6 +370,8 @@ abstract public class AbstractCoreSpec {
                 .requirements(
                     requirement
                 )
+                .cleanWorkingDirectory(true)
+                .enabled(false)
             );
         }
 
@@ -294,6 +391,7 @@ abstract public class AbstractCoreSpec {
         for (int i=0; i<numberOfChunks; i++) {
             jobs.add(new Job("Func pgsql " + requirementIdentifier + " 0" + i, new BambooKey("FPG" + requirementIdentifier + "0" + i))
                 .description("Run functional tests on pgsql DB " + requirementIdentifier)
+                .pluginConfigurations(this.getDefaultJobPluginConfiguration())
                 .tasks(
                     this.getTaskGitCloneRepository(),
                     this.getTaskGitCherryPick(),
@@ -316,6 +414,7 @@ abstract public class AbstractCoreSpec {
                 .requirements(
                     requirement
                 )
+                .cleanWorkingDirectory(true)
             );
         }
 
@@ -329,6 +428,7 @@ abstract public class AbstractCoreSpec {
         // Exception code checker, xlf, permissions, rst file check
         return new Job("Integration various", new BambooKey("CDECC"))
             .description("Checks duplicate exceptions, git submodules, xlf files, permissions, rst")
+            .pluginConfigurations(this.getDefaultJobPluginConfiguration())
             .tasks(
                 this.getTaskGitCloneRepository(),
                 this.getTaskGitCherryPick(),
@@ -377,7 +477,13 @@ abstract public class AbstractCoreSpec {
                         this.getScriptTaskBashInlineBody() +
                         "./Build/Scripts/maxFilePathLength.sh"
                     )
-            );
+            )
+            .requirements(
+                new Requirement("system.phpVersion")
+                    .matchValue("7\\.0|7\\.1")
+                    .matchType(Requirement.MatchType.MATCHES)
+            )
+            .cleanWorkingDirectory(true);
     }
 
     /**
@@ -386,6 +492,7 @@ abstract public class AbstractCoreSpec {
     protected Job getJobUnitJavaScript() {
         return new Job("Unit JavaScript", new BambooKey("JSUT"))
             .description("Run JavaScript unit tests")
+            .pluginConfigurations(this.getDefaultJobPluginConfiguration())
             .tasks(
                 this.getTaskGitCloneRepository(),
                 this.getTaskGitCherryPick(),
@@ -418,7 +525,8 @@ abstract public class AbstractCoreSpec {
                     .copyPattern("**/*.*")
                     .location("Build/target/site/clover")
                     .shared(false)
-            );
+            )
+            .cleanWorkingDirectory(true);
     }
 
     /**
@@ -430,6 +538,7 @@ abstract public class AbstractCoreSpec {
     protected Job getJobLintPhp(Requirement requirement, String requirementIdentifier) {
         return new Job("Lint " + requirementIdentifier, new BambooKey("L" + requirementIdentifier))
             .description("Run php -l on source files for linting " + requirementIdentifier)
+            .pluginConfigurations(this.getDefaultJobPluginConfiguration())
             .tasks(
                 this.getTaskGitCloneRepository(),
                 this.getTaskGitCherryPick(),
@@ -443,7 +552,8 @@ abstract public class AbstractCoreSpec {
             )
             .requirements(
                 requirement
-            );
+            )
+            .cleanWorkingDirectory(true);
     }
 
     /**
@@ -452,6 +562,7 @@ abstract public class AbstractCoreSpec {
     protected Job getJobLintScssTs() {
         return new Job("Lint scss ts", new BambooKey("LSTS"))
             .description("Run npm lint in Build/ dir")
+            .pluginConfigurations(this.getDefaultJobPluginConfiguration())
             .tasks(
                 this.getTaskGitCloneRepository(),
                 this.getTaskGitCherryPick(),
@@ -468,7 +579,8 @@ abstract public class AbstractCoreSpec {
             )
             .requirements(
                 new Requirement("system.imageVersion")
-            );
+            )
+            .cleanWorkingDirectory(true);
     }
 
     /**
@@ -480,6 +592,7 @@ abstract public class AbstractCoreSpec {
     protected Job getJobUnitPhp(Requirement requirement, String requirementIdentifier) {
         return new Job("Unit " + requirementIdentifier, new BambooKey("UT" + requirementIdentifier))
             .description("Run unit tests " + requirementIdentifier)
+            .pluginConfigurations(this.getDefaultJobPluginConfiguration())
             .tasks(
                 this.getTaskGitCloneRepository(),
                 this.getTaskGitCherryPick(),
@@ -499,7 +612,8 @@ abstract public class AbstractCoreSpec {
             )
             .requirements(
                 requirement
-            );
+            )
+            .cleanWorkingDirectory(true);
     }
 
     /**
@@ -515,6 +629,7 @@ abstract public class AbstractCoreSpec {
         for (int i=0; i<numberOfRuns; i++) {
             jobs.add(new Job("Unit " + requirementIdentifier + " random 0" + i, new BambooKey("UTR" + requirementIdentifier + "0" + i))
                 .description("Run unit tests on " + requirementIdentifier + " in random order 0" + i)
+                .pluginConfigurations(this.getDefaultJobPluginConfiguration())
                 .tasks(
                     this.getTaskGitCloneRepository(),
                     this.getTaskGitCherryPick(),
@@ -535,6 +650,7 @@ abstract public class AbstractCoreSpec {
                 .requirements(
                     requirement
                 )
+                .cleanWorkingDirectory(true)
             );
         }
 
index 142360b..e3a96b4 100644 (file)
@@ -35,6 +35,9 @@ import com.atlassian.bamboo.specs.util.BambooServer;
 @BambooSpec
 public class NightlySpec extends AbstractCoreSpec {
 
+    protected static String planName = "Core 8.7 nightly";
+    protected static String planKey = "GTN87";
+
     protected int numberOfAcceptanceTestJobs = 8;
     protected int numberOfFunctionalMysqlJobs = 6;
     protected int numberOfFunctionalMssqlJobs = 6;
@@ -46,16 +49,16 @@ public class NightlySpec extends AbstractCoreSpec {
      */
     public static void main(final String[] args) throws Exception {
         // By default credentials are read from the '.credentials' file.
-        BambooServer bambooServer = new BambooServer("https://bamboo.typo3.com:443");
-        Plan plan = new NightlySpec().createPlan();
-        bambooServer.publish(plan);
+        BambooServer bambooServer = new BambooServer(bambooServerName);
+        bambooServer.publish(new PreMergeSpec().createPlan());
+        bambooServer.publish(new PreMergeSpec().getDefaultPlanPermissions(projectKey, planKey));
     }
 
     /**
      * Core 8.7 pre-merge plan is in "TYPO3 core" project of bamboo
      */
     Project project() {
-        return new Project().name("TYPO3 Core").key("CORE");
+        return new Project().name(projectName).key(projectKey);
     }
 
     /**
@@ -114,8 +117,9 @@ public class NightlySpec extends AbstractCoreSpec {
 
 
         // Compile plan
-        return new Plan(project(), "Core 8.7 nightly", "GTN87")
+        return new Plan(project(), planName, planKey)
             .description("Execute TYPO3 core 8.7 nightly tests. Auto generated! See Build/bamboo of core git repository.")
+            .pluginConfigurations(this.getDefaultPlanPluginConfiguration())
             .stages(
                 stagePreparation,
                 stageMainStage
@@ -145,6 +149,7 @@ public class NightlySpec extends AbstractCoreSpec {
     protected Job getJobCglCheckFullCore() {
         return new Job("Integration CGL", new BambooKey("CGLCHECK"))
             .description("Check coding guidelines of full core")
+            .pluginConfigurations(this.getDefaultJobPluginConfiguration())
             .tasks(
                 this.getTaskGitCloneRepository(),
                 this.getTaskGitCherryPick(),
@@ -161,6 +166,7 @@ public class NightlySpec extends AbstractCoreSpec {
             )
             .requirements(
                 this.getRequirementPhpVersion70Or71()
-            );
+            )
+            .cleanWorkingDirectory(true);
     }
 }
index 973ce32..31c9ab5 100644 (file)
@@ -16,20 +16,26 @@ package core;
 import java.util.ArrayList;
 
 import com.atlassian.bamboo.specs.api.BambooSpec;
+import com.atlassian.bamboo.specs.api.builders.AtlassianModule;
 import com.atlassian.bamboo.specs.api.builders.BambooKey;
 import com.atlassian.bamboo.specs.api.builders.Variable;
+import com.atlassian.bamboo.specs.api.builders.notification.AnyNotificationRecipient;
+import com.atlassian.bamboo.specs.api.builders.notification.Notification;
 import com.atlassian.bamboo.specs.api.builders.plan.Job;
 import com.atlassian.bamboo.specs.api.builders.plan.Plan;
 import com.atlassian.bamboo.specs.api.builders.plan.Stage;
 import com.atlassian.bamboo.specs.api.builders.plan.branches.BranchCleanup;
 import com.atlassian.bamboo.specs.api.builders.plan.branches.PlanBranchManagement;
+import com.atlassian.bamboo.specs.api.builders.plan.configuration.AllOtherPluginsConfiguration;
 import com.atlassian.bamboo.specs.api.builders.project.Project;
 import com.atlassian.bamboo.specs.api.builders.requirement.Requirement;
+import com.atlassian.bamboo.specs.builders.notification.PlanCompletedNotification;
 import com.atlassian.bamboo.specs.builders.task.ScriptTask;
 import com.atlassian.bamboo.specs.builders.trigger.RemoteTrigger;
 import com.atlassian.bamboo.specs.builders.trigger.RepositoryPollingTrigger;
 import com.atlassian.bamboo.specs.model.task.ScriptTaskProperties;
 import com.atlassian.bamboo.specs.util.BambooServer;
+import com.atlassian.bamboo.specs.util.MapBuilder;
 
 /**
  * Core 8.7 pre-merge test plan.
@@ -37,6 +43,9 @@ import com.atlassian.bamboo.specs.util.BambooServer;
 @BambooSpec
 public class PreMergeSpec extends AbstractCoreSpec {
 
+    protected static String planName = "Core 8.7 pre-merge";
+    protected static String planKey = "GTC87";
+
     protected int numberOfAcceptanceTestJobs = 8;
     protected int numberOfFunctionalMysqlJobs = 10;
     protected int numberOfFunctionalMssqlJobs = 10;
@@ -48,16 +57,16 @@ public class PreMergeSpec extends AbstractCoreSpec {
      */
     public static void main(final String[] args) throws Exception {
         // By default credentials are read from the '.credentials' file.
-        BambooServer bambooServer = new BambooServer("https://bamboo.typo3.com:443");
-        Plan plan = new PreMergeSpec().createPlan();
-        bambooServer.publish(plan);
+        BambooServer bambooServer = new BambooServer(bambooServerName);
+        bambooServer.publish(new PreMergeSpec().createPlan());
+        bambooServer.publish(new PreMergeSpec().getDefaultPlanPermissions(projectKey, planKey));
     }
 
     /**
      * Core 8.7 pre-merge plan is in "TYPO3 core" project of bamboo
      */
     Project project() {
-        return new Project().name("TYPO3 Core").key("CORE");
+        return new Project().name(projectName).key(projectKey);
     }
 
     /**
@@ -76,7 +85,6 @@ public class PreMergeSpec extends AbstractCoreSpec {
         Stage stagePreparation = new Stage("Preparation")
             .jobs(jobsPreparationStage.toArray(new Job[jobsPreparationStage.size()]));
 
-
         // MAIN stage
         ArrayList<Job> jobsMainStage = new ArrayList<Job>();
 
@@ -109,10 +117,10 @@ public class PreMergeSpec extends AbstractCoreSpec {
         Stage stageMainStage = new Stage("Main stage")
             .jobs(jobsMainStage.toArray(new Job[jobsMainStage.size()]));
 
-
         // Compile plan
-        return new Plan(project(), "Core 8.7 pre-merge", "GTC87")
+        return new Plan(project(), planName, planKey)
             .description("Execute TYPO3 core 8.7 pre-merge tests. Auto generated! See Build/bamboo of core git repository.")
+            .pluginConfigurations(this.getDefaultPlanPluginConfiguration())
             .stages(
                 stagePreparation,
                 stageMainStage
@@ -133,7 +141,13 @@ public class PreMergeSpec extends AbstractCoreSpec {
                 new PlanBranchManagement()
                     .delete(new BranchCleanup())
                     .notificationForCommitters()
-            );
+            )
+            .notifications(new Notification()
+                .type(new PlanCompletedNotification())
+                .recipients(new AnyNotificationRecipient(new AtlassianModule("com.atlassian.bamboo.plugins.bamboo-slack:recipient.slack"))
+                    .recipientString("https://intercept.typo3.com/index.php")
+                )
+        );
     }
 
     /**
@@ -142,11 +156,34 @@ public class PreMergeSpec extends AbstractCoreSpec {
     protected Job getJobBuildLabels() {
         return new Job("Create build labels", new BambooKey("CLFB"))
             .description("Create changeId and patch set labels from variable access and parsing result of a dummy task")
+            .pluginConfigurations(new AllOtherPluginsConfiguration()
+                .configuration(new MapBuilder()
+                    .put("repositoryDefiningWorkingDirectory", -1)
+                    .put("custom", new MapBuilder()
+                        .put("auto", new MapBuilder()
+                            .put("regex", "https:\\/\\/review\\.typo3\\.org\\/(#\\/c\\/)?(\\d+)")
+                            .put("label", "change-\\2, patchset-${bamboo.patchset}")
+                            .build()
+                        )
+                        .put("buildHangingConfig.enabled", "false")
+                        .put("ncover.path", "")
+                        .put("clover", new MapBuilder()
+                            .put("path", "")
+                            .put("license", "")
+                            .put("useLocalLicenseKey", "true")
+                            .build()
+                        )
+                        .build()
+                    )
+                    .build()
+                )
+            )
             .tasks(
                 new ScriptTask()
                     .interpreter(ScriptTaskProperties.Interpreter.BINSH_OR_CMDEXE)
                     .inlineBody("echo \"I'm just here for the labels!\"")
-            );
+            )
+            .cleanWorkingDirectory(true);
     }
 
     /**
@@ -155,6 +192,7 @@ public class PreMergeSpec extends AbstractCoreSpec {
     protected Job getJobCglCheckGitCommit() {
         return new Job("Integration CGL", new BambooKey("CGLCHECK"))
             .description("Check coding guidelines by executing Build/Scripts/cglFixMyCommit.sh script")
+            .pluginConfigurations(this.getDefaultJobPluginConfiguration())
             .tasks(
                 this.getTaskGitCloneRepository(),
                 this.getTaskGitCherryPick(),
@@ -171,6 +209,7 @@ public class PreMergeSpec extends AbstractCoreSpec {
                 new Requirement("system.phpVersion")
                     .matchValue("7\\.0|7\\.1")
                     .matchType(Requirement.MatchType.MATCHES)
-            );
+            )
+            .cleanWorkingDirectory(true);
     }
 }