Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit 9839150

Browse files
mdelapenyamergify-bot
authored andcommitted
feat: add support for running the tests in ARM (#707)
* feat: add support for running the tests in ARM * fix: arm workers are not immutable yet * chore: calculate artifact from the GOARCH variable At this moment we support amd64 and arm64 * chore: run elasticsearch in the right platform * chore: add log for architecture * chore: print env variable for GOARCH * chore: set GOARCH based in the worker * fix: wrong copy&paste * chore: install k8s dependencies on ARM * chore: install godog using GOARCH * fix: proper values for GO env in Makefile * chore: add log when requesting a node * fix: define Groovy variable * chore: use proper platform for kibana * chore: simplify platforms selection logic * fix: use proper CI label for node selector * chore: remove running containers in clean-docker script * chore: clean up docker state on mutable workers * chore: use parallel branch name for filebeat logs * fix: add forgotten double quotes * chore: print Docker compose version On ARM * chore: use aarch64 architecture for RPM packages * chore: support ARM in tar installer * fix: proper arch for TAR installer * chore: log when the artifact is found * chore: be defensive about no running containers * chore: add tests for RPM artifact name * chore: add tests for x86_64 TAR artifact * chore: remove docker label from CI workers * chore: separate ARM tests in a second parallel stage This pretends to avoid using too many workers, adding a second layer for ARM. * chore: update stage name * fix: update arm target platform * chore: use GOARCH in the junit file * chore: use GOARCH in filebeat logs * chore: run all stages in parallel * chore: add platform to log when skipping tests * fix: use a filebeat version that supports multiplatform * chore: do not run integrations on ARM See elastic/beats#25195 * chore: move test resources for ARM * chore: use staging environment for package-registry See https://github.com/elastic/package-storage * fix: remove clean because arm workers are now immutable * chore: use new multiplatform images * chore: use new multiplatform base images for fleet-server * chore: add platform to elastic-agent cloud flavour * fix: use proper variable for platform * chore: do not clean up installer's workspace Because we are using ephemeral workers, we do not want to remove previous files * Revert "chore: do not clean up installer's workspace" This reverts commit 9104501. * chore(ci): skip pull of images from code * Revert "chore(ci): skip pull of images from code" This reverts commit 01cc441. * chore: set platform when pulling images * chore: update packer cache with our systemd images * fix: request proper platform image for the agent * feat: exclude scenarios per platform * chore: remove tags for endpoint, as they are not used at all They are also blocking the addition of a parent tag at the feature level, as maximun number of tags is 3 * fix: skip endpoint integration on ARM64 * feat: provide supported platforms at the scenario level on CI The scenario will be able to override its parent suite's platforms, making possible to select different platforms at the scenario level. * fix: use proper length method for groovy arrays * fix: groovy arrays use size * fix: override suite platforms per scenario * chore: update Jenkins label for arm workers Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com> * chore: simplify platforms, reusing stack * chore: explicitly pass GOARCH to CI script * Revert "chore: update Jenkins label for arm workers" This reverts commit 9ef81ca. Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com> (cherry picked from commit e1a97f3) # Conflicts: # cli/config/compose/profiles/fleet/docker-compose.yml # cli/config/compose/profiles/metricbeat/docker-compose.yml # e2e/_suites/fleet/stand-alone.go # internal/installer/elasticagent_deb.go # internal/installer/elasticagent_docker.go # internal/installer/elasticagent_rpm.go # internal/installer/elasticagent_tar.go # internal/utils/utils_test.go
1 parent 049160e commit 9839150

37 files changed

+988
-68
lines changed

.ci/.e2e-tests.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ SUITES:
1212
tags: "metricbeat"
1313
- suite: "fleet"
1414
platforms:
15+
- "arm64"
1516
- "ubuntu-18.04"
1617
scenarios:
1718
- name: "Fleet"
1819
pullRequestFilter: " && ~debian"
1920
tags: "fleet_mode_agent"
2021
- name: "Endpoint Integration"
22+
platforms:
23+
- "ubuntu-18.04"
2124
pullRequestFilter: " && ~debian"
2225
tags: "agent_endpoint_integration"
2326
- name: "Linux Integration"

.ci/Jenkinsfile

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,16 +248,23 @@ def checkTestSuite(Map parallelTasks = [:], Map item = [:]) {
248248
def suite = item.suite
249249
def platforms = item.platforms
250250
item.scenarios.each { scenario ->
251+
def name = scenario.name
252+
def platformsValue = platforms
253+
def scenarioPlatforms = scenario.platforms
254+
if (scenarioPlatforms?.size() > 0) {
255+
// scenario platforms take precedence over suite platforms, overriding them
256+
platformsValue = scenarioPlatforms
257+
}
251258
def pullRequestFilter = scenario.containsKey('pullRequestFilter') ? scenario.pullRequestFilter : ''
252259
def tags = scenario.tags
253260
def regexps = [ "^e2e/_suites/${suite}/.*", "^.ci/.*", "^cli/.*", "^e2e/.*\\.go", "^internal/.*\\.go" ]
254261
if ("${FORCE_SKIP_GIT_CHECKS}" == "true" || isGitRegionMatch(patterns: regexps, shouldMatchAll: false)) {
255-
platforms.each { platform ->
262+
platformsValue.each { platform ->
256263
log(level: 'INFO', text: "Adding ${platform}:${suite}:${tags} test suite to the build execution")
257-
parallelTasks["${platform}_${suite}_${tags}"] = generateFunctionalTestStep(platform: "${platform}", suite: "${suite}", tags: "${tags}", pullRequestFilter: "${pullRequestFilter}")
264+
parallelTasks["${platform}_${suite}_${tags}"] = generateFunctionalTestStep(name: "${name}", platform: "${platform}", suite: "${suite}", tags: "${tags}", pullRequestFilter: "${pullRequestFilter}")
258265
}
259266
} else {
260-
log(level: 'WARN', text: "The ${suite}:${tags} test suite won't be executed because there are no modified files")
267+
log(level: 'WARN', text: "The ${platform}:${suite}:${tags} test suite won't be executed because there are no modified files")
261268
}
262269
}
263270
}
@@ -280,6 +287,7 @@ def doNotifyBuildResult(boolean slackNotify) {
280287
}
281288

282289
def generateFunctionalTestStep(Map args = [:]){
290+
def name = args.get('name')
283291
def platform = args.get('platform')
284292
def suite = args.get('suite')
285293
def tags = args.get('tags')
@@ -297,7 +305,17 @@ def generateFunctionalTestStep(Map args = [:]){
297305
if (isPR() || isUpstreamTrigger(filter: 'PR-')) {
298306
tags += pullRequestFilter
299307
}
300-
def workerLabels = "${platform} && immutable && docker"
308+
309+
def goArch = "amd64"
310+
def workerLabels = "${platform} && immutable"
311+
if (platform == "arm64") {
312+
goArch = "arm64"
313+
// ARM is not ready as immutable workers
314+
workerLabels = "arm"
315+
}
316+
317+
// Skip scenarios per platform
318+
tags += " && ~@skip:${goArch}"
301319

302320
return {
303321
withNode(labels: "${workerLabels}", sleepMax: 20, forceWorkspace: true){
@@ -308,10 +326,12 @@ def generateFunctionalTestStep(Map args = [:]){
308326
if(isInstalled(tool: 'docker', flag: '--version')) {
309327
dockerLogin(secret: "${DOCKER_ELASTIC_SECRET}", registry: "${DOCKER_REGISTRY}")
310328
}
311-
filebeat(output: "docker_logs_${suite}_${tags}.log", workdir: "${env.WORKSPACE}"){
329+
filebeat(image: 'docker.elastic.co/beats/filebeat:7.13.0-SNAPSHOT', output: "docker_logs_${goArch}_${suite}_${name}.log", workdir: "${env.WORKSPACE}"){
312330
dir("${BASE_DIR}"){
313-
withSecretVault(secret: "${VAULT_INSTRUMENTATION_SECRET}", user_key: "apmServerToken", user_var_name: "APM_SECRET_TOKEN", pass_key: "apmServerUrl", pass_var_name: "APM_SERVER_URL"){
314-
sh script: """.ci/scripts/functional-test.sh "${suite}" "${tags}" "${STACK_VERSION}" "${BEAT_VERSION}" """, label: "Run functional tests for ${suite}:${tags}"
331+
withEnv(["GOARCH=${goArch}"]) {
332+
withSecretVault(secret: "${VAULT_INSTRUMENTATION_SECRET}", user_key: "apmServerToken", user_var_name: "APM_SECRET_TOKEN", pass_key: "apmServerUrl", pass_var_name: "APM_SERVER_URL"){
333+
sh script: """.ci/scripts/functional-test.sh "${suite}" "${tags}" "${STACK_VERSION}" "${BEAT_VERSION}" """, label: "Run functional tests for ${suite}:${tags}"
334+
}
315335
}
316336
}
317337
}

.ci/packer_cache.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ source /usr/local/bin/bash_standard_lib.sh
55

66
readonly GO_VERSION=$(cat .go-version)
77

8-
DOCKER_IMAGES="centos/systemd:latest
9-
alehaa/debian-systemd:stretch
10-
docker.elastic.co/beats/filebeat:7.10.1
8+
DOCKER_IMAGES="docker.elastic.co/observability-ci/centos-systemd:latest
9+
docker.elastic.co/observability-ci/debian-systemd:latest
10+
docker.elastic.co/beats/filebeat:7.13.0-SNAPSHOT
1111
docker.elastic.co/observability-ci/picklesdoc:2.20.1
1212
golang:${GO_VERSION}-stretch
1313
"

.ci/scripts/clean-docker.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ set -euxo pipefail
1212
readonly VERSION="$(cat $(pwd)/.stack-version)"
1313

1414
main() {
15+
# remove running containers
16+
docker container rm -fv $(docker container ls -a --quiet) || true
17+
1518
# refresh docker images
1619
cat <<EOF >.tmp_images
1720
docker.elastic.co/beats/elastic-agent:${VERSION}

.ci/scripts/functional-test.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ SUITE=${1:-''}
2222
TAGS=${2:-''}
2323
STACK_VERSION=${3:-"${BASE_VERSION}"}
2424
BEAT_VERSION=${4:-"${BASE_VERSION}"}
25+
GOARCH=${GOARCH:-"amd64"}
2526

2627
## Install the required dependencies for the given SUITE
2728
.ci/scripts/install-test-dependencies.sh "${SUITE}"
2829

2930
rm -rf outputs || true
3031
mkdir -p outputs
3132

32-
REPORT="$(pwd)/outputs/TEST-${SUITE}"
33+
REPORT="$(pwd)/outputs/TEST-${GOARCH}-${SUITE}"
3334

34-
TAGS="${TAGS}" FORMAT=junit:${REPORT}.xml STACK_VERSION=${STACK_VERSION} BEAT_VERSION=${BEAT_VERSION} make --no-print-directory -C e2e/_suites/${SUITE} functional-test
35+
TAGS="${TAGS}" FORMAT=junit:${REPORT}.xml GOARCH=${GOARCH} STACK_VERSION=${STACK_VERSION} BEAT_VERSION=${BEAT_VERSION} make --no-print-directory -C e2e/_suites/${SUITE} functional-test

.ci/scripts/install-helm-test-dependencies.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,33 @@ set -euxo pipefail
1414
# - KUBERNETES_VERSION - that's the Kubernetes version which will be installed and enabled.
1515
#
1616

17+
GOARCH=${GOARCH:-"amd64"}
1718
MSG="parameter missing."
1819
HOME=${HOME:?$MSG}
1920

2021
HELM_VERSION="${HELM_VERSION:-"3.5.2"}"
21-
HELM_TAR_GZ_FILE="helm-v${HELM_VERSION}-linux-amd64.tar.gz"
22+
HELM_TAR_GZ_FILE="helm-v${HELM_VERSION}-linux-${GOARCH}.tar.gz"
2223
KIND_VERSION="v${KIND_VERSION:-"0.10.0"}"
2324
KUBERNETES_VERSION="${KUBERNETES_VERSION:-"1.18.2"}"
2425

2526
HELM_CMD="${HOME}/bin/helm"
2627
KBC_CMD="${HOME}/bin/kubectl"
2728

2829
# Install kind as a Go binary
29-
GO111MODULE="on" go get sigs.k8s.io/kind@${KIND_VERSION}
30+
GOARCH=${GOARCH} GO111MODULE="on" go get sigs.k8s.io/kind@${KIND_VERSION}
3031

3132
mkdir -p "${HOME}/bin" "${HOME}/.kube"
3233
touch "${HOME}/.kube/config"
3334

3435
# Install kubectl
35-
curl -sSLo "${KBC_CMD}" "https://storage.googleapis.com/kubernetes-release/release/v${KUBERNETES_VERSION}/bin/linux/amd64/kubectl"
36+
curl -sSLo "${KBC_CMD}" "https://storage.googleapis.com/kubernetes-release/release/v${KUBERNETES_VERSION}/bin/linux/${GOARCH}/kubectl"
3637
chmod +x "${KBC_CMD}"
3738
${KBC_CMD} version --client
3839

3940
# Install Helm
4041
curl -o ${HELM_TAR_GZ_FILE} "https://get.helm.sh/${HELM_TAR_GZ_FILE}"
4142
tar -xvf ${HELM_TAR_GZ_FILE}
42-
mv linux-amd64/helm ${HELM_CMD}
43+
mv linux-${GOARCH}/helm ${HELM_CMD}
4344
chmod +x "${HELM_CMD}"
4445
${HELM_CMD} version --client
45-
rm -fr linux-amd64 ${HELM_TAR_GZ_FILE}
46+
rm -fr linux-${GOARCH} ${HELM_TAR_GZ_FILE}

cli/config/compose/profiles/fleet/configurations/kibana.config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ monitoring.ui.container.elasticsearch.enabled: true
1212
xpack.encryptedSavedObjects.encryptionKey: "12345678901234567890123456789012"
1313

1414
xpack.fleet.enabled: true
15-
xpack.fleet.registryUrl: http://package-registry:8080
15+
xpack.fleet.registryUrl: https://epr-staging.elastic.co
1616
xpack.fleet.agents.enabled: true
1717
xpack.fleet.agents.elasticsearch.host: http://elasticsearch:9200
1818
xpack.fleet.agents.fleet_server.hosts:

cli/config/compose/profiles/fleet/docker-compose.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,32 @@ services:
1616
- xpack.security.authc.api_key.enabled=true
1717
- ELASTIC_USERNAME=elastic
1818
- ELASTIC_PASSWORD=changeme
19+
<<<<<<< HEAD
1920
image: "docker.elastic.co/elasticsearch/elasticsearch:${stackVersion:-7.13.0-SNAPSHOT}"
21+
=======
22+
image: "docker.elastic.co/elasticsearch/elasticsearch:${stackVersion:-8.0.0-SNAPSHOT}"
23+
platform: ${stackPlatform:-linux/amd64}
24+
>>>>>>> e1a97f3 (feat: add support for running the tests in ARM (#707))
2025
ports:
2126
- "9200:9200"
2227
kibana:
2328
depends_on:
2429
elasticsearch:
2530
condition: service_healthy
26-
package-registry:
27-
condition: service_healthy
2831
healthcheck:
2932
test: "curl -f http://localhost:5601/login | grep kbn-injected-metadata 2>&1 >/dev/null"
3033
retries: 600
3134
interval: 1s
35+
<<<<<<< HEAD
3236
image: "docker.elastic.co/${kibanaDockerNamespace:-kibana}/kibana:${kibanaVersion:-7.13.0-SNAPSHOT}"
37+
=======
38+
image: "docker.elastic.co/${kibanaDockerNamespace:-kibana}/kibana:${kibanaVersion:-8.0.0-SNAPSHOT}"
39+
platform: ${stackPlatform:-linux/amd64}
40+
>>>>>>> e1a97f3 (feat: add support for running the tests in ARM (#707))
3341
ports:
3442
- "5601:5601"
3543
volumes:
3644
- ./configurations/kibana.config.yml:/usr/share/kibana/config/kibana.yml
37-
package-registry:
38-
image: docker.elastic.co/package-registry/distribution:staging
39-
healthcheck:
40-
test: ["CMD", "curl", "-f", "http://localhost:8080"]
41-
retries: 300
42-
interval: 1s
43-
4445
fleet-server:
4546
image: "docker.elastic.co/beats/elastic-agent:${stackVersion:-8.0.0-SNAPSHOT}"
4647
depends_on:

cli/config/compose/profiles/metricbeat/docker-compose.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ services:
99
- xpack.monitoring.collection.enabled=true
1010
- ELASTIC_USERNAME=elastic
1111
- ELASTIC_PASSWORD=changeme
12+
<<<<<<< HEAD
1213
image: "docker.elastic.co/elasticsearch/elasticsearch:${stackVersion:-7.13.0-SNAPSHOT}"
14+
=======
15+
image: "docker.elastic.co/elasticsearch/elasticsearch:${stackVersion:-8.0.0-SNAPSHOT}"
16+
platform: ${stackPlatform:-linux/amd64}
17+
>>>>>>> e1a97f3 (feat: add support for running the tests in ARM (#707))
1318
ports:
1419
- "9200:9200"

cli/config/compose/services/elastic-agent/centos/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '2.4'
22
services:
33
elastic-agent:
4-
image: centos/systemd:${centos_systemdTag:-latest}
4+
image: docker.elastic.co/observability-ci/centos-systemd:latest
55
container_name: ${centos_systemdContainerName}
66
entrypoint: "/usr/sbin/init"
77
platform: ${stackPlatform:-linux/amd64}

0 commit comments

Comments
 (0)