Skip to content

Commit

Permalink
Pre-build docker images used for filebeat integration testing (elasti…
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano authored and melchiormoulin committed Oct 14, 2020
1 parent 1739be5 commit 0f85568
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 19 deletions.
36 changes: 28 additions & 8 deletions .ci/build-docker-images.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,51 @@ pipeline {
sh(label: 'Install virtualenv', script: 'pip install --user virtualenv')
}
}
stage('Release Beats Test Docker images'){
stage('Metricbeat Test Docker images'){
options {
warnError('Release Beats Docker images failed')
warnError('Metricbeat Test Docker images failed')
}
when {
expression { return params.RELEASE_TEST_IMAGES }
}
steps {
dockerLogin(secret: "${env.DOCKER_REGISTRY_SECRET}", registry: "${env.DOCKER_REGISTRY}")
retry(3){
sh(label: 'Build ', script: ".ci/scripts/build-beats-integrations-test-images.sh '${GO_VERSION}' '${HOME}/${BASE_DIR}/metricbeat'")
dir("${HOME}/${BASE_DIR}"){
retry(3){
sh(label: 'Build ', script: ".ci/scripts/build-beats-integrations-test-images.sh '${GO_VERSION}' '${HOME}/${BASE_DIR}/metricbeat'")
}
}
}
}
stage('Release X-Pack Beats Test Docker images'){
stage('Metricbeat x-pack Test Docker images'){
options {
warnError('Release X-Pack Beats Docker images failed')
warnError('Metricbeat x-pack Docker images failed')
}
when {
expression { return params.RELEASE_TEST_IMAGES }
}
steps {
dockerLogin(secret: "${env.DOCKER_REGISTRY_SECRET}", registry: "${env.DOCKER_REGISTRY}")
retry(3){
sh(label: 'Build ', script: ".ci/scripts/build-beats-integrations-test-images.sh '${GO_VERSION}' '${HOME}/${BASE_DIR}/x-pack/metricbeat'")
dir("${HOME}/${BASE_DIR}"){
retry(3){
sh(label: 'Build ', script: ".ci/scripts/build-beats-integrations-test-images.sh '${GO_VERSION}' '${HOME}/${BASE_DIR}/x-pack/metricbeat'")
}
}
}
}
stage('Filebeat x-pack Test Docker images'){
options {
warnError('Filebeat x-pack Test Docker images failed')
}
when {
expression { return params.RELEASE_TEST_IMAGES }
}
steps {
dockerLogin(secret: "${env.DOCKER_REGISTRY_SECRET}", registry: "${env.DOCKER_REGISTRY}")
dir("${HOME}/${BASE_DIR}"){
retry(3){
sh(label: 'Build ', script: ".ci/scripts/build-beats-integrations-test-images.sh '${GO_VERSION}' '${HOME}/${BASE_DIR}/x-pack/filebeat'")
}
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions .ci/scripts/build-beats-integrations-test-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ set -exo pipefail
#
# Parameters:
# - GO_VERSION - that's the version which will be installed and enabled.
# - METRICBEAT_DIR - that's the location of the metricbeat directory.
# - BEAT_BASE_DIR - that's the base directory of the Beat.
#

readonly GO_VERSION="${1?Please define the Go version to be used}"
readonly METRICBEAT_DIR="${2?Please define the location of the Metricbeat directory}"
readonly BEAT_BASE_DIR="${2?Please define the location of the Beat directory}"

function build_test_images() {
local metricbeatDir="${1}"
local baseDir="${1}"

cd "${metricbeatDir}"
cd "${baseDir}"
mage compose:buildSupportedVersions
}

Expand All @@ -28,25 +28,25 @@ function install_go() {
}

function install_mage() {
local metricbeatDir="${1}"
local baseDir="${1}"

cd "${metricbeatDir}"
cd "${baseDir}"
make mage
}

function push_test_images() {
local metricbeatDir="${1}"
local baseDir="${1}"

cd "${metricbeatDir}"
cd "${baseDir}"
mage compose:pushSupportedVersions
}

function main() {
install_go "${GO_VERSION}"
install_mage "${METRICBEAT_DIR}"
install_mage "${BEAT_BASE_DIR}"

build_test_images "${METRICBEAT_DIR}"
push_test_images "${METRICBEAT_DIR}"
build_test_images "${BEAT_BASE_DIR}"
push_test_images "${BEAT_BASE_DIR}"
}

main "$@"

0 comments on commit 0f85568

Please sign in to comment.