@@ -20,7 +20,6 @@ set -eu
2020_SELF=$( dirname $0 )
2121source " ${_SELF} /../common.sh"
2222
23-
2423# annotate create temp markdown file if not exists
2524# this file will be later used to annotate the build
2625# it appends to the file the message passed as argument
@@ -33,19 +32,9 @@ write_annotation() {
3332 cat $BUILDKITE_ANNOTATE_FILE | buildkite-agent annotate --style info
3433}
3534
35+ BUILD_VERSION=" $( jq -r ' .version' .package-version) "
36+ DOCKER_TAG=" git-${VERSION} "
3637PRIVATE_REPO=" docker.elastic.co/observability-ci/ecp-elastic-agent-service"
37- SNAPSHOT_DRA_URL=https://snapshots.elastic.co/latest/master.json
38-
39- DRA_RESULT=$( curl -s -X GET " $SNAPSHOT_DRA_URL " )
40- echo " $DRA_RESULT "
41- BUILD_ID=$( echo " $DRA_RESULT " | jq ' .build_id' | tr -d ' "' )
42- BUILD_VERSION=$( echo " $DRA_RESULT " | jq ' .version' | tr -d ' "' )
43-
44- MANIFEST_URL=" https://snapshots.elastic.co/$BUILD_ID /agent-package/agent-artifacts-$BUILD_VERSION .json"
45- GIT_COMMIT=$( curl -s -X GET " $MANIFEST_URL " | jq ' .projects["elastic-agent-core"]["commit_hash"]' | tr -d ' "' )
46- GIT_SHORT_COMMIT=$( echo " $GIT_COMMIT " | cut -c1-12)
47-
48- DOCKER_TAG=" git-${GIT_SHORT_COMMIT} "
4938PRIVATE_IMAGE=" ${PRIVATE_REPO} :${DOCKER_TAG} "
5039
5140# TODO: let's avoid accessing vault directly but use the vault plugin itself
@@ -57,13 +46,19 @@ DOCKER_REGISTRY="docker.elastic.co"
5746DOCKER_USERNAME_SECRET=$( retry 5 vault kv get -field user " ${DOCKER_REGISTRY_SECRET_PATH} " )
5847DOCKER_PASSWORD_SECRET=$( retry 5 vault kv get -field password " ${DOCKER_REGISTRY_SECRET_PATH} " )
5948skopeo login --username " ${DOCKER_USERNAME_SECRET} " --password " ${DOCKER_PASSWORD_SECRET} " " ${DOCKER_REGISTRY} "
60- skopeo copy --all " docker://docker.elastic.co/cloud-release/elastic-agent-service:$BUILD_ID -SNAPSHOT" " docker://$PRIVATE_IMAGE "
49+
50+ # download the amd64 and arm64 builds of the image from the previous steps
51+ buildkite-agent artifact download " build/distributions/**" . --step " packaging-service-container-amd64"
52+ buildkite-agent artifact download " build/distributions/**" . --step " packaging-service-container-arm64"
53+
54+ # copy the images into the private image location
55+ skopeo copy --all " docker-archive:./build/distributions/elastic-agent-service-$DOCKER_TAG -$BUILD_VERSION -linux-amd64.docker.tar.gz" " docker://$PRIVATE_IMAGE "
56+ skopeo copy --all " docker-archive:./build/distributions/elastic-agent-service-$DOCKER_TAG -$BUILD_VERSION -linux-arm64.docker.tar.gz" " docker://$PRIVATE_IMAGE "
6157
6258annotate " * Image: $PRIVATE_IMAGE "
63- annotate " * Short commit: $GIT_SHORT_COMMIT "
64- annotate " * Commit: https://github.com/elastic/elastic-agent/commit/$GIT_COMMIT "
65- annotate " * Manifest: $MANIFEST_URL "
59+ annotate " * Short commit: $VERSION "
60+ annotate " * Commit: https://github.com/elastic/elastic-agent/commit/$VERSION "
6661
67- buildkite-agent meta-data set " git-short-commit" " $GIT_SHORT_COMMIT "
62+ buildkite-agent meta-data set " git-short-commit" " $VERSION "
6863
6964write_annotation
0 commit comments