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
.builders
.BambooKey
;
19 import com
.atlassian
.bamboo
.specs
.api
.builders
.permission
.PermissionType
;
20 import com
.atlassian
.bamboo
.specs
.api
.builders
.permission
.Permissions
;
21 import com
.atlassian
.bamboo
.specs
.api
.builders
.permission
.PlanPermissions
;
22 import com
.atlassian
.bamboo
.specs
.api
.builders
.plan
.Job
;
23 import com
.atlassian
.bamboo
.specs
.api
.builders
.plan
.PlanIdentifier
;
24 import com
.atlassian
.bamboo
.specs
.api
.builders
.plan
.artifact
.Artifact
;
25 import com
.atlassian
.bamboo
.specs
.api
.builders
.plan
.configuration
.AllOtherPluginsConfiguration
;
26 import com
.atlassian
.bamboo
.specs
.api
.builders
.plan
.configuration
.PluginConfiguration
;
27 import com
.atlassian
.bamboo
.specs
.api
.builders
.requirement
.Requirement
;
28 import com
.atlassian
.bamboo
.specs
.api
.builders
.task
.Task
;
29 import com
.atlassian
.bamboo
.specs
.builders
.task
.CheckoutItem
;
30 import com
.atlassian
.bamboo
.specs
.builders
.task
.CommandTask
;
31 import com
.atlassian
.bamboo
.specs
.builders
.task
.NpmTask
;
32 import com
.atlassian
.bamboo
.specs
.builders
.task
.ScriptTask
;
33 import com
.atlassian
.bamboo
.specs
.builders
.task
.TestParserTask
;
34 import com
.atlassian
.bamboo
.specs
.builders
.task
.VcsCheckoutTask
;
35 import com
.atlassian
.bamboo
.specs
.model
.task
.ScriptTaskProperties
;
36 import com
.atlassian
.bamboo
.specs
.model
.task
.TestParserTaskProperties
;
37 import com
.atlassian
.bamboo
.specs
.util
.MapBuilder
;
40 * Abstract class with common methods of pre-merge and nightly plan
42 abstract public class AbstractCoreSpec
{
44 protected static String bambooServerName
= "https://bamboo.typo3.com:443";
45 protected static String projectName
= "TYPO3 Core";
46 protected static String projectKey
= "CORE";
48 protected String composerRootVersionEnvironment
= "COMPOSER_ROOT_VERSION=9.5.0";
50 protected String testingFrameworkBuildPath
= "vendor/typo3/testing-framework/Resources/Core/Build/";
53 * Default permissions on core plans
59 protected PlanPermissions
getDefaultPlanPermissions(String projectKey
, String planKey
) {
60 return new PlanPermissions(new PlanIdentifier(projectKey
, planKey
))
61 .permissions(new Permissions()
62 .groupPermissions("TYPO3 GmbH", PermissionType
.ADMIN
, PermissionType
.VIEW
, PermissionType
.EDIT
, PermissionType
.BUILD
, PermissionType
.CLONE
)
63 .groupPermissions("TYPO3 Core Team", PermissionType
.VIEW
, PermissionType
.BUILD
)
64 .loggedInUserPermissions(PermissionType
.VIEW
)
65 .anonymousUserPermissionView()
70 * Default plan plugin configuration
74 protected PluginConfiguration
getDefaultPlanPluginConfiguration() {
75 return new AllOtherPluginsConfiguration()
76 .configuration(new MapBuilder()
77 .put("custom", new MapBuilder()
78 .put("artifactHandlers.useCustomArtifactHandlers", "false")
79 .put("buildExpiryConfig", new MapBuilder()
80 .put("duration", "30")
81 .put("period", "days")
82 .put("labelsToKeep", "")
83 .put("expiryTypeResult", "true")
84 .put("buildsToKeep", "")
85 .put("enabled", "true")
95 * Default job plugin configuration
99 protected PluginConfiguration
getDefaultJobPluginConfiguration() {
100 return new AllOtherPluginsConfiguration()
101 .configuration(new MapBuilder()
102 .put("repositoryDefiningWorkingDirectory", -1)
103 .put("custom", new MapBuilder()
104 .put("auto", new MapBuilder()
109 .put("buildHangingConfig.enabled", "false")
110 .put("ncover.path", "")
111 .put("clover", new MapBuilder()
114 .put("useLocalLicenseKey", "true")
124 * Job creating labels needed for intercept communication
126 protected Job
getJobBuildLabels() {
127 return new Job("Create build labels", new BambooKey("CLFB"))
128 .description("Create changeId and patch set labels from variable access and parsing result of a dummy task")
129 .pluginConfigurations(new AllOtherPluginsConfiguration()
130 .configuration(new MapBuilder()
131 .put("repositoryDefiningWorkingDirectory", -1)
132 .put("custom", new MapBuilder()
133 .put("auto", new MapBuilder()
134 .put("regex", "https:\\/\\/review\\.typo3\\.org\\/(#\\/c\\/)?(\\d+)")
135 .put("label", "change-\\2\\, patchset-${bamboo.patchset}")
138 .put("buildHangingConfig.enabled", "false")
139 .put("ncover.path", "")
140 .put("clover", new MapBuilder()
143 .put("useLocalLicenseKey", "true")
153 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
154 .inlineBody("echo \"I'm just here for the labels!\"")
157 this.getRequirementDocker10()
159 .cleanWorkingDirectory(true
);
163 * Job composer validate
165 * @param String requirementIdentifier
167 protected Job
getJobComposerValidate(String requirementIdentifier
) {
168 return new Job("Validate composer.json", new BambooKey("VC"))
169 .description("Validate composer.json before actual tests are executed")
170 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
172 this.getTaskGitCloneRepository(),
173 this.getTaskGitCherryPick(),
175 .description("composer validate")
176 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
178 this.getScriptTaskBashInlineBody() +
179 this.getScriptTaskComposer(requirementIdentifier
) +
182 .environmentVariables(this.composerRootVersionEnvironment
)
185 this.getRequirementDocker10()
187 .cleanWorkingDirectory(true
);
192 * Job checking CGL of last git commit
194 * @param String requirementIdentifier
196 protected Job
getJobCglCheckGitCommit(String requirementIdentifier
) {
197 return new Job("Integration CGL", new BambooKey("CGLCHECK"))
198 .description("Check coding guidelines by executing Build/Scripts/cglFixMyCommit.sh script")
199 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
201 this.getTaskGitCloneRepository(),
202 this.getTaskGitCherryPick(),
203 this.getTaskComposerInstall(requirementIdentifier
),
205 .description("Execute cgl check script")
206 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
208 this.getScriptTaskBashInlineBody() +
209 "function cglFixMyCommit() {\n" +
211 " -u ${HOST_UID} \\\n" +
212 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
213 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
214 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
216 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
217 " bin/bash -c \"cd ${PWD}; ./Build/Scripts/cglFixMyCommit.sh $*\"\n" +
220 "cglFixMyCommit dryrun\n"
224 this.getRequirementDocker10()
226 .cleanWorkingDirectory(true
);
230 * Job checking CGL of all core php files
232 * @param int stageNumber
233 * @param String requirementIdentifier
234 * @param Task composerTask
236 protected Job
getJobCglCheckFullCore(int stageNumber
, String requirementIdentifier
, Task composerTask
) {
237 return new Job("Integration CGL " + stageNumber
, new BambooKey("CGLCHECK" + stageNumber
))
238 .description("Check coding guidelines of full core")
239 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
241 this.getTaskGitCloneRepository(),
242 this.getTaskGitCherryPick(),
245 .description("Execute cgl check")
246 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
248 this.getScriptTaskBashInlineBody() +
249 "function phpCsFixer() {\n" +
251 " -u ${HOST_UID} \\\n" +
252 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
253 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
254 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
256 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
257 " bin/bash -c \"cd ${PWD}; php -n -c /etc/php/cli-no-xdebug/php.ini bin/php-cs-fixer $*\"\n" +
260 "phpCsFixer fix -v --dry-run --path-mode intersection --config=Build/.php_cs typo3/\n" +
265 this.getRequirementDocker10()
267 .cleanWorkingDirectory(true
);
271 * Job acceptance test installs system on mariadb
273 * @param int stageNumber
274 * @param String requirementIdentifier
275 * @param Task composerTask
277 protected Job
getJobAcceptanceTestInstallMysql(int stageNumber
, String requirementIdentifier
, Task composerTask
) {
278 return new Job("Accept inst my " + stageNumber
+ " " + requirementIdentifier
, new BambooKey("ACINSTMY" +stageNumber
+ requirementIdentifier
))
279 .description("Install TYPO3 on mariadb and load introduction package " + requirementIdentifier
)
280 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
282 this.getTaskGitCloneRepository(),
283 this.getTaskGitCherryPick(),
285 this.getTaskPrepareAcceptanceTest(),
286 this.getTaskDockerDependenciesAcceptanceInstallMariadb10(),
288 .description("Install TYPO3 on mariadb 10")
289 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
291 this.getScriptTaskBashInlineBody() +
292 "function codecept() {\n" +
294 " -u ${HOST_UID} \\\n" +
295 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
296 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
297 " -e typo3InstallMysqlDatabaseHost=${typo3InstallMysqlDatabaseHost} \\\n" +
298 " -e typo3InstallMysqlDatabaseName=${typo3InstallMysqlDatabaseName} \\\n" +
299 " -e typo3InstallMysqlDatabaseUsername=${typo3InstallMysqlDatabaseUsername} \\\n" +
300 " -e typo3InstallMysqlDatabasePassword=${typo3InstallMysqlDatabasePassword} \\\n" +
301 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
302 " --network ${BAMBOO_COMPOSE_PROJECT_NAME}_test \\\n" +
304 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
305 " bin/bash -c \"cd ${PWD}; ./bin/codecept $*\"\n" +
308 "codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml --env=mysql --xml reports.xml --html reports.html\n"
312 this.getTaskStopDockerDependencies(),
313 new TestParserTask(TestParserTaskProperties
.TestType
.JUNIT
)
314 .resultDirectories("typo3temp/var/tests/AcceptanceReports/reports.xml")
316 .artifacts(new Artifact()
318 .copyPattern("typo3temp/var/tests/AcceptanceReports/")
322 this.getRequirementDocker10()
324 .cleanWorkingDirectory(true
);
328 * Job acceptance test installs system and introduction package on pgsql
330 * @param int stageNumber
331 * @param String requirementIdentifier
332 * @param Task composerTask
334 protected Job
getJobAcceptanceTestInstallPgsql(int stageNumber
, String requirementIdentifier
, Task composerTask
) {
335 return new Job("Accept inst pg " + stageNumber
+ " " + requirementIdentifier
, new BambooKey("ACINSTPG" + stageNumber
+ requirementIdentifier
))
336 .description("Install TYPO3 on pgsql and load introduction package " + requirementIdentifier
)
337 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
339 this.getTaskGitCloneRepository(),
340 this.getTaskGitCherryPick(),
342 this.getTaskPrepareAcceptanceTest(),
343 this.getTaskDockerDependenciesAcceptanceInstallPostgres10(),
345 .description("Install TYPO3 on postgresql 10")
346 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
348 this.getScriptTaskBashInlineBody() +
349 "function codecept() {\n" +
351 " -u ${HOST_UID} \\\n" +
352 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
353 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
354 " -e typo3InstallPostgresqlDatabaseHost=${typo3InstallPostgresqlDatabaseHost} \\\n" +
355 " -e typo3InstallPostgresqlDatabaseName=${typo3InstallPostgresqlDatabaseName} \\\n" +
356 " -e typo3InstallPostgresqlDatabaseUsername=${typo3InstallPostgresqlDatabaseUsername} \\\n" +
357 " -e typo3InstallPostgresqlDatabasePassword=${typo3InstallPostgresqlDatabasePassword} \\\n" +
358 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
359 " --network ${BAMBOO_COMPOSE_PROJECT_NAME}_test \\\n" +
361 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
362 " bin/bash -c \"cd ${PWD}; ./bin/codecept $*\"\n" +
365 "codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml --env=postgresql --xml reports.xml --html reports.html\n"
369 this.getTaskStopDockerDependencies(),
370 new TestParserTask(TestParserTaskProperties
.TestType
.JUNIT
)
371 .resultDirectories("typo3temp/var/tests/AcceptanceReports/reports.xml")
373 .artifacts(new Artifact()
375 .copyPattern("typo3temp/var/tests/AcceptanceReports/")
379 this.getRequirementDocker10()
381 .cleanWorkingDirectory(true
);
385 * Job acceptance test installs system and introduction package on sqlite
387 * @param int stageNumber
388 * @param String requirementIdentifier
389 * @param Task composerTask
391 protected Job
getJobAcceptanceTestInstallSqlite(int stageNumber
, String requirementIdentifier
, Task composerTask
) {
392 return new Job("Accept inst sq " + stageNumber
+ " " + requirementIdentifier
, new BambooKey("ACINSTSQ" + stageNumber
+ requirementIdentifier
))
393 .description("Install TYPO3 on sqlite and load introduction package " + requirementIdentifier
)
394 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
396 this.getTaskGitCloneRepository(),
397 this.getTaskGitCherryPick(),
399 this.getTaskPrepareAcceptanceTest(),
400 this.getTaskDockerDependenciesAcceptanceInstallSqlite(),
402 .description("Install TYPO3 on sqlite")
403 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
405 this.getScriptTaskBashInlineBody() +
406 "function codecept() {\n" +
408 " -u ${HOST_UID} \\\n" +
409 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
410 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
411 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
412 " --network ${BAMBOO_COMPOSE_PROJECT_NAME}_test \\\n" +
414 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
415 " bin/bash -c \"cd ${PWD}; ./bin/codecept $*\"\n" +
418 "codecept run Install -d -c typo3/sysext/core/Tests/codeception.yml --env=sqlite --xml reports.xml --html reports.html\n"
422 this.getTaskStopDockerDependencies(),
423 new TestParserTask(TestParserTaskProperties
.TestType
.JUNIT
)
424 .resultDirectories("typo3temp/var/tests/AcceptanceReports/reports.xml")
426 .artifacts(new Artifact()
428 .copyPattern("typo3temp/var/tests/AcceptanceReports/")
432 this.getRequirementDocker10()
434 .cleanWorkingDirectory(true
);
438 * Jobs for mysql based acceptance tests
440 * @param int stageNumber
441 * @param int numberOfChunks
442 * @param String requirementIdentifier
443 * @param Task composerTask
445 protected ArrayList
<Job
> getJobsAcceptanceTestsBackendMysql(int stageNumber
, int numberOfChunks
, String requirementIdentifier
, Task composerTask
) {
446 ArrayList
<Job
> jobs
= new ArrayList
<Job
>();
448 for (int i
=1; i
<=numberOfChunks
; i
++) {
449 String formattedI
= "" + i
;
451 formattedI
= "0" + i
;
453 jobs
.add(new Job("Accept my " + stageNumber
+ " " + requirementIdentifier
+ " " + formattedI
, new BambooKey("ACMY" + stageNumber
+ requirementIdentifier
+ formattedI
))
454 .description("Run acceptance tests" + requirementIdentifier
)
455 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
457 this.getTaskGitCloneRepository(),
458 this.getTaskGitCherryPick(),
460 this.getTaskPrepareAcceptanceTest(),
461 this.getTaskDockerDependenciesAcceptanceBackendMariadb10(),
463 .description("Split acceptance tests")
464 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
466 this.getScriptTaskBashInlineBody() +
467 "function splitAcceptanceTests() {\n" +
469 " -u ${HOST_UID} \\\n" +
470 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
471 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
472 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
474 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
475 " bin/bash -c \"cd ${PWD}; ./" + this.testingFrameworkBuildPath
+ "Scripts/splitAcceptanceTests.php $*\"\n" +
478 "splitAcceptanceTests " + numberOfChunks
+ " -v"
481 .description("Execute codeception acceptance suite group " + formattedI
)
482 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
484 this.getScriptTaskBashInlineBody() +
485 "function codecept() {\n" +
487 " -u ${HOST_UID} \\\n" +
488 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
489 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
490 " -e typo3DatabaseName=func_test \\\n" +
491 " -e typo3DatabaseUsername=root \\\n" +
492 " -e typo3DatabasePassword=funcp \\\n" +
493 " -e typo3DatabaseHost=mariadb10 \\\n" +
494 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
495 " --network ${BAMBOO_COMPOSE_PROJECT_NAME}_test \\\n" +
497 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
498 " bin/bash -c \"cd ${PWD}; ./bin/codecept $*\"\n" +
501 "codecept run Backend -d -g AcceptanceTests-Job-" + i
+ " -c typo3/sysext/core/Tests/codeception.yml --xml reports.xml --html reports.html\n"
505 this.getTaskStopDockerDependencies(),
506 new TestParserTask(TestParserTaskProperties
.TestType
.JUNIT
)
507 .resultDirectories("typo3temp/var/tests/AcceptanceReports/reports.xml")
509 .artifacts(new Artifact()
511 .copyPattern("typo3temp/var/tests/AcceptanceReports/")
515 this.getRequirementDocker10()
517 .cleanWorkingDirectory(true
)
525 * Jobs for mysql based functional tests
527 * @param int stageNumber
528 * @param int numberOfChunks
529 * @param String requirementIdentifier
530 * @param Task composerTask
532 protected ArrayList
<Job
> getJobsFunctionalTestsMysql(int stageNumber
, int numberOfChunks
, String requirementIdentifier
, Task composerTask
) {
533 ArrayList
<Job
> jobs
= new ArrayList
<Job
>();
535 for (int i
=1; i
<=numberOfChunks
; i
++) {
536 String formattedI
= "" + i
;
538 formattedI
= "0" + i
;
540 jobs
.add(new Job("Func mysql " + stageNumber
+ " " + requirementIdentifier
+ " " + formattedI
, new BambooKey("FMY" + stageNumber
+ requirementIdentifier
+ formattedI
))
541 .description("Run functional tests on mysql DB " + requirementIdentifier
)
542 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
544 this.getTaskGitCloneRepository(),
545 this.getTaskGitCherryPick(),
547 this.getTaskDockerDependenciesFunctionalMariadb10(),
548 this.getTaskSplitFunctionalJobs(numberOfChunks
, requirementIdentifier
),
550 .description("Run phpunit with functional chunk " + formattedI
)
551 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
553 this.getScriptTaskBashInlineBody() +
554 "function phpunit() {\n" +
556 " -u ${HOST_UID} \\\n" +
557 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
558 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
559 " -e typo3DatabaseName=func_test \\\n" +
560 " -e typo3DatabaseUsername=root \\\n" +
561 " -e typo3DatabasePassword=funcp \\\n" +
562 " -e typo3DatabaseHost=mariadb10 \\\n" +
563 " -e typo3TestingRedisHost=${BAMBOO_COMPOSE_PROJECT_NAME}sib_redis4_1 \\\n" +
564 " -e typo3TestingMemcachedHost=${BAMBOO_COMPOSE_PROJECT_NAME}sib_memcached1-5_1 \\\n" +
565 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
566 " --network ${BAMBOO_COMPOSE_PROJECT_NAME}_test \\\n" +
568 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
569 " bin/bash -c \"cd ${PWD}; php -n -c /etc/php/cli-no-xdebug/php.ini bin/phpunit $*\"\n" +
572 "phpunit --log-junit test-reports/phpunit.xml -c " + this.testingFrameworkBuildPath
+ "FunctionalTests-Job-" + i
+ ".xml"
576 this.getTaskStopDockerDependencies(),
577 new TestParserTask(TestParserTaskProperties
.TestType
.JUNIT
)
578 .resultDirectories("test-reports/phpunit.xml")
581 this.getRequirementDocker10()
583 .cleanWorkingDirectory(true
)
591 * Jobs for mssql based functional tests
593 * @param int stageNumber
594 * @param int numberOfChunks
595 * @param String requirementIdentifier
596 * @param Task composerTask
598 protected ArrayList
<Job
> getJobsFunctionalTestsMssql(int stageNumber
, int numberOfChunks
, String requirementIdentifier
, Task composerTask
) {
599 ArrayList
<Job
> jobs
= new ArrayList
<Job
>();
601 for (int i
=1; i
<=numberOfChunks
; i
++) {
602 String formattedI
= "" + i
;
604 formattedI
= "0" + i
;
606 jobs
.add(new Job("Func mssql " + stageNumber
+ " " + requirementIdentifier
+ " " + formattedI
, new BambooKey("FMS" + stageNumber
+ requirementIdentifier
+ formattedI
))
607 .description("Run functional tests on mysql DB " + requirementIdentifier
)
608 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
610 this.getTaskGitCloneRepository(),
611 this.getTaskGitCherryPick(),
613 this.getTaskDockerDependenciesFunctionalMssql(),
614 this.getTaskSplitFunctionalJobs(numberOfChunks
, requirementIdentifier
),
616 .description("Run phpunit with functional chunk " + formattedI
)
617 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
619 this.getScriptTaskBashInlineBody() +
620 "function phpunit() {\n" +
622 " -u ${HOST_UID} \\\n" +
623 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
624 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
625 " -e typo3DatabaseDriver=sqlsrv \\\n" +
626 " -e typo3DatabaseName=func \\\n" +
627 " -e typo3DatabasePassword=Test1234! \\\n" +
628 " -e typo3DatabaseUsername=SA \\\n" +
629 " -e typo3DatabaseHost=localhost \\\n" +
630 " -e typo3DatabasePort=1433 \\\n" +
631 " -e typo3DatabaseCharset=utf-8 \\\n" +
632 " -e typo3DatabaseHost=mssql2017cu9 \\\n" +
633 " -e typo3TestingRedisHost=${BAMBOO_COMPOSE_PROJECT_NAME}sib_redis4_1 \\\n" +
634 " -e typo3TestingMemcachedHost=${BAMBOO_COMPOSE_PROJECT_NAME}sib_memcached1-5_1 \\\n" +
635 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
636 " --network ${BAMBOO_COMPOSE_PROJECT_NAME}_test \\\n" +
638 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
639 " bin/bash -c \"cd ${PWD}; php -n -c /etc/php/cli-no-xdebug/php.ini bin/phpunit $*\"\n" +
642 "phpunit --exclude-group not-mssql --log-junit test-reports/phpunit.xml -c " + this.testingFrameworkBuildPath
+ "FunctionalTests-Job-" + i
+ ".xml"
646 this.getTaskStopDockerDependencies(),
647 new TestParserTask(TestParserTaskProperties
.TestType
.JUNIT
)
648 .resultDirectories("test-reports/phpunit.xml")
651 this.getRequirementDocker10()
653 .cleanWorkingDirectory(true
)
661 * Jobs for pgsql based functional tests
663 * @param int stageNumber
664 * @param int numberOfChunks
665 * @param String requirementIdentifier
666 * @param Task composerTask
668 protected ArrayList
<Job
> getJobsFunctionalTestsPgsql(int stageNumber
, int numberOfChunks
, String requirementIdentifier
, Task composerTask
) {
669 ArrayList
<Job
> jobs
= new ArrayList
<Job
>();
671 for (int i
=1; i
<=numberOfChunks
; i
++) {
672 String formattedI
= "" + i
;
674 formattedI
= "0" + i
;
676 jobs
.add(new Job("Func pgsql " + stageNumber
+ " " + requirementIdentifier
+ " " + formattedI
, new BambooKey("FPG" + stageNumber
+ requirementIdentifier
+ formattedI
))
677 .description("Run functional tests on pgsql DB " + requirementIdentifier
)
678 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
680 this.getTaskGitCloneRepository(),
681 this.getTaskGitCherryPick(),
683 this.getTaskDockerDependenciesFunctionalPostgres10(),
684 this.getTaskSplitFunctionalJobs(numberOfChunks
, requirementIdentifier
),
686 .description("Run phpunit with functional chunk " + formattedI
)
687 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
689 this.getScriptTaskBashInlineBody() +
690 "function phpunit() {\n" +
692 " -u ${HOST_UID} \\\n" +
693 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
694 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
695 " -e typo3DatabaseDriver=pdo_pgsql \\\n" +
696 " -e typo3DatabaseName=bamboo \\\n" +
697 " -e typo3DatabaseUsername=bamboo \\\n" +
698 " -e typo3DatabaseHost=postgres10 \\\n" +
699 " -e typo3DatabasePassword=funcp \\\n" +
700 " -e typo3TestingRedisHost=redis4 \\\n" +
701 " -e typo3TestingMemcachedHost=memcached1-5 \\\n" +
702 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
703 " --network ${BAMBOO_COMPOSE_PROJECT_NAME}_test \\\n" +
705 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
706 " bin/bash -c \"cd ${PWD}; php -n -c /etc/php/cli-no-xdebug/php.ini bin/phpunit $*\"\n" +
709 "phpunit --exclude-group not-postgres --log-junit test-reports/phpunit.xml -c " + this.testingFrameworkBuildPath
+ "FunctionalTests-Job-" + i
+ ".xml"
713 this.getTaskStopDockerDependencies(),
714 new TestParserTask(TestParserTaskProperties
.TestType
.JUNIT
)
715 .resultDirectories("test-reports/phpunit.xml")
718 this.getRequirementDocker10()
720 .cleanWorkingDirectory(true
)
728 * Jobs for sqlite based functional tests
730 * @param int stageNumber
731 * @param int numberOfChunks
732 * @param String requirementIdentifier
733 * @param Task composerTask
735 protected ArrayList
<Job
> getJobsFunctionalTestsSqlite(int stageNumber
, int numberOfChunks
, String requirementIdentifier
, Task composerTask
) {
736 ArrayList
<Job
> jobs
= new ArrayList
<Job
>();
738 for (int i
=1; i
<=numberOfChunks
; i
++) {
739 String formattedI
= "" + i
;
741 formattedI
= "0" + i
;
743 jobs
.add(new Job("Func sqlite " + stageNumber
+ " " + requirementIdentifier
+ " " + formattedI
, new BambooKey("FSL" + stageNumber
+ requirementIdentifier
+ formattedI
))
744 .description("Run functional tests on sqlite DB " + requirementIdentifier
)
745 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
747 this.getTaskGitCloneRepository(),
748 this.getTaskGitCherryPick(),
750 this.getTaskSplitFunctionalJobs(numberOfChunks
, requirementIdentifier
),
751 this.getTaskDockerDependenciesFunctionalSqlite(),
753 .description("Run phpunit with functional chunk " + formattedI
)
754 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
756 this.getScriptTaskBashInlineBody() +
757 "function phpunit() {\n" +
759 " -u ${HOST_UID} \\\n" +
760 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
761 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
762 " -e typo3DatabaseDriver=pdo_sqlite \\\n" +
763 " -e typo3TestingRedisHost=redis4 \\\n" +
764 " -e typo3TestingMemcachedHost=memcached1-5 \\\n" +
765 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
766 " --network ${BAMBOO_COMPOSE_PROJECT_NAME}_test \\\n" +
768 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
769 " bin/bash -c \"cd ${PWD}; php -n -c /etc/php/cli-no-xdebug/php.ini bin/phpunit $*\"\n" +
772 "phpunit --exclude-group not-sqlite --log-junit test-reports/phpunit.xml -c " + this.testingFrameworkBuildPath
+ "FunctionalTests-Job-" + i
+ ".xml"
776 this.getTaskStopDockerDependencies(),
777 new TestParserTask(TestParserTaskProperties
.TestType
.JUNIT
)
778 .resultDirectories("test-reports/phpunit.xml")
781 this.getRequirementDocker10()
783 .cleanWorkingDirectory(true
)
791 * Job with integration test checking for valid @xy annotations
793 * @param int stageNumber
794 * @param String requirementIdentifier
795 * @param Task composerTask
797 protected Job
getJobIntegrationAnnotations(int stageNumber
, String requirementIdentifier
, Task composerTask
) {
798 return new Job("Integration annotations " + stageNumber
, new BambooKey("IANNO" + stageNumber
))
799 .description("Check docblock-annotations by executing Build/Scripts/annotationChecker.php script")
800 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
802 this.getTaskGitCloneRepository(),
803 this.getTaskGitCherryPick(),
806 .description("Execute annotations check script")
807 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
809 this.getScriptTaskBashInlineBody() +
810 "function annotationChecker() {\n" +
812 " -u ${HOST_UID} \\\n" +
813 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
814 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
815 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
817 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
818 " bin/bash -c \"cd ${PWD}; ./Build/Scripts/annotationChecker.php $*\"\n" +
825 this.getRequirementDocker10()
827 .cleanWorkingDirectory(true
);
831 * Job with various smaller script tests
833 * @param int stageNumber
834 * @param String requirementIdentifier
835 * @param Task composerTask
837 protected Job
getJobIntegrationVarious(int stageNumber
, String requirementIdentifier
, Task composerTask
) {
838 // Exception code checker, xlf, permissions, rst file check
839 return new Job("Integration various " + stageNumber
, new BambooKey("CDECC" + stageNumber
))
840 .description("Checks duplicate exceptions, git submodules, xlf files, permissions, rst")
841 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
843 this.getTaskGitCloneRepository(),
844 this.getTaskGitCherryPick(),
847 .description("Run duplicate exception code check script")
848 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
850 this.getScriptTaskBashInlineBody() +
851 "./Build/Scripts/duplicateExceptionCodeCheck.sh\n"
854 .description("Run git submodule status and verify there are none")
855 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
857 this.getScriptTaskBashInlineBody() +
858 "if [[ `git submodule status 2>&1 | wc -l` -ne 0 ]]; then\n" +
859 " echo \\\"Found a submodule definition in repository\\\";\n" +
864 .description("Run permission check script")
865 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
867 this.getScriptTaskBashInlineBody() +
868 "./Build/Scripts/checkFilePermissions.sh\n"
871 .description("Run xlf check")
872 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
874 this.getScriptTaskBashInlineBody() +
875 "./Build/Scripts/xlfcheck.sh"
878 .description("Run rst check")
879 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
881 this.getScriptTaskBashInlineBody() +
882 "function validateRstFiles() {\n" +
884 " -u ${HOST_UID} \\\n" +
885 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
886 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
887 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
889 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
890 " bin/bash -c \"cd ${PWD}; ./Build/Scripts/validateRstFiles.php $*\"\n" +
896 .description("Run path length check")
897 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
899 this.getScriptTaskBashInlineBody() +
900 "./Build/Scripts/maxFilePathLength.sh"
903 .description("Run extension scanner ReST file reference tester")
904 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
906 this.getScriptTaskBashInlineBody() +
907 "function extensionScannerRstFileReferences() {\n" +
909 " -u ${HOST_UID} \\\n" +
910 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
911 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
912 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
914 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
915 " bin/bash -c \"cd ${PWD}; ./Build/Scripts/extensionScannerRstFileReferences.php $*\"\n" +
918 "extensionScannerRstFileReferences"
921 .description("Run functional fixture csv format checker")
922 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
924 this.getScriptTaskBashInlineBody() +
925 "function checkIntegrityCsvFixtures() {\n" +
927 " -u ${HOST_UID} \\\n" +
928 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
929 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
930 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
932 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
933 " bin/bash -c \"cd ${PWD}; ./Build/Scripts/checkIntegrityCsvFixtures.php $*\"\n" +
936 "checkIntegrityCsvFixtures"
939 .description("Run UTF-8 BOM check")
940 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
942 this.getScriptTaskBashInlineBody() +
943 "function checkIntegrityBom() {\n" +
945 " -u ${HOST_UID} \\\n" +
946 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
947 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
948 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
950 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
951 " bin/bash -c \"cd ${PWD}; ./Build/Scripts/checkUtf8Bom.sh $*\"\n" +
957 .description("Run composer.json integrity check")
958 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
960 this.getScriptTaskBashInlineBody() +
961 "function checkIntegrityComposer() {\n" +
963 " -u ${HOST_UID} \\\n" +
964 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
965 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
966 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
968 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
969 " bin/bash -c \"cd ${PWD}; ./Build/Scripts/checkIntegrityComposer.php $*\"\n" +
972 "checkIntegrityComposer"
976 this.getRequirementDocker10()
978 .cleanWorkingDirectory(true
);
982 * Job for javascript unit tests
984 * @param int stageNumber
985 * @param String requirementIdentifier
986 * @param Task composerTask
988 protected Job
getJobUnitJavaScript(int stageNumber
, String requirementIdentifier
, Task composerTask
) {
989 return new Job("Unit JavaScript " + stageNumber
, new BambooKey("JSUT" + stageNumber
))
990 .description("Run JavaScript unit tests")
991 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
993 this.getTaskGitCloneRepository(),
994 this.getTaskGitCherryPick(),
997 .description("yarn install in Build/ dir")
998 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1000 this.getScriptTaskBashInlineBody() +
1001 "function yarn() {\n" +
1002 " docker run \\\n" +
1003 " -u ${HOST_UID} \\\n" +
1004 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
1005 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
1006 " -e HOME=${HOME} \\\n" +
1007 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
1009 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
1010 " bin/bash -c \"cd ${PWD}/Build; yarn $*\"\n" +
1016 .description("Run tests")
1017 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1019 this.getScriptTaskBashInlineBody() +
1020 "function karma() {\n" +
1021 " docker run \\\n" +
1022 " -u ${HOST_UID} \\\n" +
1023 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
1024 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
1025 " -e HOME=${HOME} \\\n" +
1026 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
1028 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
1029 " bin/bash -c \"cd ${PWD}; ./Build/node_modules/karma/bin/karma $*\"\n" +
1032 "karma start " + this.testingFrameworkBuildPath
+ "Configuration/JSUnit/karma.conf.js --single-run"
1036 new TestParserTask(TestParserTaskProperties
.TestType
.JUNIT
)
1037 .resultDirectories("typo3temp/var/tests/*")
1041 .name("Clover Report (System)")
1042 .copyPattern("**/*.*")
1043 .location("Build/target/site/clover")
1047 this.getRequirementDocker10()
1049 .cleanWorkingDirectory(true
);
1055 * @param String requirementIdentifier
1057 protected Job
getJobLintPhp(String requirementIdentifier
) {
1058 return new Job("Lint " + requirementIdentifier
, new BambooKey("L" + requirementIdentifier
))
1059 .description("Run php -l on source files for linting " + requirementIdentifier
)
1060 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
1062 this.getTaskGitCloneRepository(),
1063 this.getTaskGitCherryPick(),
1065 .description("Run php lint")
1066 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1068 this.getScriptTaskBashInlineBody() +
1069 "function runLint() {\n" +
1070 " docker run \\\n" +
1071 " -u ${HOST_UID} \\\n" +
1072 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
1073 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
1074 " -e HOME=${HOME} \\\n" +
1075 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
1077 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
1078 " bin/bash -c \"cd ${PWD}; find . -name \\*.php -print0 | xargs -0 -n1 -P2 php -n -c /etc/php/cli-no-xdebug/php.ini -l >/dev/null\"\n" +
1085 this.getRequirementDocker10()
1087 .cleanWorkingDirectory(true
);
1091 * Job for lint npm scss and typescript
1093 * @param String requirementIdentifier
1095 protected Job
getJobLintScssTs(String requirementIdentifier
) {
1096 return new Job("Lint scss ts", new BambooKey("LSTS"))
1097 .description("Lint scss and ts, build css and js, test git is clean")
1098 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
1100 this.getTaskGitCloneRepository(),
1101 this.getTaskGitCherryPick(),
1103 .description("yarn install in Build/ dir")
1104 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1106 this.getScriptTaskBashInlineBody() +
1107 "function yarn() {\n" +
1108 " docker run \\\n" +
1109 " -u ${HOST_UID} \\\n" +
1110 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
1111 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
1112 " -e HOME=${HOME} \\\n" +
1113 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
1115 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
1116 " bin/bash -c \"cd ${PWD}/Build; yarn $*\"\n" +
1122 .description("Run grunt lint")
1123 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1125 this.getScriptTaskBashInlineBody() +
1126 "function grunt() {\n" +
1127 " docker run \\\n" +
1128 " -u ${HOST_UID} \\\n" +
1129 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
1130 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
1131 " -e HOME=${HOME} \\\n" +
1132 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
1134 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
1135 " bin/bash -c \"cd ${PWD}/Build; ./node_modules/grunt/bin/grunt $*\"\n" +
1141 .description("Run grunt scripts")
1142 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1144 this.getScriptTaskBashInlineBody() +
1145 "function grunt() {\n" +
1146 " docker run \\\n" +
1147 " -u ${HOST_UID} \\\n" +
1148 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
1149 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
1150 " -e HOME=${HOME} \\\n" +
1151 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
1153 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
1154 " bin/bash -c \"cd ${PWD}/Build; ./node_modules/grunt/bin/grunt $*\"\n" +
1160 .description("Run grunt css")
1161 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1163 this.getScriptTaskBashInlineBody() +
1164 "function grunt() {\n" +
1165 " docker run \\\n" +
1166 " -u ${HOST_UID} \\\n" +
1167 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
1168 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
1169 " -e HOME=${HOME} \\\n" +
1170 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
1172 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
1173 " bin/bash -c \"cd ${PWD}/Build; ./node_modules/grunt/bin/grunt $*\"\n" +
1179 .description("git status to check for changed files after build-js")
1180 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1182 this.getScriptTaskBashInlineBody() +
1183 "git status | grep -q \"nothing to commit, working tree clean\""
1187 this.getRequirementDocker10()
1189 .cleanWorkingDirectory(true
);
1193 * Job for unit testing PHP
1195 * @param int stageNumber
1196 * @param String requirementIdentifier
1197 * @param Task composerTask
1199 protected Job
getJobUnitPhp(int stageNumber
, String requirementIdentifier
, Task composerTask
) {
1200 return new Job("Unit " + stageNumber
+ " " + requirementIdentifier
, new BambooKey("UT" + stageNumber
+ requirementIdentifier
))
1201 .description("Run unit tests " + requirementIdentifier
)
1202 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
1204 this.getTaskGitCloneRepository(),
1205 this.getTaskGitCherryPick(),
1208 .description("Run phpunit")
1209 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1211 this.getScriptTaskBashInlineBody() +
1212 "function phpunit() {\n" +
1213 " docker run \\\n" +
1214 " -u ${HOST_UID} \\\n" +
1215 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
1216 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
1217 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
1218 " --network ${BAMBOO_COMPOSE_PROJECT_NAME}_test \\\n" +
1220 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
1221 " bin/bash -c \"cd ${PWD}; php -n -c /etc/php/cli-no-xdebug/php.ini bin/phpunit $*\"\n" +
1224 "phpunit --log-junit test-reports/phpunit.xml -c " + this.testingFrameworkBuildPath
+ "UnitTests.xml"
1228 new TestParserTask(TestParserTaskProperties
.TestType
.JUNIT
)
1229 .resultDirectories("test-reports/phpunit.xml")
1232 this.getRequirementDocker10()
1234 .cleanWorkingDirectory(true
);
1238 * Job for unit testing deprecated PHP
1240 * @param int stageNumber
1241 * @param String requirementIdentifier
1242 * @param Task composerTask
1244 protected Job
getJobUnitDeprecatedPhp(int stageNumber
, String requirementIdentifier
, Task composerTask
) {
1245 return new Job("Unit deprecated " + stageNumber
+ " " + requirementIdentifier
, new BambooKey("UTD" + stageNumber
+ requirementIdentifier
))
1246 .description("Run deprecated unit tests " + requirementIdentifier
)
1247 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
1249 this.getTaskGitCloneRepository(),
1250 this.getTaskGitCherryPick(),
1253 .description("Run phpunit")
1254 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1256 this.getScriptTaskBashInlineBody() +
1257 "function phpunit() {\n" +
1258 " docker run \\\n" +
1259 " -u ${HOST_UID} \\\n" +
1260 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
1261 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
1262 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
1263 " --network ${BAMBOO_COMPOSE_PROJECT_NAME}_test \\\n" +
1265 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
1266 " bin/bash -c \"cd ${PWD}; php -n -c /etc/php/cli-no-xdebug/php.ini bin/phpunit $*\"\n" +
1269 "phpunit --log-junit test-reports/phpunit.xml -c " + this.testingFrameworkBuildPath
+ "UnitTestsDeprecated.xml"
1273 new TestParserTask(TestParserTaskProperties
.TestType
.JUNIT
)
1274 .resultDirectories("test-reports/phpunit.xml")
1277 this.getRequirementDocker10()
1279 .cleanWorkingDirectory(true
);
1283 * Jobs for unit testing PHP in random test order
1285 * @param int stageNumber
1286 * @param int numberOfRuns
1287 * @param String requirementIdentifier
1288 * @param Task composerTask
1290 protected ArrayList
<Job
> getJobUnitPhpRandom(int stageNumber
, int numberOfRuns
, String requirementIdentifier
, Task composerTask
) {
1291 ArrayList
<Job
> jobs
= new ArrayList
<Job
>();
1293 for (int i
=1; i
<=numberOfRuns
; i
++) {
1294 jobs
.add(new Job("Unit " + stageNumber
+ " " + requirementIdentifier
+ " random " + i
, new BambooKey("UTR" + stageNumber
+ requirementIdentifier
+ i
))
1295 .description("Run unit tests on " + requirementIdentifier
+ " in random order 0" + i
)
1296 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
1298 this.getTaskGitCloneRepository(),
1299 this.getTaskGitCherryPick(),
1302 .description("Run phpunit-randomizer")
1303 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1305 this.getScriptTaskBashInlineBody() +
1306 "function phpunitRandomizer() {\n" +
1307 " docker run \\\n" +
1308 " -u ${HOST_UID} \\\n" +
1309 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
1310 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
1311 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
1312 " --network ${BAMBOO_COMPOSE_PROJECT_NAME}_test \\\n" +
1314 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
1315 " bin/bash -c \"cd ${PWD}; php -n -c /etc/php/cli-no-xdebug/php.ini bin/phpunit-randomizer $*\"\n" +
1318 "phpunitRandomizer --log-junit test-reports/phpunit.xml -c " + this.testingFrameworkBuildPath
+ "UnitTests.xml --order rand"
1322 new TestParserTask(TestParserTaskProperties
.TestType
.JUNIT
)
1323 .resultDirectories("test-reports/phpunit.xml")
1326 this.getRequirementDocker10()
1328 .cleanWorkingDirectory(true
)
1336 * Task definition for basic core clone of linked default repository
1338 protected Task
getTaskGitCloneRepository() {
1339 return new VcsCheckoutTask()
1340 .description("Checkout git core")
1341 .checkoutItems(new CheckoutItem().defaultRepository());
1345 * Task definition to cherry pick a patch set from gerrit on top of cloned core
1347 protected Task
getTaskGitCherryPick() {
1348 return new ScriptTask()
1349 .description("Gerrit cherry pick")
1350 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1352 this.getScriptTaskBashInlineBody() +
1353 "CHANGEURL=${bamboo.changeUrl}\n" +
1354 "CHANGEURLID=${CHANGEURL#https://review.typo3.org/}\n" +
1355 "PATCHSET=${bamboo.patchset}\n" +
1357 "if [[ $CHANGEURL ]]; then\n" +
1358 " gerrit-cherry-pick https://review.typo3.org/Packages/TYPO3.CMS $CHANGEURLID/$PATCHSET || exit 1\n" +
1364 * Task definition to execute composer install
1366 * @param String requirementIdentifier
1368 protected Task
getTaskComposerInstall(String requirementIdentifier
) {
1369 return new ScriptTask()
1370 .description("composer install")
1371 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1373 this.getScriptTaskBashInlineBody() +
1374 this.getScriptTaskComposer(requirementIdentifier
) +
1375 "composer install -n"
1377 .environmentVariables(this.composerRootVersionEnvironment
);
1381 * Task definition to execute 'composer update --with-dependencies'.
1382 * This will update all dependencies to current possible maximum version.
1383 * Used in nightly to see if we are compatible with updates from dependencies.
1385 * We update in 2 steps: First composer install as usual, then update. This
1386 * way it is easy to see which packages are updated in comparison to what is
1387 * currently defined in composer.lock.
1389 * @param String requirementIdentifier
1391 protected Task
getTaskComposerUpdateMax(String requirementIdentifier
) {
1392 return new ScriptTask()
1393 .description("composer update --with-dependencies")
1394 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1396 this.getScriptTaskBashInlineBody() +
1397 this.getScriptTaskComposer(requirementIdentifier
) +
1398 "composer install -n\n" +
1399 "composer update --with-dependencies -n"
1401 .environmentVariables(this.composerRootVersionEnvironment
);
1405 * Task definition to execute 'composer update --prefer-lowest'.
1406 * This will update all dependencies to current possible minimum version.
1407 * Used in nightly to see if we are compatible with lowest possible dependency versions.
1409 * We update in 2 steps: First composer install as usual, then update. This
1410 * way it is easy to see which packages are updated in comparison to what is
1411 * currently defined in composer.lock.
1413 * @param String requirementIdentifier
1415 protected Task
getTaskComposerUpdateMin(String requirementIdentifier
) {
1416 return new ScriptTask()
1417 .description("composer update --prefer-lowest")
1418 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1420 this.getScriptTaskBashInlineBody() +
1421 this.getScriptTaskComposer(requirementIdentifier
) +
1422 "composer install -n\n" +
1423 "composer update --prefer-lowest -n"
1425 .environmentVariables(this.composerRootVersionEnvironment
);
1429 * Task to prepare an acceptance test
1431 protected Task
getTaskPrepareAcceptanceTest() {
1432 return new ScriptTask()
1433 .description("Prepare acceptance test environment")
1434 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1436 this.getScriptTaskBashInlineBody() +
1437 "mkdir -p typo3temp/var/tests/\n"
1442 * Start docker sibling containers to execute acceptance install tests on mariadb
1444 protected Task
getTaskDockerDependenciesAcceptanceInstallMariadb10() {
1445 return new ScriptTask()
1446 .description("Start docker siblings for acceptance test install mariadb")
1447 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1449 this.getScriptTaskBashInlineBody() +
1450 "cd Build/testing-docker/bamboo\n" +
1451 "echo COMPOSE_PROJECT_NAME=${BAMBOO_COMPOSE_PROJECT_NAME}sib > .env\n" +
1452 "docker-compose run start_dependencies_acceptance_install_mariadb10"
1457 * Start docker sibling containers to execute acceptance install tests on postgres
1459 protected Task
getTaskDockerDependenciesAcceptanceInstallPostgres10() {
1460 return new ScriptTask()
1461 .description("Start docker siblings for acceptance test install postgres")
1462 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1464 this.getScriptTaskBashInlineBody() +
1465 "cd Build/testing-docker/bamboo\n" +
1466 "echo COMPOSE_PROJECT_NAME=${BAMBOO_COMPOSE_PROJECT_NAME}sib > .env\n" +
1467 "docker-compose run start_dependencies_acceptance_install_postgres10"
1472 * Start docker sibling containers to execute acceptance install tests on sqlite
1474 protected Task
getTaskDockerDependenciesAcceptanceInstallSqlite() {
1475 return new ScriptTask()
1476 .description("Start docker siblings for acceptance test install sqlite")
1477 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1479 this.getScriptTaskBashInlineBody() +
1480 "cd Build/testing-docker/bamboo\n" +
1481 "echo COMPOSE_PROJECT_NAME=${BAMBOO_COMPOSE_PROJECT_NAME}sib > .env\n" +
1482 "docker-compose run start_dependencies_acceptance_install_sqlite"
1487 * Start docker sibling containers to execute acceptance backend tests on mariadb
1489 protected Task
getTaskDockerDependenciesAcceptanceBackendMariadb10() {
1490 return new ScriptTask()
1491 .description("Start docker siblings for acceptance test backend mariadb")
1492 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1494 this.getScriptTaskBashInlineBody() +
1495 "cd Build/testing-docker/bamboo\n" +
1496 "echo COMPOSE_PROJECT_NAME=${BAMBOO_COMPOSE_PROJECT_NAME}sib > .env\n" +
1497 "docker-compose run start_dependencies_acceptance_backend_mariadb10"
1502 * Start docker sibling containers to execute functional tests on mariadb
1504 protected Task
getTaskDockerDependenciesFunctionalMariadb10() {
1505 return new ScriptTask()
1506 .description("Start docker siblings for functional tests on mariadb")
1507 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1509 this.getScriptTaskBashInlineBody() +
1510 "cd Build/testing-docker/bamboo\n" +
1511 "echo COMPOSE_PROJECT_NAME=${BAMBOO_COMPOSE_PROJECT_NAME}sib > .env\n" +
1512 "docker-compose run start_dependencies_functional_mariadb10"
1517 * Start docker sibling containers to execute functional tests on mssql
1519 protected Task
getTaskDockerDependenciesFunctionalMssql() {
1520 return new ScriptTask()
1521 .description("Start docker siblings for functional tests on mssql")
1522 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1524 this.getScriptTaskBashInlineBody() +
1525 "cd Build/testing-docker/bamboo\n" +
1526 "echo COMPOSE_PROJECT_NAME=${BAMBOO_COMPOSE_PROJECT_NAME}sib > .env\n" +
1527 "docker-compose run start_dependencies_functional_mssql"
1532 * Start docker sibling containers to execute functional tests on postgres
1534 protected Task
getTaskDockerDependenciesFunctionalPostgres10() {
1535 return new ScriptTask()
1536 .description("Start docker siblings for functional tests on postgres10")
1537 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1539 this.getScriptTaskBashInlineBody() +
1540 "cd Build/testing-docker/bamboo\n" +
1541 "echo COMPOSE_PROJECT_NAME=${BAMBOO_COMPOSE_PROJECT_NAME}sib > .env\n" +
1542 "docker-compose run start_dependencies_functional_postgres10"
1547 * Start docker sibling containers to execute functional tests on sqlite
1549 protected Task
getTaskDockerDependenciesFunctionalSqlite() {
1550 return new ScriptTask()
1551 .description("Start docker siblings for functional tests on sqlite")
1552 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1554 this.getScriptTaskBashInlineBody() +
1555 "cd Build/testing-docker/bamboo\n" +
1556 "echo COMPOSE_PROJECT_NAME=${BAMBOO_COMPOSE_PROJECT_NAME}sib > .env\n" +
1557 "docker-compose run start_dependencies_functional_sqlite"
1562 * Stop started docker containers
1564 protected Task
getTaskStopDockerDependencies() {
1565 return new ScriptTask()
1566 .description("Stop docker siblings")
1567 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1569 this.getScriptTaskBashInlineBody() +
1570 "cd Build/testing-docker/bamboo\n" +
1571 "docker-compose down -v"
1576 * Task to split functional jobs into chunks
1578 * @param int numberOfJobs
1579 * @param String requirementIdentifier
1581 protected Task
getTaskSplitFunctionalJobs(int numberOfJobs
, String requirementIdentifier
) {
1582 return new ScriptTask()
1583 .description("Create list of test files to execute per job")
1584 .interpreter(ScriptTaskProperties
.Interpreter
.BINSH_OR_CMDEXE
)
1586 this.getScriptTaskBashInlineBody() +
1587 "function splitFunctionalTests() {\n" +
1588 " docker run \\\n" +
1589 " -u ${HOST_UID} \\\n" +
1590 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
1591 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
1592 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
1594 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
1595 " bin/bash -c \"cd ${PWD}; ./" + this.testingFrameworkBuildPath
+ "Scripts/splitFunctionalTests.php $*\"\n" +
1598 "splitFunctionalTests " + numberOfJobs
+ " -v"
1603 * Requirement for docker 1.0 set by bamboo-agents
1605 protected Requirement
getRequirementDocker10() {
1606 return new Requirement("system.hasDocker")
1608 .matchType(Requirement
.MatchType
.EQUALS
);
1612 * A bash header for script tasks forking a bash if needed
1614 protected String
getScriptTaskBashInlineBody() {
1618 "if [ \"$(ps -p \"$$\" -o comm=)\" != \"bash\" ]; then\n" +
1619 " bash \"$0\" \"$@\"\n" +
1628 * A bash function aliasing 'composer' as docker command
1630 * @param String requirementIdentifier
1632 protected String
getScriptTaskComposer(String requirementIdentifier
) {
1634 "function composer() {\n" +
1635 " docker run \\\n" +
1636 " -u ${HOST_UID} \\\n" +
1637 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
1638 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
1639 " -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} \\\n" +
1640 " -e HOME=${HOME} \\\n" +
1641 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
1643 " typo3gmbh/" + requirementIdentifier
.toLowerCase() + ":latest \\\n" +
1644 " bin/bash -c \"cd ${PWD}; composer $*\"\n" +