Skip to content

Commit 373c3d7

Browse files
committed
test-2-1: Update JenkinsFile
1 parent e017005 commit 373c3d7

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

.ci/Jenkinsfile

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#!groovy
22

33
import org.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateAction
4+
import groovy.transform.Field
45

56
String launchUnitTests = "yes"
67
String launchIntegrationTests = "yes"
7-
String[] pimVersions = ["1.7", "2.0"]
8+
String[] pimVersions = ["1.7", "2.0", "2.1"]
89
String[] supportedPhpVersions = ["5.6", "7.0", "7.1"]
9-
String verboseOutputs = "yes"
10-
String dotsPerLine = "50"
10+
@Field def String verboseOutputs = "yes"
11+
@Field def String dotsPerLine = "50"
1112

1213
def clientConfig = [
1314
"php-http/guzzle6-adapter": ["phpVersion": supportedPhpVersions, "psrImplem": ["guzzlehttp/psr7"]],
@@ -19,7 +20,6 @@ imageRepo = "eu.gcr.io/akeneo-ci/php-api-client"
1920
imageTag = "pull-request-${env.CHANGE_ID}-build-${env.BUILD_NUMBER}"
2021
gcrImages = []
2122

22-
2323
def clients = clientConfig.keySet() as String[]
2424
def buildResult= 'SUCCESS'
2525

@@ -69,6 +69,7 @@ try {
6969
checkouts["pim_community_dev_${currentPimVersion}"] = {buildPim(currentPimVersion, "5.6")}
7070
break
7171
case "2.0":
72+
case "2.1":
7273
checkouts["pim_community_dev_${currentPimVersion}"] = {buildPim(currentPimVersion, "7.1")}
7374
break
7475
default:
@@ -177,10 +178,10 @@ void buildPim(String pimVersion, String phpVersion) {
177178
])
178179

179180
container("php") {
180-
sh "composer --ansi require \"akeneo/catalogs\":\"dev-master\" --optimize-autoloader --no-interaction --no-progress --prefer-dist"
181+
sh "php -d memory_limit=-1 /usr/local/bin/composer --ansi require \"akeneo/catalogs\":\"dev-master\" --optimize-autoloader --no-interaction --no-progress --prefer-dist"
181182
sh "cp app/config/parameters.yml.dist app/config/parameters.yml"
182183
sh "sed -i \"s#database_host: .*#database_host: 127.0.0.1#g\" app/config/parameters.yml"
183-
if ("2.0" == pimVersion) {
184+
if ("2.0" == pimVersion || "2.1" == pimVersion) {
184185
sh "sed -i \"s#index_hosts: .*#index_hosts: 'elastic:[email protected]:9200'#g\" app/config/parameters.yml"
185186
}
186187
sh "sed -i \"s#installer_data: .*#installer_data: '%kernel.root_dir%/../vendor/akeneo/catalogs/${pimVersion}/community/api/fixtures'#\" app/config/pim_parameters.yml"
@@ -289,7 +290,8 @@ void runIntegrationTest(String phpVersion, String client, String psrImplem, Stri
289290
runPim17IntegrationTest(phpVersion, client, psrImplem)
290291
break
291292
case "2.0":
292-
runPim20IntegrationTest(phpVersion, client, psrImplem)
293+
case "2.1":
294+
runPim2IntegrationTest(phpVersion, client, psrImplem, pimVersion)
293295
break
294296
default:
295297
error("pimVersion \"${pimVersion}\" is not a valid version managed by this script..")
@@ -328,7 +330,7 @@ def runPim17IntegrationTest(String phpVersion, String client, String psrImplem)
328330
files += sh (returnStdout: true, script: 'find /home/jenkins/php-api-client/tests/Common/Api -name "*Integration.php"').tokenize('\n')
329331

330332
for (file in files) {
331-
messages.add([
333+
def commands = [
332334
// Export "php" container id into shared file (We use ''' has we don't want groovy interpolation for $)
333335
// And clean kubernetes' docker prefix "docker://<container-id>" (Take care, pubsub uses Busybox's sed != GNU sed)
334336
[container: "pubsub", script: '''sh -c "kubectl get pod \\${POD_NAME} -o jsonpath='{$.status.containerStatuses[?(@.name==\\"php\\")].containerID}' | sed 's#docker://##g' > /home/jenkins/php-container-id" '''],
@@ -347,10 +349,14 @@ def runPim17IntegrationTest(String phpVersion, String client, String psrImplem)
347349
junit: [in: "/home/jenkins/php-api-client/", name: "junit_output.xml"],
348350
script: 'sudo php -d error_reporting="E_ALL" ./bin/phpunit -c phpunit.xml.dist '+file+' --log-junit junit_output.xml'
349351
]
350-
])
351-
}
352-
return messages
353-
})
352+
]
353+
def message = new net.sf.json.JSONObject()
354+
message.put("name",file)
355+
message.put("commands",commands)
356+
messages.add(message)
357+
}
358+
return messages
359+
}, verboseOutputs, dotsPerLine)
354360
}
355361

356362
/**
@@ -370,8 +376,7 @@ def runPim17IntegrationTest(String phpVersion, String client, String psrImplem)
370376
* @param client Name of the HTTP client package to use to run the test with
371377
* @param psrImplem Name of the PSR 7 implementation package to run the test with
372378
*/
373-
def runPim20IntegrationTest(String phpVersion, String client, String psrImplem) {
374-
String pimVersion = "2.0"
379+
def runPim2IntegrationTest(String phpVersion, String client, String psrImplem, String pimVersion) {
375380
String phpApiImageName = getApiClientGCRImageName(phpVersion, client, psrImplem)
376381
String pimImageName = getPimGCRImageName(pimVersion)
377382

@@ -382,8 +387,6 @@ def runPim20IntegrationTest(String phpVersion, String client, String psrImplem)
382387
// Find and store PHP test integration files to launch them in parallels
383388
files += sh (returnStdout: true, script: 'find /home/jenkins/php-api-client/tests/v2_0/Api -name "*Integration.php"').tokenize('\n')
384389
files += sh (returnStdout: true, script: 'find /home/jenkins/php-api-client/tests/Common/Api -name "*Integration.php"').tokenize('\n')
385-
def messages = new net.sf.json.JSONArray()
386-
387390
for (file in files) {
388391
def commands = [
389392
// Export "php" container id into shared file (We use ''' has we don't want groovy interpolation for $)
@@ -571,6 +574,7 @@ def queue(String phpApiImageName, String pimImageName, String pimVersion, String
571574
k8s_template = "pim_17_ce.yaml"
572575
break
573576
case "2.0":
577+
case "2.1":
574578
k8s_template = "pim_20_ce.yaml"
575579
break
576580
default:

0 commit comments

Comments
 (0)