From c446e3a58fda1961a3ed93e424d3c4ae8a3041c4 Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Wed, 18 Nov 2020 09:45:41 +0100 Subject: [PATCH] fix: backport package-docker-snapshot.sh script (#4424) --- script/jenkins/package-docker-snapshot.sh | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 script/jenkins/package-docker-snapshot.sh diff --git a/script/jenkins/package-docker-snapshot.sh b/script/jenkins/package-docker-snapshot.sh new file mode 100755 index 00000000000..3ab4253711d --- /dev/null +++ b/script/jenkins/package-docker-snapshot.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# +# Build the docker image for the apm-server, retag and push it to the given docker registry +# +# Arguments: +# - NEW_TAG, this is the tag for the docker image to be pushed. +# - NEW_IMAGE, this is the docker image name to be pushed. +# +set -euo pipefail + +NEW_TAG=${1:?Docker tag is not set} +NEW_IMAGE=${2:?Docker image is not set} + +export PLATFORMS='linux/amd64' +export TYPE='docker' +export SNAPSHOT='true' +export IMAGE="docker.elastic.co/apm/apm-server" + +echo 'INFO: Build docker images' +make release + +echo 'INFO: Get the just built docker image' +TAG=$(docker images ${IMAGE} --format "{{.Tag}}" | head -1) + +echo "INFO: Retag docker image (${IMAGE}:${TAG})" +docker tag "${IMAGE}:${TAG}" "${NEW_IMAGE}:${NEW_TAG}" + +echo "INFO: Push docker image (${NEW_IMAGE}:${NEW_TAG})" +docker push "${NEW_IMAGE}:${NEW_TAG}"