Skip to content

Commit 06284f6

Browse files
authored
Enable package compatibility checks with older Elastic stacks (#740)
* Start stack two more times * Check package compatibility with older stacks * Correct versions * nit * Fix * Fix: ignore prerelease * Adjust versions * Update release numbers * Fix: shellinit * Fix * Fix * Fix * Fix compatibility with Kibana
1 parent 256d029 commit 06284f6

File tree

13 files changed

+89
-16
lines changed

13 files changed

+89
-16
lines changed

.ci/Jenkinsfile

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

packages/docker/changelog.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# newer versions go on top
2+
- version: "0.1.1"
3+
changes:
4+
- description: Fix compatibility with Kibana
5+
type: enhancement # can be one of: enhancement, bugfix, breaking-change
6+
link: https://github.com/elastic/integrations/pull/740
27
- version: "0.1.0"
38
changes:
49
- description: initial release

packages/docker/manifest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: docker
22
title: Docker
3-
version: 0.1.0
3+
version: 0.1.1
44
release: beta
55
description: Docker Integration
66
type: integration
@@ -20,7 +20,7 @@ categories:
2020
- containers
2121
- os_system
2222
conditions:
23-
kibana.version: ^7.9.0
23+
kibana.version: ^7.11.0
2424
policy_templates:
2525
- name: docker
2626
title: Docker metrics

packages/iptables/changelog.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# newer versions go on top
2+
- version: "0.0.3"
3+
changes:
4+
- description: Fix compatibility with Kibana
5+
type: enhancement # can be one of: enhancement, bugfix, breaking-change
6+
link: https://github.com/elastic/integrations/pull/740
27
- version: "0.0.1"
38
changes:
49
- description: initial release

packages/iptables/manifest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: iptables
22
title: Iptables
3-
version: 0.0.2
3+
version: 0.0.3
44
release: experimental
55
description: Iptables Integration
66
type: integration
@@ -15,7 +15,7 @@ categories:
1515
- network
1616
- security
1717
conditions:
18-
kibana.version: ^7.9.0
18+
kibana.version: ^7.11.0
1919
screenshots:
2020
- src: /img/kibana-iptables.png
2121
title: kibana iptables

packages/microsoft/changelog.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# newer versions go on top
2+
- version: "0.4.2"
3+
changes:
4+
- description: Fix compatibility with Kibana
5+
type: enhancement # can be one of: enhancement, bugfix, breaking-change
6+
link: https://github.com/elastic/integrations/pull/740
27
- version: "0.4.1"
38
changes:
49
- description: Drop cloud field in Defender ATP to set it with provided values

packages/microsoft/manifest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
format_version: 1.0.0
22
name: microsoft
33
title: Microsoft
4-
version: 0.4.1
4+
version: 0.4.2
55
description: Microsoft Integration
66
categories:
77
- "network"
@@ -11,7 +11,7 @@ release: experimental
1111
license: basic
1212
type: integration
1313
conditions:
14-
kibana.version: '^7.9.0'
14+
kibana.version: '^7.11.0'
1515
policy_templates:
1616
- name: microsoft
1717
title: Microsoft

packages/nginx/changelog.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# newer versions go on top
2+
- version: "0.3.10"
3+
changes:
4+
- description: Fix compatibility with Kibana
5+
type: enhancement # can be one of: enhancement, bugfix, breaking-change
6+
link: https://github.com/elastic/integrations/pull/740
27
- version: "0.1.0"
38
changes:
49
- description: initial release

packages/nginx/manifest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
format_version: 1.0.0
22
name: nginx
33
title: Nginx
4-
version: 0.3.9
4+
version: 0.3.10
55
license: basic
66
description: Nginx Integration
77
type: integration
@@ -10,7 +10,7 @@ categories:
1010
- security
1111
release: experimental
1212
conditions:
13-
kibana.version: '^7.9.0'
13+
kibana.version: '^7.11.0'
1414
screenshots:
1515
- src: /img/nginx-metrics-overview.png
1616
title: Nginx metrics overview

packages/osquery/changelog.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# newer versions go on top
2+
- version: "0.1.1"
3+
changes:
4+
- description: Fix compatibility with Kibana
5+
type: enhancement # can be one of: enhancement, bugfix, breaking-change
6+
link: https://github.com/elastic/integrations/pull/740
27
- version: "0.0.1"
38
changes:
49
- description: initial release

0 commit comments

Comments
 (0)