DRA - generalize docker image building (#14670) (#14689)

* Generalize docker image building
* Rename and add ability to pass the architecture as a parameter
* Handle ARCH env variable

(cherry picked from commit 6ba5cc112f)

Co-authored-by: Andres Rodriguez <andres.lazo@elastic.co>
This commit is contained in:
github-actions[bot] 2022-10-24 21:23:19 -04:00 committed by GitHub
parent 6a8b525514
commit 53da859769
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 13 deletions

View file

@ -30,3 +30,8 @@ export JRUBY_OPTS="-J-Xmx1g"
# e.g.: 8.6.0
# The suffix part like alpha1 etc is managed by the optional VERSION_QUALIFIER_OPT environment variable
STACK_VERSION=`cat versions.yml | sed -n 's/^logstash\:[[:space:]]\([[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\)$/\1/p'`
# ARCH is a Environment variable set in Jenkins
if [ -z "$ARCH" ]; then
ARCH=aarch64
fi

View file

@ -49,7 +49,7 @@ case "$WORKFLOW_TYPE" in
esac
info "Saving tar.gz for docker images"
save_docker_tarballs "aarch64" "${STACK_VERSION}"
save_docker_tarballs "${ARCH}" "${STACK_VERSION}"
info "GENERATED ARTIFACTS"
for file in build/logstash-*; do shasum $file;done
@ -57,7 +57,7 @@ for file in build/logstash-*; do shasum $file;done
info "UPLOADING TO INTERMEDIATE BUCKET"
# Note the deb, rpm tar.gz AARCH64 files generated has already been loaded by the dra_x86_64.sh
for image in logstash logstash-oss logstash-ubi8; do
upload_to_bucket "build/$image-${STACK_VERSION}-docker-image-aarch64.tar.gz" ${STACK_VERSION}
upload_to_bucket "build/$image-${STACK_VERSION}-docker-image-${ARCH}.tar.gz" ${STACK_VERSION}
done
echo "####################################################################"

View file

@ -11,12 +11,12 @@ case "$WORKFLOW_TYPE" in
snapshot)
info "Building artifacts for the $WORKFLOW_TYPE workflow..."
if [ -z "$VERSION_QUALIFIER_OPT" ]; then
rake artifact:all
SKIP_DOCKER=1 rake artifact:all
else
# Qualifier is passed from CI as optional field and specify the version postfix
# in case of alpha or beta releases:
# e.g: 8.0.0-alpha1
VERSION_QUALIFIER="$VERSION_QUALIFIER_OPT" rake artifact:all
VERSION_QUALIFIER="$VERSION_QUALIFIER_OPT" SKIP_DOCKER=1 rake artifact:all
STACK_VERSION="${STACK_VERSION}-${VERSION_QUALIFIER_OPT}"
fi
STACK_VERSION=${STACK_VERSION}-SNAPSHOT
@ -25,12 +25,12 @@ case "$WORKFLOW_TYPE" in
staging)
info "Building artifacts for the $WORKFLOW_TYPE workflow..."
if [ -z "$VERSION_QUALIFIER_OPT" ]; then
RELEASE=1 rake artifact:all
RELEASE=1 SKIP_DOCKER=1 rake artifact:all
else
# Qualifier is passed from CI as optional field and specify the version postfix
# in case of alpha or beta releases:
# e.g: 8.0.0-alpha1
VERSION_QUALIFIER="$VERSION_QUALIFIER_OPT" RELEASE=1 rake artifact:all
VERSION_QUALIFIER="$VERSION_QUALIFIER_OPT" RELEASE=1 SKIP_DOCKER=1 rake artifact:all
STACK_VERSION="${STACK_VERSION}-${VERSION_QUALIFIER_OPT}"
fi
info "Build complete, setting STACK_VERSION to $STACK_VERSION."
@ -40,9 +40,6 @@ case "$WORKFLOW_TYPE" in
;;
esac
info "Saving tar.gz for docker images"
save_docker_tarballs "x86_64" "${STACK_VERSION}"
info "GENERATED ARTIFACTS"
for file in build/logstash-*; do shasum $file;done
@ -61,10 +58,6 @@ done
# Upload Dependencies Report
upload_to_bucket "build/distributions/dependencies-reports/logstash-${STACK_VERSION}.csv" ${STACK_VERSION}
for image in logstash logstash-oss logstash-ubi8; do
upload_to_bucket "build/$image-${STACK_VERSION}-docker-image-x86_64.tar.gz" ${STACK_VERSION}
done
echo "####################################################################"
echo "##################### Finishing $0"
echo "####################################################################"