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

[PACKAGING] Push docker images with the architecture in the version #24121

Merged
merged 9 commits into from
Feb 22, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add multiplaform manifest
v1v committed Feb 19, 2021

Verified

This commit was signed with the committer’s verified signature.
pendo324 Justin
commit 1d9d1efc57e90db000a1a9277576f7aeb661cbc2
10 changes: 8 additions & 2 deletions .ci/packaging.groovy
Original file line number Diff line number Diff line change
@@ -234,7 +234,7 @@ pipeline {
withGithubNotify(context: "Packaging linux/arm64 ${BEATS_FOLDER}") {
deleteWorkspace()
release()
pushCIDockerImages()
pushCIDockerImages(multiplatform: true)
}
}
post {
@@ -330,7 +330,7 @@ def tagAndPush(beatName){
def doTagAndPush(beatName, variant, sourceTag, targetTag) {
def sourceName = "${DOCKER_REGISTRY}/beats/${beatName}${variant}:${sourceTag}"
def targetName = "${DOCKER_REGISTRY}/observability-ci/${beatName}${variant}:${targetTag}"

def multiplatform = false
def iterations = 0
retryWithSleep(retries: 3, seconds: 5, backoff: true) {
iterations++
@@ -343,6 +343,12 @@ def doTagAndPush(beatName, variant, sourceTag, targetTag) {
log(level: 'WARN', text: "${beatName} doesn't have ${variant} docker images. See https://github.com/elastic/beats/pull/21621")
}
}

// Docker manifest for multiplaforms
if (multiplatform) {
sh(label: "Create multiplatform",
script: ".ci/scripts/docker-manifest.sh ${sourceName} ${targetName}")
}
}

def prepareE2ETestForPackage(String beat){
38 changes: 38 additions & 0 deletions .ci/scripts/docker-manifest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -exuo pipefail

MSG="parameter missing."
TEMPLATE_IMAGE=${1:?$MSG}
IMAGE=${2:?$MSG}
PLATFORMS=${3:-"linux/amd64,linux/arm64"}
HOME=${HOME:?$MSG}

##############################################
###### INSTALL manifest tool
##############################################
OS=$(uname -s| tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m| tr '[:upper:]' '[:lower:]')
MT_CMD="${HOME}/bin/manifest-tool"

if [ "${ARCH}" == "aarch64" ] ; then
MT_ARCH_SUFFIX=arm64
elif [ "${ARCH}" == "x86_64" ] ; then
MT_ARCH_SUFFIX=amd64
elif [ "${ARCH}" == "i686" ] ; then
MT_ARCH_SUFFIX=386
else
MT_ARCH_SUFFIX=armv7
fi

curl -sSLo "${MT_CMD}" "https://github.com/estesp/manifest-tool//releases/download/v1.0.3/manifest-tool-${OS}-${MT_ARCH_SUFFIX}"
chmod +x "${MT_CMD}"

##############################################
###### CREATE manifest
##############################################
"${MT_CMD}" \
push \
from-args \
--platforms "${PLATFORMS}" \
--template "${TEMPLATE_IMAGE}" \
--target "${IMAGE}"