Backport PR #14786 to 7.17: Avoid to create and upload AARCH64 Docker images for UBI8 #14790

On ARM architecture UBI8 Docker images aren't created, so avoid to create empty tar.gz files.

(cherry picked from commit 7a39d97055)

Co-authored-by: Andrea Selva <selva.andre@gmail.com>
This commit is contained in:
github-actions[bot] 2022-11-29 15:17:45 +01:00 committed by GitHub
parent dac65a439e
commit fd3ffc1548
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 5 deletions

View file

@ -10,12 +10,19 @@ function error {
function save_docker_tarballs {
local arch="${1:?architecture required}"
local version="${2:?stack-version required}"
for image in logstash logstash-oss logstash-ubi8; do
docker save -o "build/${image}-${version}-docker-image-${arch}.tar" \
local images="logstash logstash-oss"
if [ "${arch}" != "aarch64" ]; then
# No logstash-ubi8 for AARCH64
images="logstash logstash-oss logstash-ubi8"
fi
for image in ${images}; do
tar_file="${image}-${version}-docker-image-${arch}.tar"
docker save -o "build/${tar_file}" \
"docker.elastic.co/logstash/${image}:${version}" || \
error "Hit a problem in saving the Docker image for ${image}"
error "Unable to save tar file ${tar_file} for ${image} image."
# NOTE: if docker save exited with non-zero the error log already exited the script
gzip "build/${image}-${version}-docker-image-${arch}.tar"
gzip "build/${tar_file}"
done
}

View file

@ -68,7 +68,12 @@ 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
images="logstash logstash-oss"
if [ "$ARCH" != "aarch64" ]; then
# No logstash-ubi8 for AARCH64
images="logstash logstash-oss logstash-ubi8"
fi
for image in ${images}; do
upload_to_bucket "build/$image-${STACK_VERSION}-docker-image-${ARCH}.tar.gz" ${STACK_VERSION}
done