Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-build docker images used for filebeat integration testing #18969

Merged
merged 3 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 "$@"