From 8539a3157823f82df479bf3b5a2a19929f4a4a9b Mon Sep 17 00:00:00 2001
From: Christian Kuhn <lolli@schwarzbu.ch>
Date: Wed, 4 Oct 2017 23:02:31 +0200
Subject: [PATCH] [TASK] bamboo-specs: Upgrade to 6.1

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/54294
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                          |   2 +-
 .../src/main/java/core/AbstractCoreSpec.java  | 127 ++++++++++++++++--
 .../src/main/java/core/NightlySpec.java       |  18 ++-
 .../src/main/java/core/PreMergeSpec.java      |  59 ++++++--
 4 files changed, 181 insertions(+), 25 deletions(-)

diff --git a/Build/bamboo/pom.xml b/Build/bamboo/pom.xml
index a47fdddf8b99..30c3f14a8299 100644
--- a/Build/bamboo/pom.xml
+++ b/Build/bamboo/pom.xml
@@ -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>
 
diff --git a/Build/bamboo/src/main/java/core/AbstractCoreSpec.java b/Build/bamboo/src/main/java/core/AbstractCoreSpec.java
index b4c073dec89b..55c9d1478a77 100644
--- a/Build/bamboo/src/main/java/core/AbstractCoreSpec.java
+++ b/Build/bamboo/src/main/java/core/AbstractCoreSpec.java
@@ -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=9.0.0";
 
     protected String testingFrameworkBuildPath = "vendor/typo3/testing-framework/Resources/Core/Build/";
@@ -62,12 +73,84 @@ abstract public class AbstractCoreSpec {
         " typo3DatabaseHost=\"localhost\"" +
         " 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(),
@@ -390,7 +490,8 @@ abstract public class AbstractCoreSpec {
                 new Requirement("system.phpVersion")
                     .matchValue("7\\.0|7\\.1")
                     .matchType(Requirement.MatchType.MATCHES)
-            );
+            )
+            .cleanWorkingDirectory(true);
     }
 
     /**
@@ -399,6 +500,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(),
@@ -431,7 +533,8 @@ abstract public class AbstractCoreSpec {
                     .copyPattern("**/*.*")
                     .location("Build/target/site/clover")
                     .shared(false)
-            );
+            )
+            .cleanWorkingDirectory(true);
     }
 
     /**
@@ -443,6 +546,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(),
@@ -456,7 +560,8 @@ abstract public class AbstractCoreSpec {
             )
             .requirements(
                 requirement
-            );
+            )
+            .cleanWorkingDirectory(true);
     }
 
     /**
@@ -465,6 +570,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(),
@@ -481,7 +587,8 @@ abstract public class AbstractCoreSpec {
             )
             .requirements(
                 new Requirement("system.imageVersion")
-            );
+            )
+            .cleanWorkingDirectory(true);
     }
 
     /**
@@ -493,6 +600,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(),
@@ -512,7 +620,8 @@ abstract public class AbstractCoreSpec {
             )
             .requirements(
                 requirement
-            );
+            )
+            .cleanWorkingDirectory(true);
     }
 
     /**
@@ -528,6 +637,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(),
@@ -548,6 +658,7 @@ abstract public class AbstractCoreSpec {
                 .requirements(
                     requirement
                 )
+                .cleanWorkingDirectory(true)
             );
         }
 
diff --git a/Build/bamboo/src/main/java/core/NightlySpec.java b/Build/bamboo/src/main/java/core/NightlySpec.java
index 7d2f2bd98570..b334bc9c1f2e 100644
--- a/Build/bamboo/src/main/java/core/NightlySpec.java
+++ b/Build/bamboo/src/main/java/core/NightlySpec.java
@@ -35,6 +35,9 @@ import com.atlassian.bamboo.specs.util.BambooServer;
 @BambooSpec
 public class NightlySpec extends AbstractCoreSpec {
 
+    protected static String planName = "Core master nightly";
+    protected static String planKey = "GTN";
+
     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 master 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 master nightly", "GTN")
+        return new Plan(project(), planName, planKey)
             .description("Execute TYPO3 core master 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);
     }
 }
diff --git a/Build/bamboo/src/main/java/core/PreMergeSpec.java b/Build/bamboo/src/main/java/core/PreMergeSpec.java
index 2ad9c041752d..3b76ced74504 100644
--- a/Build/bamboo/src/main/java/core/PreMergeSpec.java
+++ b/Build/bamboo/src/main/java/core/PreMergeSpec.java
@@ -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 master 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 master pre-merge";
+    protected static String planKey = "GTC";
+
     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 master 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 master pre-merge", "GTC")
+        return new Plan(project(), planName, planKey)
             .description("Execute TYPO3 core master 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);
     }
 }
-- 
GitLab