Skip to content

[1.23](backport #631) bk: use docker login plugin #633

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

Merged
merged 2 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 5 additions & 2 deletions .buildkite/fpm-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
env:
SETUP_GVM_VERSION: "v0.5.1"
IMAGE_UBUNTU_X86_64: "family/core-ubuntu-2204"
DOCKER_REGISTRY: "docker.elastic.co"
STAGING_IMAGE: "${DOCKER_REGISTRY}/observability-ci"
STAGING_IMAGE: "docker.elastic.co/observability-ci"
MAKEFILE: "fpm"
CHANGESET_FILE: ".buildkite/scripts/changeset/fpm"
DOCKER_FILTER_REF: "docker.elastic.co/beats-dev"
Expand All @@ -20,6 +19,9 @@ common:
lifetime: 10800 # seconds
project-id: "elastic-observability-ci"
project-number: "911195782929"
- docker_elastic_login_plugin: &docker_elastic_login_plugin
elastic/vault-docker-login#v0.6.0:
secret_path: 'kv/ci-shared/platform-ingest/elastic_docker_registry'

steps:
- label: ":linux: Build FPM / Ubuntu X86_64"
Expand All @@ -38,3 +40,4 @@ steps:
image: "${IMAGE_UBUNTU_X86_64}"
plugins:
- *gcp_oidc_plugin
- *docker_elastic_login_plugin
11 changes: 0 additions & 11 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@ set -euo pipefail

source .buildkite/scripts/common.sh

DOCKER_REGISTRY_SECRET_PATH="kv/ci-shared/platform-ingest/docker_registry_prod"

# Secrets must be redacted
# https://buildkite.com/docs/pipelines/managing-log-output#redacted-environment-variables

if [[ ("$BUILDKITE_PIPELINE_SLUG" == "golang-crossbuild" || "$BUILDKITE_PIPELINE_SLUG" == "llvm-apple" || "$BUILDKITE_PIPELINE_SLUG" == "fpm") && ( "$BUILDKITE_STEP_KEY" == build* || "$BUILDKITE_STEP_KEY" == release* ) ]]; then
export DOCKER_USERNAME_SECRET=$(retry 5 vault kv get -field user "${DOCKER_REGISTRY_SECRET_PATH}")
export DOCKER_PASSWORD_SECRET=$(retry 5 vault kv get -field password "${DOCKER_REGISTRY_SECRET_PATH}")
docker login -u "${DOCKER_USERNAME_SECRET}" -p "${DOCKER_PASSWORD_SECRET}" "${DOCKER_REGISTRY}" 2>/dev/null
fi

if [[ "$BUILDKITE_PIPELINE_SLUG" == "golang-crossbuild" && "$BUILDKITE_STEP_KEY" == "release-post" ]]; then
GITHUB_USERNAME_SECRET="elasticmachine"
export GITHUB_USERNAME_SECRET=$GITHUB_USERNAME_SECRET
Expand Down
4 changes: 0 additions & 4 deletions .buildkite/hooks/pre-exit
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,5 @@ source .buildkite/scripts/common.sh

unset_secrets

if [[ ( "$BUILDKITE_PIPELINE_SLUG" == "golang-crossbuild" || "$BUILDKITE_PIPELINE_SLUG" == "llvm-apple" || "$BUILDKITE_PIPELINE_SLUG" == "fpm") && ( "$BUILDKITE_STEP_KEY" == build* ) ]]; then
docker logout "${DOCKER_REGISTRY}"
fi

# Ensure that any temporal files created during any step are removed
cleanup
8 changes: 6 additions & 2 deletions .buildkite/llvm-apple-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ env:
SETUP_GVM_VERSION: "v0.5.1"
IMAGE_UBUNTU_X86_64: "family/core-ubuntu-2204"
IMAGE_UBUNTU_ARM_64: "core-ubuntu-2004-aarch64"
DOCKER_REGISTRY: "docker.elastic.co"
STAGING_IMAGE: "${DOCKER_REGISTRY}/observability-ci"
STAGING_IMAGE: "docker.elastic.co/observability-ci"
MAKEFILE: "go/llvm-apple"
CHANGESET_FILE: ".buildkite/scripts/changeset/llvm-apple"
DOCKER_FILTER_REF: "*/*/golang-crossbuild:llvm-apple*"
Expand All @@ -21,6 +20,9 @@ common:
lifetime: 10800 # seconds
project-id: "elastic-observability-ci"
project-number: "911195782929"
- docker_elastic_login_plugin: &docker_elastic_login_plugin
elastic/vault-docker-login#v0.6.0:
secret_path: 'kv/ci-shared/platform-ingest/elastic_docker_registry'

steps:
- label: ":linux: Build LLVM Apple / Ubuntu X86_64 - {{matrix.debianVersion}}"
Expand All @@ -41,6 +43,7 @@ steps:
image: "${IMAGE_UBUNTU_X86_64}"
plugins:
- *gcp_oidc_plugin
- *docker_elastic_login_plugin
matrix:
setup:
debianVersion:
Expand All @@ -67,6 +70,7 @@ steps:
instanceType: "t4g.large"
plugins:
- *gcp_oidc_plugin
- *docker_elastic_login_plugin
matrix:
setup:
debianVersion:
Expand Down
10 changes: 8 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ env:
IMAGE_UBUNTU_X86_64: "family/platform-ingest-beats-ubuntu-2204"
INSTANCE_TYPE_X86_64: "n2-standard-4"
IMAGE_UBUNTU_ARM_64: "core-ubuntu-2004-aarch64"
DOCKER_REGISTRY: "docker.elastic.co"
STAGING_IMAGE: "${DOCKER_REGISTRY}/observability-ci"
STAGING_IMAGE: "docker.elastic.co/observability-ci"
BUILDX: 1

# This section is used to define the plugins that will be used in the pipeline.
Expand All @@ -19,6 +18,9 @@ common:
lifetime: 10800 # seconds
project-id: "elastic-observability-ci"
project-number: "911195782929"
- docker_elastic_login_plugin: &docker_elastic_login_plugin
elastic/vault-docker-login#v0.6.0:
secret_path: 'kv/ci-shared/platform-ingest/elastic_docker_registry'

steps:

Expand Down Expand Up @@ -110,6 +112,7 @@ steps:
instanceType: "${INSTANCE_TYPE_X86_64}"
plugins:
- *gcp_oidc_plugin
- *docker_elastic_login_plugin
retry:
automatic:
limit: 1
Expand Down Expand Up @@ -145,6 +148,7 @@ steps:
instanceType: "t4g.large"
plugins:
- *gcp_oidc_plugin
- *docker_elastic_login_plugin
retry:
automatic:
limit: 1
Expand Down Expand Up @@ -178,6 +182,7 @@ steps:
instanceType: "${INSTANCE_TYPE_X86_64}"
plugins:
- *gcp_oidc_plugin
- *docker_elastic_login_plugin
retry:
automatic:
limit: 1
Expand Down Expand Up @@ -213,6 +218,7 @@ steps:
instanceType: "t4g.large"
plugins:
- *gcp_oidc_plugin
- *docker_elastic_login_plugin
retry:
automatic:
limit: 1
Expand Down
8 changes: 3 additions & 5 deletions .buildkite/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ with_mage

make -C go -f "${MAKEFILE}" build"${is_arm}" GS_BUCKET_PATH=golang-crossbuild-ci-internal

echo "--- List Docker images staging"xd
echo "--- List Docker images staging"
docker images --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}" --filter=reference="${STAGING_IMAGE}/golang-crossbuild"

echo ":: List Docker images production ::"
docker images --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}" --filter=reference="${DOCKER_REGISTRY}/beats-dev/golang-crossbuild"


echo "--- List Docker images production"
docker images --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}" --filter=reference="docker.elastic.co/beats-dev/golang-crossbuild"