@@ -13,6 +13,9 @@ pipeline {
1313 HOME = " ${ env.WORKSPACE} "
1414 KIND_VERSION = " v0.10.0"
1515 K8S_VERSION = " v1.20.2"
16+
17+ ELASTIC_STACK_VERSION_PREV = " 7.11.1"
18+ ELASTIC_STACK_VERSION_PREV_PREV = " 7.10.0"
1619 }
1720 options {
1821 timeout(time : 2 , unit : ' HOURS' )
@@ -52,8 +55,8 @@ pipeline {
5255 // Include hack to skip temporary files with "@tmp" suffix.
5356 // For reference: https://issues.jenkins.io/browse/JENKINS-52750
5457 findFiles()?. findAll{ ! it. name. endsWith(' @tmp' ) }?. collect{ it. name }?. sort()?. each {
55- if (isPrAffected(" ${ it } " )) {
56- integrations[" ${ it } " ] = {
58+ if (isPrAffected(it )) {
59+ integrations[it ] = {
5760 sleep(randomNumber(min : 1 , max : 5 ))
5861 node(' ubuntu-20 && immutable' ) {
5962 stage(" ${ it} : check" ) {
@@ -77,11 +80,15 @@ pipeline {
7780 dir(" ${ BASE_DIR} " ) {
7881 archiveArtifacts(allowEmptyArchive : true , artifacts : ' build/test-results/*.xml' )
7982 junit(allowEmptyResults : true , keepLongStdio : true , testResults : " build/test-results/*.xml" )
80- sh(label : " Collect Elastic stack logs" , script : " build/elastic-package stack dump -v --output build/elastic-stack-dump/${ it} " )
81- archiveArtifacts(allowEmptyArchive : true , artifacts : " build/elastic-stack-dump/${ it} /logs/*.log" )
83+ sh(label : " Collect Elastic stack logs" , script : " build/elastic-package stack dump -v --output build/elastic-stack-dump/latest/ ${ it} " )
84+ archiveArtifacts(allowEmptyArchive : true , artifacts : " build/elastic-stack-dump/latest/ ${ it} /logs/*.log" )
8285 sh(label : " Take down the Elastic stack" , script : ' build/elastic-package stack down -v' )
8386 }
8487 }
88+
89+ // Check compatibility with previous stacks
90+ checkPackageCompatibility(it, ELASTIC_STACK_VERSION_PREV )
91+ checkPackageCompatibility(it, ELASTIC_STACK_VERSION_PREV_PREV )
8592 }
8693 }
8794 }
@@ -230,4 +237,40 @@ def withCloudTestEnv(Closure body) {
230237 withEnvMask(vars : maskedVars) {
231238 body()
232239 }
240+ }
241+
242+ def checkPackageCompatibility (integrationName , stackVersion ) {
243+ if (! isPackageCompatible(integrationName, stackVersion)) {
244+ return // the package doesn't have to be supported by this stack
245+ }
246+
247+ try {
248+ dir(" ${ BASE_DIR} /packages/${ integrationName} " ) {
249+ sh(label : " Boot up the Elastic stack (${ stackVersion} )" , script : " ../../build/elastic-package stack up -d -v --version ${ stackVersion} " )
250+ sh(label : " Install integration: ${ integrationName} " , script : '''
251+ eval "$(../../build/elastic-package stack shellinit)"
252+ ../../build/elastic-package install -v''' )
253+ }
254+ } finally {
255+ dir(" ${ BASE_DIR} " ) {
256+ sh(label : " Collect Elastic stack logs" , script : " build/elastic-package stack dump -v --output build/elastic-stack-dump/${ stackVersion} /${ integrationName} " )
257+ archiveArtifacts(allowEmptyArchive : true , artifacts : " build/elastic-stack-dump/${ stackVersion} /${ integrationName} /logs/*.log" )
258+ sh(label : " Take down the Elastic stack (${ stackVersion} )" , script : ' build/elastic-package stack down -v' )
259+ }
260+ }
261+ }
262+
263+ def isPackageCompatible (integrationName , stackVersion ) {
264+ dir(" ${ BASE_DIR} /packages/${ integrationName} " ) {
265+ def r = sh(label : " Check compatibility with ${ stackVersion} " ,
266+ script : " ../../build/elastic-package install -v -c kibana.version=${ stackVersion} " ,
267+ returnStatus : true )
268+ if (r == 0 ) {
269+ echo " Package should be compatible"
270+ return true
271+ }
272+
273+ echo " Package is not compatible. Skipping."
274+ return false
275+ }
233276}
0 commit comments