Skip to content
Merged
51 changes: 47 additions & 4 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ pipeline {
HOME = "${env.WORKSPACE}"
KIND_VERSION = "v0.10.0"
K8S_VERSION = "v1.20.2"

ELASTIC_STACK_VERSION_PREV = "7.11.1"
ELASTIC_STACK_VERSION_PREV_PREV = "7.10.0"
}
options {
timeout(time: 2, unit: 'HOURS')
Expand Down Expand Up @@ -52,8 +55,8 @@ pipeline {
// Include hack to skip temporary files with "@tmp" suffix.
// For reference: https://issues.jenkins.io/browse/JENKINS-52750
findFiles()?.findAll{ !it.name.endsWith('@tmp') }?.collect{ it.name }?.sort()?.each {
if (isPrAffected("${it}")) {
integrations["${it}"] = {
if (isPrAffected(it)) {
integrations[it] = {
sleep(randomNumber(min: 1, max: 5))
node('ubuntu-20 && immutable') {
stage("${it}: check") {
Expand All @@ -77,11 +80,15 @@ pipeline {
dir("${BASE_DIR}") {
archiveArtifacts(allowEmptyArchive: true, artifacts: 'build/test-results/*.xml')
junit(allowEmptyResults: true, keepLongStdio: true, testResults: "build/test-results/*.xml")
sh(label: "Collect Elastic stack logs", script: "build/elastic-package stack dump -v --output build/elastic-stack-dump/${it}")
archiveArtifacts(allowEmptyArchive: true, artifacts: "build/elastic-stack-dump/${it}/logs/*.log")
sh(label: "Collect Elastic stack logs", script: "build/elastic-package stack dump -v --output build/elastic-stack-dump/latest/${it}")
archiveArtifacts(allowEmptyArchive: true, artifacts: "build/elastic-stack-dump/latest/${it}/logs/*.log")
sh(label: "Take down the Elastic stack", script: 'build/elastic-package stack down -v')
}
}

// Check compatibility with previous stacks
checkPackageCompatibility(it, ELASTIC_STACK_VERSION_PREV)
checkPackageCompatibility(it, ELASTIC_STACK_VERSION_PREV_PREV)
}
}
}
Expand Down Expand Up @@ -230,4 +237,40 @@ def withCloudTestEnv(Closure body) {
withEnvMask(vars: maskedVars) {
body()
}
}

def checkPackageCompatibility(integrationName, stackVersion) {
if (!isPackageCompatible(integrationName, stackVersion)) {
return // the package doesn't have to be supported by this stack
}

try {
dir("${BASE_DIR}/packages/${integrationName}") {
sh(label: "Boot up the Elastic stack (${stackVersion})", script: "../../build/elastic-package stack up -d -v --version ${stackVersion}")
sh(label: "Install integration: ${integrationName}", script: '''
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it seems we are calling a package as compatible if we are able to install it. Is this sufficient or do we also want to run tests for the package against the previous stack versions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I prefer to stick to installation as testing will elongate test execution much (+20minutes).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. Does installing a package result in any testing? In other words, what are the reasons this step would fail in CI?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g. installation can check if all Kibana objects can be installed (correct migrationVersion field).

eval "$(../../build/elastic-package stack shellinit)"
../../build/elastic-package install -v''')
}
} finally {
dir("${BASE_DIR}") {
sh(label: "Collect Elastic stack logs", script: "build/elastic-package stack dump -v --output build/elastic-stack-dump/${stackVersion}/${integrationName}")
archiveArtifacts(allowEmptyArchive: true, artifacts: "build/elastic-stack-dump/${stackVersion}/${integrationName}/logs/*.log")
sh(label: "Take down the Elastic stack (${stackVersion})", script: 'build/elastic-package stack down -v')
}
}
}

def isPackageCompatible(integrationName, stackVersion) {
dir("${BASE_DIR}/packages/${integrationName}") {
def r = sh(label: "Check compatibility with ${stackVersion}",
script: "../../build/elastic-package install -v -c kibana.version=${stackVersion}",
returnStatus: true)
if (r == 0) {
echo "Package should be compatible"
return true
}

echo "Package is not compatible. Skipping."
return false
}
}
5 changes: 5 additions & 0 deletions packages/docker/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "0.1.1"
changes:
- description: Fix compatibility with Kibana
type: enhancement # can be one of: enhancement, bugfix, breaking-change
link: https://github.com/elastic/integrations/pull/740
- version: "0.1.0"
changes:
- description: initial release
Expand Down
4 changes: 2 additions & 2 deletions packages/docker/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: docker
title: Docker
version: 0.1.0
version: 0.1.1
release: beta
description: Docker Integration
type: integration
Expand All @@ -20,7 +20,7 @@ categories:
- containers
- os_system
conditions:
kibana.version: ^7.9.0
kibana.version: ^7.11.0
policy_templates:
- name: docker
title: Docker metrics
Expand Down
5 changes: 5 additions & 0 deletions packages/iptables/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "0.0.3"
changes:
- description: Fix compatibility with Kibana
type: enhancement # can be one of: enhancement, bugfix, breaking-change
link: https://github.com/elastic/integrations/pull/740
- version: "0.0.1"
changes:
- description: initial release
Expand Down
4 changes: 2 additions & 2 deletions packages/iptables/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: iptables
title: Iptables
version: 0.0.2
version: 0.0.3
release: experimental
description: Iptables Integration
type: integration
Expand All @@ -15,7 +15,7 @@ categories:
- network
- security
conditions:
kibana.version: ^7.9.0
kibana.version: ^7.11.0
screenshots:
- src: /img/kibana-iptables.png
title: kibana iptables
Expand Down
5 changes: 5 additions & 0 deletions packages/microsoft/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "0.4.2"
changes:
- description: Fix compatibility with Kibana
type: enhancement # can be one of: enhancement, bugfix, breaking-change
link: https://github.com/elastic/integrations/pull/740
- version: "0.4.1"
changes:
- description: Drop cloud field in Defender ATP to set it with provided values
Expand Down
4 changes: 2 additions & 2 deletions packages/microsoft/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
format_version: 1.0.0
name: microsoft
title: Microsoft
version: 0.4.1
version: 0.4.2
description: Microsoft Integration
categories:
- "network"
Expand All @@ -11,7 +11,7 @@ release: experimental
license: basic
type: integration
conditions:
kibana.version: '^7.9.0'
kibana.version: '^7.11.0'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't understand why we need these kibana.version bumps here and in other packages in this PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's because of the fact that these packages are not compatible with older Kibana stacks.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Is there a reason these changes are part of this PR? In other words, do we need these changes anyway even without this PR? Did the compatibility checks introduced in this PR catch that these packages needed kibana version bumps?

Copy link
Copy Markdown
Contributor Author

@mtojek mtojek Mar 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did the compatibility checks introduced in this PR catch that these packages needed kibana version bumps?

Yes, exactly this. Otherwise the CI for this PR will be red.

policy_templates:
- name: microsoft
title: Microsoft
Expand Down
5 changes: 5 additions & 0 deletions packages/nginx/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "0.3.10"
changes:
- description: Fix compatibility with Kibana
type: enhancement # can be one of: enhancement, bugfix, breaking-change
link: https://github.com/elastic/integrations/pull/740
- version: "0.1.0"
changes:
- description: initial release
Expand Down
4 changes: 2 additions & 2 deletions packages/nginx/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
format_version: 1.0.0
name: nginx
title: Nginx
version: 0.3.9
version: 0.3.10
license: basic
description: Nginx Integration
type: integration
Expand All @@ -10,7 +10,7 @@ categories:
- security
release: experimental
conditions:
kibana.version: '^7.9.0'
kibana.version: '^7.11.0'
screenshots:
- src: /img/nginx-metrics-overview.png
title: Nginx metrics overview
Expand Down
5 changes: 5 additions & 0 deletions packages/osquery/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "0.1.1"
changes:
- description: Fix compatibility with Kibana
type: enhancement # can be one of: enhancement, bugfix, breaking-change
link: https://github.com/elastic/integrations/pull/740
- version: "0.0.1"
changes:
- description: initial release
Expand Down
4 changes: 2 additions & 2 deletions packages/osquery/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: osquery
title: Osquery
version: 0.1.0
version: 0.1.1
release: experimental
description: Osquery Integration
type: integration
Expand All @@ -15,7 +15,7 @@ categories:
- security
- os_system
conditions:
kibana.version: ^7.9.0
kibana.version: ^7.11.0
screenshots:
- src: /img/kibana-osquery-compatibility.png
title: kibana osquery compatibility
Expand Down
5 changes: 5 additions & 0 deletions packages/santa/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "0.0.2"
changes:
- description: Fix compatibility with Kibana
type: enhancement # can be one of: enhancement, bugfix, breaking-change
link: https://github.com/elastic/integrations/pull/740
- version: "0.0.1"
changes:
- description: initial release
Expand Down
4 changes: 2 additions & 2 deletions packages/santa/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: santa
title: Google Santa
version: 0.0.1
version: 0.0.2
release: experimental
description: Google Santa Integration
type: integration
Expand All @@ -14,7 +14,7 @@ categories:
- security
- os_system
conditions:
kibana.version: ^7.9.0
kibana.version: ^7.11.0
screenshots:
- src: /img/kibana-santa-log-overview.png
title: kibana santa log overview
Expand Down