@@ -31,7 +31,6 @@ pipeline {
31
31
choice(name : ' AGENT_LOG_LEVEL' , choices : LOG_LEVELS , description : " Agent's log level" )
32
32
choice(name : ' TESTS_LOG_LEVEL' , choices : LOG_LEVELS , description : " Tests' log level" )
33
33
booleanParam(name : ' INCLUDE_TESTING' , defaultValue : true , description : ' Should the testing stages be included?' )
34
- booleanParam(name : ' ADD_LIBUNWIND_DEPENDENCY' , defaultValue : false , description : ' Should Alpine (.apk) build have dependency on libunwind (to be able to log C call stack on crash)?' )
35
34
}
36
35
stages {
37
36
stage(' Initializing' ){
@@ -84,7 +83,7 @@ pipeline {
84
83
}
85
84
}
86
85
}
87
- stage(' Build binaries and basic testing ' ) {
86
+ stage(' Build binaries' ) {
88
87
options { skipDefaultCheckout() }
89
88
when {
90
89
beforeAgent true
@@ -94,50 +93,116 @@ pipeline {
94
93
matrix {
95
94
agent { label ' ubuntu-18.04 && immutable' }
96
95
axes {
96
+ axis {
97
+ name ' BUILD_ARCHITECTURE'
98
+ values ' linux-x86-64' , ' linuxmusl-x86-64'
99
+ }
100
+ }
101
+
102
+ stages {
103
+ stage(' Build PHP extension' ) {
104
+ steps {
105
+ initWorkspace(context : " Build-${ BUILD_ARCHITECTURE} " ) {
106
+ sh script : " BUILD_ARCHITECTURE=${ BUILD_ARCHITECTURE} make -f .ci/Makefile build" , label : ' build'
107
+ }
108
+ withGithubNotify(context : " Build-${ BUILD_ARCHITECTURE} " ) {
109
+ dir(" ${ BASE_DIR} " ){
110
+ stash includes : " agent/native/_build/${ BUILD_ARCHITECTURE} -release/ext/elastic_apm-*" , name : " built-extensions-${ BUILD_ARCHITECTURE} "
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+ stage(' PHP tests of extension' ) {
119
+ options { skipDefaultCheckout() }
120
+ when {
121
+ beforeAgent true
122
+ expression { return env. ONLY_DOCS == " false" }
123
+ }
124
+ failFast false
125
+ matrix {
126
+ agent { label ' ubuntu-18.04 && immutable' }
127
+ axes {
128
+ axis {
129
+ name ' BUILD_ARCHITECTURE'
130
+ values ' linux-x86-64' , ' linuxmusl-x86-64'
131
+ }
97
132
axis {
98
133
name ' PHP_VERSION'
99
134
// Make sure list of PHP versions supported by the Elastic APM PHP Agent is in sync.
100
135
// See the comment in .ci/shared.sh
101
136
values ' 7.2' , ' 7.3' , ' 7.4' , ' 8.0' , ' 8.1' , ' 8.2'
102
137
}
103
- axis {
104
- name ' DOCKERFILE'
105
- values ' Dockerfile' , ' Dockerfile.alpine'
106
- }
107
138
}
139
+
108
140
stages {
109
- stage(' Build PHP extension' ) {
141
+ stage(' Execute phpt tests' ) {
142
+ when {
143
+ beforeAgent true
144
+ expression { return params. INCLUDE_TESTING }
145
+ }
110
146
steps {
111
- echo " params.INCLUDE_TESTING: ${ params.INCLUDE_TESTING} "
112
- echo " params.ADD_LIBUNWIND_DEPENDENCY: ${ params.ADD_LIBUNWIND_DEPENDENCY} "
113
- initWorkspace(context : " Build-${ PHP_VERSION} " ) {
147
+ initWorkspace(context : " PHPT-${ PHP_VERSION} " , tab : " tests" ) {
114
148
// When running in the CI with multiple parallel stages
115
149
// the access could be considered as a DDOS attack.
116
- retryWithSleep(retries : 3 , seconds : 5 , backoff : true ) {
117
- sh script : " PHP_VERSION =${ PHP_VERSION } DOCKERFILE =${ DOCKERFILE } ADD_LIBUNWIND_DEPENDENCY= ${ params.ADD_LIBUNWIND_DEPENDENCY } make -f .ci/Makefile prepare" , label : ' prepare docker image'
150
+ retryWithSleep(retries : 3 , seconds : 45 , backoff : true ) {
151
+ sh script : " BUILD_ARCHITECTURE =${ BUILD_ARCHITECTURE } PHP_VERSION =${ PHP_VERSION } make -f .ci/Makefile prepare" , label : ' prepare docker image'
118
152
}
119
- sh script : " PHP_VERSION=${ PHP_VERSION} DOCKERFILE=${ DOCKERFILE} make -f .ci/Makefile build" , label : ' build'
153
+ unstash " built-extensions-${ BUILD_ARCHITECTURE} "
154
+ sh script : " BUILD_ARCHITECTURE=${ BUILD_ARCHITECTURE} PHP_VERSION=${ PHP_VERSION} make -f .ci/Makefile run-phpt-tests" , label : ' run-phpt-tests'
120
155
}
121
156
}
122
157
}
158
+ }
159
+ }
160
+ }
161
+ stage(' Static analysis and tests' ) {
162
+ options { skipDefaultCheckout() }
163
+ when {
164
+ beforeAgent true
165
+ expression { return env. ONLY_DOCS == " false" }
166
+ }
167
+ failFast false
168
+ matrix {
169
+ agent { label ' ubuntu-18.04 && immutable' }
170
+ axes {
171
+ axis {
172
+ name ' PHP_VERSION'
173
+ // Make sure list of PHP versions supported by the Elastic APM PHP Agent is in sync.
174
+ // See the comment in .ci/shared.sh
175
+ values ' 7.2' , ' 7.3' , ' 7.4' , ' 8.0' , ' 8.1' , ' 8.2'
176
+ }
177
+ axis {
178
+ name ' DOCKERFILE'
179
+ values ' Dockerfile' , ' Dockerfile.alpine'
180
+ }
181
+ }
182
+ stages {
123
183
stage(' Static analysis and unit tests' ) {
124
184
when {
125
185
beforeAgent true
126
186
expression { return params. INCLUDE_TESTING }
127
187
}
128
188
steps {
189
+ echo " params.INCLUDE_TESTING: ${ params.INCLUDE_TESTING} "
129
190
echo " params.AGENT_LOG_LEVEL: ${ params.AGENT_LOG_LEVEL} "
130
191
echo " params.AGENT_LOG_LEVEL == null: " + (params. AGENT_LOG_LEVEL == null )
131
192
echo " params.TESTS_LOG_LEVEL: ${ params.TESTS_LOG_LEVEL} "
132
193
echo " params.TESTS_LOG_LEVEL == null: " + (params. TESTS_LOG_LEVEL == null )
133
194
echo " addEnvVarsFromParams([]): " + addEnvVarsFromParams([])
134
- withGithubNotify(context : " Static-Check-Unit-Tests-${ PHP_VERSION} " , tab : ' tests' ) {
195
+
196
+ initWorkspace(context : " Static-Check-Unit-Tests-${ PHP_VERSION} " , tab : " tests" ) {
135
197
withEnv(addEnvVarsFromParams([])) {
136
198
echo " env.ELASTIC_APM_LOG_LEVEL: ${ env.ELASTIC_APM_LOG_LEVEL} "
137
199
echo " env.TESTS_LOG_LEVEL: ${ env.TESTS_LOG_LEVEL} "
138
- dir(" ${ BASE_DIR} " ){
139
- sh script : " PHP_VERSION=${ PHP_VERSION} DOCKERFILE=${ DOCKERFILE} make -f .ci/Makefile static-check-unit-test" , label : ' static-check-unit-test'
200
+
201
+ retryWithSleep(retries : 3 , seconds : 45 , backoff : true ) {
202
+ sh script : " PHP_VERSION=${ PHP_VERSION} DOCKERFILE=${ DOCKERFILE} make -f .ci/Makefile prepare" , label : ' prepare docker image'
140
203
}
204
+
205
+ sh script : " PHP_VERSION=${ PHP_VERSION} DOCKERFILE=${ DOCKERFILE} make -f .ci/Makefile static-check-unit-test" , label : ' static-check-unit-test'
141
206
}
142
207
}
143
208
}
@@ -147,16 +212,6 @@ pipeline {
147
212
}
148
213
}
149
214
}
150
- stage(' Build parts for packages' ) {
151
- steps {
152
- withGithubNotify(context : " Generate-For-Package-${ PHP_VERSION} " ) {
153
- dir(" ${ BASE_DIR} " ){
154
- sh script : " PHP_VERSION=${ PHP_VERSION} DOCKERFILE=${ DOCKERFILE} ADD_LIBUNWIND_DEPENDENCY=${ params.ADD_LIBUNWIND_DEPENDENCY} make -f .ci/Makefile generate-for-package" , label : ' generate-for-package'
155
- stash includes : ' src/ext/modules/*.so' , name : " generate-for-package-${ PHP_VERSION} -${ DOCKERFILE} "
156
- }
157
- }
158
- }
159
- }
160
215
}
161
216
}
162
217
}
@@ -374,10 +429,9 @@ pipeline {
374
429
*/
375
430
def packageGeneration (def args = [:]) {
376
431
def local = args. get(' local' , false )
377
- args. versions. each { version ->
378
- unstash " generate-for-package-${ version} -Dockerfile"
379
- unstash " generate-for-package-${ version} -Dockerfile.alpine"
380
- }
432
+ unstash " built-extensions-linux-x86-64"
433
+ unstash " built-extensions-linuxmusl-x86-64"
434
+
381
435
if (local) {
382
436
// VERSION=1.0.0 is needed to override the current version.
383
437
// current version is >1.0.0, and this is the way we can
@@ -387,7 +441,8 @@ def packageGeneration(def args = [:]) {
387
441
sh script : " mv build/packages build/local" , label : ' prepare-local-upgrade-agent'
388
442
} else {
389
443
// Archive the so files to be downloaded if possible.
390
- archiveArtifacts(allowEmptyArchive : true , artifacts : ' src/ext/modules/*.so' )
444
+ archiveArtifacts(allowEmptyArchive : true , artifacts : ' agent/native/_build/*-release/ext/elastic_apm-*' )
445
+
391
446
sh script : " make -C packaging package" , label : ' package'
392
447
sh script : " make -C packaging info" , label : ' package info'
393
448
// checksum files are regenerated by the signing component in the internal-ci instance.
@@ -419,8 +474,10 @@ def packageWorkspace(def args = [:], Closure body){
419
474
unstash (args. shouldUseSignedBinaries ? env. SIGNED_ARTIFACTS : ' package' )
420
475
// When running in the CI sometimes the docker build might fail for
421
476
// some environmental issues, let's retry
422
- retryWithSleep(retries : 3 , seconds : 5 , backoff : true ) {
423
- sh script : " PHP_VERSION=${ PHP_VERSION} make -C packaging ${ args.prepareGoal} " , label : " ${ args.prepareGoal} for ${ PHP_VERSION} "
477
+ retryWithSleep(retries : 3 , seconds : 45 , backoff : true ) {
478
+ if (args. prepareGoal != null ) {
479
+ sh script : " PHP_VERSION=${ PHP_VERSION} make -C packaging ${ args.prepareGoal} " , label : " ${ args.prepareGoal} for ${ PHP_VERSION} "
480
+ }
424
481
}
425
482
body()
426
483
}
@@ -546,7 +603,6 @@ def addEnvVarsFromParams(def withEnvList) {
546
603
if (params. TESTS_LOG_LEVEL != null && ! params. TESTS_LOG_LEVEL . equals(LOG_LEVEL_NOT_SET )) {
547
604
withEnvList. add(' ELASTIC_APM_PHP_TESTS_LOG_LEVEL=' + params. TESTS_LOG_LEVEL )
548
605
}
549
- withEnvList. add(' ADD_LIBUNWIND_DEPENDENCY=' + params. ADD_LIBUNWIND_DEPENDENCY )
550
606
return withEnvList
551
607
}
552
608
@@ -574,7 +630,6 @@ def buildLabel(def args = [:]) {
574
630
def lifecycleTesting (def args = [:]) {
575
631
runTestingCommand(
576
632
args + [
577
- prepareGoal : " prepare-${ args.linuxPackageType} " ,
578
633
testingCommand : " make -C packaging ${ args.linuxPackageType} -lifecycle-testing"
579
634
]
580
635
)
@@ -583,7 +638,6 @@ def lifecycleTesting(def args = [:]) {
583
638
def lifecycleTestingOnProdServerKind (def args = [:]) {
584
639
runTestingCommand(
585
640
args + [
586
- prepareGoal : " prepare-${ args.linuxPackageType} -${ args.prodServerKind} " ,
587
641
testingCommand : " make -C packaging ${ args.linuxPackageType} -lifecycle-testing-in-${ args.prodServerKind} " ,
588
642
]
589
643
)
@@ -592,7 +646,6 @@ def lifecycleTestingOnProdServerKind(def args = [:]) {
592
646
def phpUpgradeTesting (def args = [:]) {
593
647
runTestingCommand(
594
648
args + [
595
- prepareGoal : " prepare-${ args.linuxPackageType} " ,
596
649
testingCommand : " PHP_VERSION=${ args.phpVersion} make -C packaging ${ args.linuxPackageType} -php-upgrade-testing"
597
650
]
598
651
)
0 commit comments