Skip to content

Commit e7fd107

Browse files
committed
Change to only use docker for agentless publish.
1 parent 41d4fbd commit e7fd107

File tree

2 files changed

+25
-20
lines changed

2 files changed

+25
-20
lines changed

.buildkite/pipeline.agentless-app-release.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
env:
22
VERSION: "${BUILDKITE_COMMIT:0:12}"
3+
4+
# This section is used to define the plugins that will be used in the pipeline.
5+
# See https://buildkite.com/docs/pipelines/integrations/plugins/using#using-yaml-anchors-with-plugins
6+
common:
7+
- docker_login_plugin: &docker_login_plugin
8+
elastic/vault-docker-login#v0.5.2:
9+
secret_path: 'kv/ci-shared/platform-ingest/docker_registry_prod'
10+
311
steps:
412
- label: "Packaging: Service Container linux/amd64"
513
key: packaging-service-container-amd64
@@ -39,7 +47,10 @@ steps:
3947
key: "mirror-elastic-agent"
4048
command: ".buildkite/scripts/steps/ecp-internal-release.sh"
4149
agents:
42-
image: docker.elastic.co/ci-agent-images/serverless-helm-builder:0.0.2@sha256:d00e8a7a0ab3618cfaacb0a7b1e1b06ee29728eb2b44de602374bd8f6b9b92ac
50+
provider: "gcp"
51+
machineType: "c2-standard-16"
52+
plugins:
53+
- *docker_login_plugin
4354

4455
# wait for metadata to be set
4556
- wait: ~

.buildkite/scripts/steps/ecp-internal-release.sh

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,27 @@ DOCKER_TAG="git-${VERSION}"
3737
PRIVATE_REPO="docker.elastic.co/observability-ci/ecp-elastic-agent-service"
3838
PRIVATE_IMAGE="${PRIVATE_REPO}:${DOCKER_TAG}"
3939

40-
# TODO: let's avoid accessing vault directly but use the vault plugin itself
41-
# https://github.com/elastic/vault-docker-login-buildkite-plugin does not support
42-
# the `skopeo` command by default but looks for the current installed tools in the runner
43-
# Let's contribute in a follow-up PR to support `skopeo` as well.
44-
DOCKER_REGISTRY_SECRET_PATH="kv/ci-shared/platform-ingest/docker_registry_prod"
45-
DOCKER_REGISTRY="docker.elastic.co"
46-
DOCKER_USERNAME_SECRET=$(retry 5 vault kv get -field user "${DOCKER_REGISTRY_SECRET_PATH}")
47-
DOCKER_PASSWORD_SECRET=$(retry 5 vault kv get -field password "${DOCKER_REGISTRY_SECRET_PATH}")
48-
skopeo login --username "${DOCKER_USERNAME_SECRET}" --password "${DOCKER_PASSWORD_SECRET}" "${DOCKER_REGISTRY}"
49-
5040
# download the amd64 and arm64 builds of the image from the previous steps
5141
buildkite-agent artifact download "build/distributions/**" . --step "packaging-service-container-amd64"
5242
buildkite-agent artifact download "build/distributions/**" . --step "packaging-service-container-arm64"
5343

54-
# get the digest information so the manifest reference the images
55-
AMD64_DIGEST=$(skopeo inspect --format "{{.Digest}}" "docker-archive:./build/distributions/elastic-agent-service-$DOCKER_TAG-$BUILD_VERSION-linux-amd64.docker.tar.gz")
56-
ARM64_DIGEST=$(skopeo inspect --format "{{.Digest}}" "docker-archive:./build/distributions/elastic-agent-service-$DOCKER_TAG-$BUILD_VERSION-linux-arm64.docker.tar.gz")
44+
# AMD64
45+
docker load -i ./build/distributions/elastic-agent-service-$DOCKER_TAG-$BUILD_VERSION-linux-amd64.docker.tar.gz
46+
docker image tag "elastic-agent-service:$DOCKER_TAG" "$PRIVATE_IMAGE"
47+
AMD64_DIGEST=$(docker image inspect --format "{{index .RepoDigests 0}}" "$PRIVATE_IMAGE")
48+
docker push "$AMD64_DIGEST"
5749

58-
# copy the images into the private image location with digest (not tag)
59-
skopeo copy --all "docker-archive:./build/distributions/elastic-agent-service-$DOCKER_TAG-$BUILD_VERSION-linux-amd64.docker.tar.gz" "docker://$PRIVATE_REPO@$AMD64_DIGEST"
60-
skopeo copy --all "docker-archive:./build/distributions/elastic-agent-service-$DOCKER_TAG-$BUILD_VERSION-linux-arm64.docker.tar.gz" "docker://$PRIVATE_REPO@$ARM64_DIGEST"
50+
# ARM64 (overwrites AMD64 tags)
51+
docker load -i ./build/distributions/elastic-agent-service-$DOCKER_TAG-$BUILD_VERSION-linux-arm64.docker.tar.gz
52+
docker image tag "elastic-agent-service:$DOCKER_TAG" "$PRIVATE_IMAGE"
53+
ARM64_DIGEST=$(docker image inspect --format "{{index .RepoDigests 0}}" "$PRIVATE_IMAGE")
54+
docker push "$ARM64_DIGEST"
6155

6256
# create a new manifest image referencing the source images
6357
docker buildx imagetools create -t "$PRIVATE_IMAGE" \
64-
"$PRIVATE_REPO@$AMD64_DIGEST" \
65-
"$PRIVATE_REPO@$ARM64_DIGEST"
66-
skopeo copy --all "docker-daemon:$PRIVATE_IMAGE" "docker://$PRIVATE_IMAGE"
58+
"$AMD64_DIGEST" \
59+
"$ARM64_DIGEST"
60+
docker push "$PRIVATE_IMAGE"
6761

6862
annotate "* Image: $PRIVATE_IMAGE"
6963
annotate "* Short commit: $VERSION"

0 commit comments

Comments
 (0)