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

Commit 3a86b77

Browse files
committed
Merge branch '6.8.x' into bump-6.8-versions
2 parents edc988f + e40d3bc commit 3a86b77

30 files changed

Lines changed: 688 additions & 188 deletions

.ci/.e2e-tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ SUITES:
66
scenarios:
77
- name: "APM Server"
88
tags: "apm-server"
9-
- "Filebeat":
9+
- name: "Filebeat"
1010
tags: "filebeat"
11-
- "Metricbeat":
11+
- name: "Metricbeat"
1212
tags: "metricbeat"
1313
- suite: "metricbeat"
1414
platforms:

.ci/Jenkinsfile

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ pipeline {
77
environment {
88
REPO = 'e2e-testing'
99
BASE_DIR = "src/github.com/elastic/${env.REPO}"
10+
ELASTIC_APM_ACTIVE="true"
11+
ELASTIC_APM_ENVIRONMENT="ci"
12+
ELASTIC_APM_LOG_FILE="stderr"
13+
ELASTIC_APM_LOG_LEVEL="debug"
14+
VAULT_INSTRUMENTATION_SECRET="secret/observability-team/ci/jenkins-stats"
1015
NIGHTLY_TAG="@nightly"
1116
NOTIFY_TO = credentials('notify-to')
1217
JOB_GCS_BUCKET = credentials('gcs-bucket')
@@ -35,15 +40,11 @@ pipeline {
3540
booleanParam(name: "forceSkipPresubmit", defaultValue: false, description: "If it's needed to execute the pre-submit tests: unit and precommit.")
3641
booleanParam(name: "notifyOnGreenBuilds", defaultValue: false, description: "If it's needed to notify to Slack with green builds.")
3742
string(name: 'SLACK_CHANNEL', defaultValue: 'observablt-bots', description: 'The Slack channel(s) where errors will be posted. For multiple channels, use a comma-separated list of channels')
38-
string(name: 'ELASTIC_AGENT_DOWNLOAD_URL', defaultValue: '', description: 'If present, it will override the download URL for the Elastic agent artifact. (I.e. https://snapshots.elastic.co/8.0.0-59098054/downloads/beats/elastic-agent/elastic-agent-8.0.0-SNAPSHOT-linux-x86_64.tar.gz')
39-
string(name: 'ELASTIC_AGENT_VERSION', defaultValue: '8.0.0-SNAPSHOT', description: 'SemVer version of the stand-alone elastic-agent to be used for Fleet tests. You can use here the tag of your PR to test your changes')
40-
string(name: 'ELASTIC_AGENT_STALE_VERSION', defaultValue: '7.10-SNAPSHOT', description: 'SemVer version of the stale stand-alone elastic-agent to be used for Fleet upgrade tests.')
43+
string(name: 'BEAT_VERSION', defaultValue: '6.8-SNAPSHOT', description: 'SemVer version of the Beat to be used for the tests. You can use here the tag of your PR to test your changes')
4144
booleanParam(name: "BEATS_USE_CI_SNAPSHOTS", defaultValue: false, description: "If it's needed to use the binary snapshots produced by Beats CI instead of the official releases")
4245
choice(name: 'LOG_LEVEL', choices: ['DEBUG', 'TRACE', 'INFO'], description: 'Log level to be used')
4346
choice(name: 'TIMEOUT_FACTOR', choices: ['5', '3', '7', '11'], description: 'Max number of minutes for timeout backoff strategies')
44-
string(name: 'FLEET_STACK_VERSION', defaultValue: '8.0.0-SNAPSHOT', description: 'SemVer version of the stack to be used for Fleet tests.')
45-
string(name: 'METRICBEAT_STACK_VERSION', defaultValue: '6.8-SNAPSHOT', description: 'SemVer version of the stack to be used for Metricbeat tests.')
46-
string(name: 'METRICBEAT_VERSION', defaultValue: '6.8-SNAPSHOT', description: 'SemVer version of the metricbeat to be used.')
47+
string(name: 'STACK_VERSION', defaultValue: '6.8-SNAPSHOT', description: 'SemVer version of the stack to be used for the tests.')
4748
string(name: 'HELM_CHART_VERSION', defaultValue: '7.10.0', description: 'SemVer version of Helm chart to be used.')
4849
string(name: 'HELM_VERSION', defaultValue: '3.4.1', description: 'SemVer version of Helm to be used.')
4950
string(name: 'HELM_KIND_VERSION', defaultValue: '0.8.1', description: 'SemVer version of Kind to be used.')
@@ -58,17 +59,16 @@ pipeline {
5859
options { skipDefaultCheckout() }
5960
environment {
6061
HOME = "${env.WORKSPACE}"
62+
ELASTIC_APM_GLOBAL_LABELS="build_pr=${isPR()},build_id=${env.BUILD_ID}"
6163
PATH = "${env.PATH}:${env.WORKSPACE}/bin:${env.WORKSPACE}/${env.BASE_DIR}/.ci/scripts"
6264
GO111MODULE = 'on'
6365
SKIP_SCENARIOS = "${params.SKIP_SCENARIOS}"
6466
NIGHTLY_SCENARIOS = "${params.NIGHTLY_SCENARIOS}"
6567
SLACK_CHANNEL = "${params.SLACK_CHANNEL.trim()}"
6668
ELASTIC_AGENT_DOWNLOAD_URL = "${params.ELASTIC_AGENT_DOWNLOAD_URL.trim()}"
67-
ELASTIC_AGENT_VERSION = "${params.ELASTIC_AGENT_VERSION.trim()}"
69+
BEAT_VERSION = "${params.BEAT_VERSION.trim()}"
6870
BEATS_USE_CI_SNAPSHOTS = "${params.BEATS_USE_CI_SNAPSHOTS}"
69-
FLEET_STACK_VERSION = "${params.FLEET_STACK_VERSION.trim()}"
70-
METRICBEAT_VERSION = "${params.METRICBEAT_VERSION.trim()}"
71-
METRICBEAT_STACK_VERSION = "${params.METRICBEAT_STACK_VERSION.trim()}"
71+
STACK_VERSION = "${params.STACK_VERSION.trim()}"
7272
FORCE_SKIP_GIT_CHECKS = "${params.forceSkipGitChecks}"
7373
FORCE_SKIP_PRESUBMIT = "${params.forceSkipPresubmit}"
7474
HELM_CHART_VERSION = "${params.HELM_CHART_VERSION.trim()}"
@@ -84,6 +84,7 @@ pipeline {
8484
pipelineManager([ cancelPreviousRunningBuilds: [ when: 'PR' ] ])
8585
deleteDir()
8686
gitCheckout(basedir: BASE_DIR, githubNotifyFirstTimeContributor: true)
87+
githubCheckNotify('PENDING') // we want to notify the upstream about the e2e the soonest
8788
stash allowEmpty: true, name: 'source', useDefaultExcludes: false
8889
setEnvVar("GO_VERSION", readFile("${env.WORKSPACE}/${env.BASE_DIR}/.go-version").trim())
8990
dir("${BASE_DIR}"){
@@ -303,8 +304,6 @@ def generateStep(Map args = [:]){
303304
def generateFunctionalTestStep(Map args = [:]){
304305
def platform = args.get('platform')
305306
def suite = args.get('suite')
306-
def sneakCaseSuite = suite.toUpperCase().replaceAll("-", "_")
307-
def stackVersion = env."${sneakCaseSuite}_STACK_VERSION"
308307
def tags = args.get('tags')
309308

310309
// We will decide whether to include the nightly tests in the execution at CI time, only.
@@ -327,7 +326,9 @@ def generateFunctionalTestStep(Map args = [:]){
327326
}
328327
filebeat(output: "docker_logs_${suite}_${tags}.log", workdir: "${env.WORKSPACE}"){
329328
dir("${BASE_DIR}"){
330-
sh script: """.ci/scripts/functional-test.sh "${suite}" "${tags}" "${stackVersion}" "${METRICBEAT_VERSION}" """, label: "Run functional tests for ${suite}:${tags}"
329+
withSecretVault(secret: "${VAULT_INSTRUMENTATION_SECRET}", user_key: "apmServerToken", user_var_name: "APM_SECRET_TOKEN", pass_key: "apmServerUrl", pass_var_name: "APM_SERVER_URL"){
330+
sh script: """.ci/scripts/functional-test.sh "${suite}" "${tags}" "${STACK_VERSION}" "${BEAT_VERSION}" """, label: "Run functional tests for ${suite}:${tags}"
331+
}
331332
}
332333
}
333334
}

.ci/scripts/fleet-test.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
## Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4+
## or more contributor license agreements. Licensed under the Elastic License;
5+
## you may not use this file except in compliance with the Elastic License.
6+
7+
set -euxo pipefail
8+
#
9+
# Run the functional tests for fleets using the functional-test wrapper
10+
#
11+
# Parameters:
12+
# - STACK_VERSION - that's the version of the stack to be tested. Default '8.0.0-SNAPSHOT'.
13+
#
14+
15+
STACK_VERSION=${1:-'8.0.0-SNAPSHOT'}
16+
SUITE='fleet'
17+
18+
# Exclude the nightly tests in the CI.
19+
# For further details refers to:
20+
# https://github.com/elastic/e2e-testing/blob/dcc950796120fabf0c85086823cef221cf3ecbcb/.ci/Jenkinsfile#L316-L323
21+
TAG="~@nightly"
22+
23+
.ci/scripts/functional-test.sh "${SUITE}" "${TAG}" "${STACK_VERSION}"

.ci/scripts/functional-test.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ set -euxo pipefail
1313
# - SUITE - that's the suite to be tested. Default '' which means all of them.
1414
# - TAGS - that's the tags to be tested. Default '' which means all of them.
1515
# - STACK_VERSION - that's the version of the stack to be tested. Default '6.8-SNAPSHOT'.
16-
# - METRICBEAT_VERSION - that's the version of the metricbeat to be tested. Default '6.8-SNAPSHOT'.
16+
# - BEAT_VERSION - that's the version of the metricbeat to be tested. Default '6.8-SNAPSHOT'.
1717
#
1818

1919
SUITE=${1:-''}
2020
TAGS=${2:-''}
2121
STACK_VERSION=${3:-'6.8-SNAPSHOT'}
22-
METRICBEAT_VERSION=${4:-'6.8-SNAPSHOT'}
23-
TARGET_OS=${GOOS:-linux}
24-
TARGET_ARCH=${GOARCH:-amd64}
22+
BEAT_VERSION=${4:-'6.8-SNAPSHOT'}
2523

2624
## Install the required dependencies for the given SUITE
2725
.ci/scripts/install-test-dependencies.sh "${SUITE}"
@@ -31,4 +29,4 @@ mkdir -p outputs
3129

3230
REPORT="$(pwd)/outputs/TEST-${SUITE}"
3331

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

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

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,9 @@
66

77
set -euxo pipefail
88
#
9-
# Install the dependencies using the install and test make goals.
9+
# Install the dependencies using the sync-integrations make goal.
1010
#
11-
# Parameters:
12-
# - GOOS - that's the name of the O.S. used to build the binary
13-
# - GOARCH - that's the name of the architecture of the O.S. used to build the binary.
1411
#
1512

16-
TARGET_OS=${GOOS:-linux}
17-
TARGET_ARCH=${GOARCH:-amd64}
18-
19-
# Build OP Binary
20-
GOOS=${TARGET_OS} GOARCH=${TARGET_ARCH} make -C e2e fetch-binary
21-
2213
# Sync integrations
23-
make -C e2e sync-integrations
14+
make -C cli sync-integrations

.ci/scripts/metricbeat-test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ set -euxo pipefail
1010
#
1111
# Parameters:
1212
# - STACK_VERSION - that's the version of the stack to be tested. Default '8.0.0-SNAPSHOT'.
13-
# - METRICBEAT_VERSION - that's the version of the metricbeat to be tested. Default '8.0.0-SNAPSHOT'.
13+
# - BEAT_VERSION - that's the version of the metricbeat to be tested. Default '8.0.0-SNAPSHOT'.
1414
#
1515

1616
STACK_VERSION=${1:-'8.0.0-SNAPSHOT'}
17-
METRICBEAT_VERSION=${2:-'8.0.0-SNAPSHOT'}
17+
BEAT_VERSION=${2:-'8.0.0-SNAPSHOT'}
1818
SUITE='metricbeat'
1919

20-
.ci/scripts/functional-test.sh "${SUITE}" "" "${STACK_VERSION}" "${METRICBEAT_VERSION}"
20+
.ci/scripts/functional-test.sh "${SUITE}" "" "${STACK_VERSION}" "${BEAT_VERSION}"

cli/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ ROOT_DIR:=$(CURDIR)
44
TEST_TIMEOUT?=5m
55

66
GO_IMAGE?='golang'
7-
GO_VERSION?='$(shell cat ../.go-version )'
7+
GO_VERSION='$(shell cat ../.go-version )'
88
GO_IMAGE_TAG?='stretch'
99
GOOS?='linux'
1010
GOARCH?='amd64'
11+
LOG_LEVEL?=INFO
1112

1213
.PHONY: build
1314
build:
@@ -35,6 +36,10 @@ notice:
3536
-noticeOut NOTICE.txt \
3637
-depsOut ""
3738

39+
.PHONY: sync-integrations
40+
sync-integrations:
41+
OP_LOG_LEVEL=${LOG_LEVEL} go run main.go sync integrations --delete --remote "elastic:7.7"
42+
3843
.PHONY: test
3944
test:
4045
gotestsum --format testname -- -count=1 -timeout=$(TEST_TIMEOUT) ./...

cli/cmd/deploy.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
package cmd
66

77
import (
8+
"context"
9+
810
"github.com/elastic/e2e-testing/cli/config"
911
"github.com/elastic/e2e-testing/cli/services"
1012
log "github.com/sirupsen/logrus"
@@ -66,7 +68,7 @@ func buildDeployServiceCommand(srv string) *cobra.Command {
6668
env := map[string]string{}
6769
env = config.PutServiceEnvironment(env, srv, versionToRun)
6870

69-
err := serviceManager.AddServicesToCompose(deployToProfile, []string{srv}, env)
71+
err := serviceManager.AddServicesToCompose(context.Background(), deployToProfile, []string{srv}, env)
7072
if err != nil {
7173
log.WithFields(log.Fields{
7274
"profile": deployToProfile,
@@ -88,7 +90,7 @@ func buildUndeployServiceCommand(srv string) *cobra.Command {
8890
env := map[string]string{}
8991
env = config.PutServiceEnvironment(env, srv, versionToRun)
9092

91-
err := serviceManager.RemoveServicesFromCompose(deployToProfile, []string{srv}, env)
93+
err := serviceManager.RemoveServicesFromCompose(context.Background(), deployToProfile, []string{srv}, env)
9294
if err != nil {
9395
log.WithFields(log.Fields{
9496
"profile": deployToProfile,

cli/cmd/run.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package cmd
66

77
import (
8+
"context"
89
"strings"
910

1011
"github.com/elastic/e2e-testing/cli/config"
@@ -63,7 +64,7 @@ func buildRunServiceCommand(srv string) *cobra.Command {
6364

6465
env := config.PutServiceEnvironment(map[string]string{}, srv, versionToRun)
6566

66-
err := serviceManager.RunCompose(false, []string{srv}, env)
67+
err := serviceManager.RunCompose(context.Background(), false, []string{srv}, env)
6768
if err != nil {
6869
log.WithFields(log.Fields{
6970
"service": srv,
@@ -85,7 +86,7 @@ func buildRunProfileCommand(key string, profile config.Profile) *cobra.Command {
8586
"profileVersion": versionToRun,
8687
}
8788

88-
err := serviceManager.RunCompose(true, []string{key}, env)
89+
err := serviceManager.RunCompose(context.Background(), true, []string{key}, env)
8990
if err != nil {
9091
log.WithFields(log.Fields{
9192
"profile": key,
@@ -105,7 +106,7 @@ func buildRunProfileCommand(key string, profile config.Profile) *cobra.Command {
105106
composeNames = append(composeNames, image)
106107
}
107108

108-
err = serviceManager.AddServicesToCompose(key, composeNames, env)
109+
err = serviceManager.AddServicesToCompose(context.Background(), key, composeNames, env)
109110
if err != nil {
110111
log.WithFields(log.Fields{
111112
"profile": key,

cli/cmd/stop.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
package cmd
66

77
import (
8+
"context"
9+
810
"github.com/elastic/e2e-testing/cli/config"
911
"github.com/elastic/e2e-testing/cli/services"
1012
log "github.com/sirupsen/logrus"
@@ -55,7 +57,7 @@ func buildStopServiceCommand(srv string) *cobra.Command {
5557
Run: func(cmd *cobra.Command, args []string) {
5658
serviceManager := services.NewServiceManager()
5759

58-
err := serviceManager.StopCompose(false, []string{srv})
60+
err := serviceManager.StopCompose(context.Background(), false, []string{srv})
5961
if err != nil {
6062
log.WithFields(log.Fields{
6163
"service": srv,
@@ -73,7 +75,7 @@ func buildStopProfileCommand(key string, profile config.Profile) *cobra.Command
7375
Run: func(cmd *cobra.Command, args []string) {
7476
serviceManager := services.NewServiceManager()
7577

76-
err := serviceManager.StopCompose(true, []string{key})
78+
err := serviceManager.StopCompose(context.Background(), true, []string{key})
7779
if err != nil {
7880
log.WithFields(log.Fields{
7981
"profile": key,

0 commit comments

Comments
 (0)