4 * This file is part of the TYPO3 CMS project.
6 * It is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License, either version 2
8 * of the License, or any later version.
10 * For the full copyright and license information, please read the
11 * LICENSE.txt file that was distributed with this source code.
13 * The TYPO3 project - inspiring people to share!
16 import java
.util
.ArrayList
;
18 import com
.atlassian
.bamboo
.specs
.api
.BambooSpec
;
19 import com
.atlassian
.bamboo
.specs
.api
.builders
.AtlassianModule
;
20 import com
.atlassian
.bamboo
.specs
.api
.builders
.BambooKey
;
21 import com
.atlassian
.bamboo
.specs
.api
.builders
.Variable
;
22 import com
.atlassian
.bamboo
.specs
.api
.builders
.notification
.AnyNotificationRecipient
;
23 import com
.atlassian
.bamboo
.specs
.api
.builders
.notification
.Notification
;
24 import com
.atlassian
.bamboo
.specs
.api
.builders
.plan
.Job
;
25 import com
.atlassian
.bamboo
.specs
.api
.builders
.plan
.Plan
;
26 import com
.atlassian
.bamboo
.specs
.api
.builders
.plan
.Stage
;
27 import com
.atlassian
.bamboo
.specs
.api
.builders
.plan
.branches
.BranchCleanup
;
28 import com
.atlassian
.bamboo
.specs
.api
.builders
.plan
.branches
.PlanBranchManagement
;
29 import com
.atlassian
.bamboo
.specs
.api
.builders
.plan
.configuration
.AllOtherPluginsConfiguration
;
30 import com
.atlassian
.bamboo
.specs
.api
.builders
.project
.Project
;
31 import com
.atlassian
.bamboo
.specs
.api
.builders
.requirement
.Requirement
;
32 import com
.atlassian
.bamboo
.specs
.builders
.notification
.PlanCompletedNotification
;
33 import com
.atlassian
.bamboo
.specs
.builders
.task
.ScriptTask
;
34 import com
.atlassian
.bamboo
.specs
.builders
.trigger
.RemoteTrigger
;
35 import com
.atlassian
.bamboo
.specs
.builders
.trigger
.RepositoryPollingTrigger
;
36 import com
.atlassian
.bamboo
.specs
.model
.task
.ScriptTaskProperties
;
37 import com
.atlassian
.bamboo
.specs
.util
.BambooServer
;
38 import com
.atlassian
.bamboo
.specs
.util
.MapBuilder
;
41 * Core 8.7 pre-merge test plan.
44 public class PreMergeSpec
extends AbstractCoreSpec
{
46 protected static String planName
= "Core 8.7 pre-merge";
47 protected static String planKey
= "GTC87";
49 protected int numberOfAcceptanceTestJobs
= 8;
50 protected int numberOfFunctionalMysqlJobs
= 10;
51 protected int numberOfFunctionalMssqlJobs
= 10;
52 protected int numberOfFunctionalPgsqlJobs
= 10;
53 protected int numberOfUnitRandomOrderJobs
= 2;
56 * Run main to publish plan on Bamboo
58 public static void main(final String
[] args
) throws Exception
{
59 // By default credentials are read from the '.credentials' file.
60 BambooServer bambooServer
= new BambooServer(bambooServerName
);
61 bambooServer
.publish(new PreMergeSpec().createPlan());
62 bambooServer
.publish(new PreMergeSpec().getDefaultPlanPermissions(projectKey
, planKey
));
66 * Core 8.7 pre-merge plan is in "TYPO3 core" project of bamboo
69 return new Project().name(projectName
).key(projectKey
);
73 * Returns full Plan definition
77 ArrayList
<Job
> jobsPreparationStage
= new ArrayList
<Job
>();
79 jobsPreparationStage
.add(this.getJobBuildLabels());
81 jobsPreparationStage
.add(this.getJobCglCheckGitCommit());
83 jobsPreparationStage
.add(this.getJobComposerValidate());
85 Stage stagePreparation
= new Stage("Preparation")
86 .jobs(jobsPreparationStage
.toArray(new Job
[jobsPreparationStage
.size()]));
89 ArrayList
<Job
> jobsMainStage
= new ArrayList
<Job
>();
91 jobsMainStage
.add(this.getJobAcceptanceTestInstallMysql(this.getRequirementPhpVersion70Or71(), "PHP7071"));
92 jobsMainStage
.add(this.getJobAcceptanceTestInstallPgsql(this.getRequirementPhpVersion70Or71(), "PHP7071"));
94 jobsMainStage
.addAll(this.getJobsAcceptanceTestsMysql(this.numberOfAcceptanceTestJobs
, this.getRequirementPhpVersion70Or71(), "PHP7071"));
96 jobsMainStage
.add(this.getJobIntegrationVarious());
98 jobsMainStage
.addAll(this.getJobsFunctionalTestsMysql(this.numberOfFunctionalMysqlJobs
, this.getRequirementPhpVersion70Or71(), "PHP7071"));
100 jobsMainStage
.addAll(this.getJobsFunctionalTestsMssql(this.numberOfFunctionalMssqlJobs
, this.getRequirementPhpVersion70Or71(), "PHP7071"));
102 jobsMainStage
.addAll(this.getJobsFunctionalTestsPgsql(this.numberOfFunctionalPgsqlJobs
, this.getRequirementPhpVersion70Or71(), "PHP7071"));
104 jobsMainStage
.add(this.getJobUnitJavaScript());
106 jobsMainStage
.add(this.getJobLintPhp(this.getRequirementPhpVersion70(), "PHP70"));
107 jobsMainStage
.add(this.getJobLintPhp(this.getRequirementPhpVersion71(), "PHP71"));
109 jobsMainStage
.add(this.getJobLintScssTs());
111 jobsMainStage
.add(this.getJobUnitPhp(this.getRequirementPhpVersion70(), "PHP70"));
112 jobsMainStage
.add(this.getJobUnitPhp(this.getRequirementPhpVersion71(), "PHP71"));
114 jobsMainStage
.addAll(this.getJobUnitPhpRandom(this.numberOfUnitRandomOrderJobs
, this.getRequirementPhpVersion70(), "PHP70"));
115 jobsMainStage
.addAll(this.getJobUnitPhpRandom(this.numberOfUnitRandomOrderJobs
, this.getRequirementPhpVersion71(), "PHP71"));
117 Stage stageMainStage
= new Stage("Main stage")
118 .jobs(jobsMainStage
.toArray(new Job
[jobsMainStage
.size()]));
121 return new Plan(project(), planName
, planKey
)
122 .description("Execute TYPO3 core 8.7 pre-merge tests. Auto generated! See Build/bamboo of core git repository.")
123 .pluginConfigurations(this.getDefaultPlanPluginConfiguration())
128 .linkedRepositories("git.typo3.org Core 8.7")
130 new RepositoryPollingTrigger()
131 .name("Repository polling for post-merge builds"),
133 .name("Remote trigger for pre-merge builds")
134 .description("Gerrit")
135 .triggerIPAddresses("5.10.165.218,91.184.35.13"))
137 new Variable("changeUrl", ""),
138 new Variable("patchset", "")
140 .planBranchManagement(
141 new PlanBranchManagement()
142 .delete(new BranchCleanup())
143 .notificationForCommitters()
145 .notifications(new Notification()
146 .type(new PlanCompletedNotification())
147 .recipients(new AnyNotificationRecipient(new AtlassianModule("com.atlassian.bamboo.plugins.bamboo-slack:recipient.slack"))
148 .recipientString("https://intercept.typo3.com/index.php")
154 * Job creating labels needed for intercept communication
156 protected Job
getJobBuildLabels() {
157 return new Job("Create build labels", new BambooKey("CLFB"))
158 .description("Create changeId and patch set labels from variable access and parsing result of a dummy task")
159 .pluginConfigurations(new AllOtherPluginsConfiguration()
160 .configuration(new MapBuilder()
161 .put("repositoryDefiningWorkingDirectory", -1)
162 .put("custom", new MapBuilder()
163 .put("auto", new MapBuilder()
164 .put("regex", "https:\\/\\/review\\.typo3\\.org\\/(#\\/c\\/)?(\\d+)")
165 .put("label", "change-\\2\\, patchset-${bamboo.patchset}")
168 .put("buildHangingConfig.enabled", "false")
169 .put("ncover.path", "")
170 .put("clover", new MapBuilder()
173 .put("useLocalLicenseKey", "true")
183 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
184 .inlineBody("echo \"I'm just here for the labels!\"")
186 .cleanWorkingDirectory(true
);
190 * Job checking CGL of last git commit
192 protected Job
getJobCglCheckGitCommit() {
193 return new Job("Integration CGL", new BambooKey("CGLCHECK"))
194 .description("Check coding guidelines by executing Build/Scripts/cglFixMyCommit.sh script")
195 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
197 this.getTaskGitCloneRepository(),
198 this.getTaskGitCherryPick(),
199 this.getTaskComposerInstall(),
201 .description("Execute cgl check script")
202 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
204 this.getScriptTaskBashInlineBody() +
205 "./Build/Scripts/cglFixMyCommit.sh dryrun\n"
209 new Requirement("system.phpVersion")
210 .matchValue("7\\.0|7\\.1")
211 .matchType(Requirement
.MatchType
.MATCHES
)
213 .cleanWorkingDirectory(true
);