diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 264a7c5ec0..afe6b5566f 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -325,11 +325,6 @@ def generateFunctionalTestStep(Map args = [:]){ if(isInstalled(tool: 'docker', flag: '--version')) { dockerLogin(secret: "${DOCKER_ELASTIC_SECRET}", registry: "${DOCKER_REGISTRY}") } - retry(3){ - dir("${BASE_DIR}"){ - sh script: """.ci/scripts/install-test-dependencies.sh "${suite}" """, label: "Install test dependencies for ${suite}:${tags}" - } - } filebeat(output: "docker_logs_${suite}_${tags}.log", workdir: "${env.WORKSPACE}"){ dir("${BASE_DIR}"){ sh script: """.ci/scripts/functional-test.sh "${suite}" "${tags}" "${stackVersion}" "${METRICBEAT_VERSION}" """, label: "Run functional tests for ${suite}:${tags}" diff --git a/.ci/functionalTests.groovy b/.ci/functionalTests.groovy index 9a5f4541a0..767d6f95b0 100644 --- a/.ci/functionalTests.groovy +++ b/.ci/functionalTests.groovy @@ -107,11 +107,6 @@ pipeline { steps { deleteDir() unstash 'source' - retry(3){ - dir("${BASE_DIR}"){ - sh script: """.ci/scripts/install-test-dependencies.sh "${GO_VERSION}" """, label: "Install test dependencies for ${params.FEATURE}" - } - } dir(BASE_DIR){ sh script: """.ci/scripts/functional-test.sh "${GO_VERSION}" "${params.FEATURE}" """, label: 'Run functional tests' } diff --git a/.ci/scripts/functional-test.sh b/.ci/scripts/functional-test.sh index 2df3f7fe4b..76a48b2bee 100755 --- a/.ci/scripts/functional-test.sh +++ b/.ci/scripts/functional-test.sh @@ -23,6 +23,9 @@ METRICBEAT_VERSION=${4:-'8.0.0-SNAPSHOT'} TARGET_OS=${GOOS:-linux} TARGET_ARCH=${GOARCH:-amd64} +## Install the required dependencies for the given SUITE +.ci/scripts/install-test-dependencies.sh "${SUITE}" + rm -rf outputs || true mkdir -p outputs diff --git a/.ci/scripts/install-test-dependencies.sh b/.ci/scripts/install-test-dependencies.sh index 0a5b02d1b1..15901260a4 100755 --- a/.ci/scripts/install-test-dependencies.sh +++ b/.ci/scripts/install-test-dependencies.sh @@ -17,7 +17,15 @@ SUITE=${1:?SUITE is not set} # execute specific test dependencies if it exists if [ -f .ci/scripts/install-${SUITE}-test-dependencies.sh ] then - source .ci/scripts/install-${SUITE}-test-dependencies.sh + ## Install the required dependencies with some retry + CI_UTILS=/usr/local/bin/bash_standard_lib.sh + if [ -e "${CI_UTILS}" ] ; then + # shellcheck disable=SC1090 + source "${CI_UTILS}" + retry 3 source .ci/scripts/install-${SUITE}-test-dependencies.sh + else + source .ci/scripts/install-${SUITE}-test-dependencies.sh + fi else echo "Not installing test dependencies for ${SUITE}" fi diff --git a/.ci/scripts/metricbeat-test.sh b/.ci/scripts/metricbeat-test.sh new file mode 100755 index 0000000000..cb42e6ffa3 --- /dev/null +++ b/.ci/scripts/metricbeat-test.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +## Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +## or more contributor license agreements. Licensed under the Elastic License; +## you may not use this file except in compliance with the Elastic License. + +set -euxo pipefail +# +# Run the functional tests for metricbeat using the functional-test wrapper +# +# Parameters: +# - STACK_VERSION - that's the version of the stack to be tested. Default '8.0.0-SNAPSHOT'. +# - METRICBEAT_VERSION - that's the version of the metricbeat to be tested. Default '8.0.0-SNAPSHOT'. +# + +STACK_VERSION=${1:-'8.0.0-SNAPSHOT'} +METRICBEAT_VERSION=${2:-'8.0.0-SNAPSHOT'} +SUITE='metricbeat' + +.ci/scripts/functional-test.sh "${SUITE}" "" "${STACK_VERSION}" "${METRICBEAT_VERSION}"