Skip to content

Commit d64e748

Browse files
authored
bk: use docker login plugin (#631)
1 parent f53a560 commit d64e748

File tree

6 files changed

+20
-24
lines changed

6 files changed

+20
-24
lines changed

.buildkite/fpm-pipeline.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
env:
44
SETUP_GVM_VERSION: "v0.5.1"
55
IMAGE_UBUNTU_X86_64: "family/core-ubuntu-2204"
6-
DOCKER_REGISTRY: "docker.elastic.co"
7-
STAGING_IMAGE: "${DOCKER_REGISTRY}/observability-ci"
6+
STAGING_IMAGE: "docker.elastic.co/observability-ci"
87
MAKEFILE: "fpm"
98
BUILDX: "0"
109

@@ -18,6 +17,9 @@ common:
1817
lifetime: 10800 # seconds
1918
project-id: "elastic-observability-ci"
2019
project-number: "911195782929"
20+
- docker_elastic_login_plugin: &docker_elastic_login_plugin
21+
elastic/vault-docker-login#v0.6.0:
22+
secret_path: 'kv/ci-shared/platform-ingest/elastic_docker_registry'
2123

2224
steps:
2325
- label: ":linux: multiarch Linux x86_64/arm64 FPM docker image"
@@ -35,3 +37,4 @@ steps:
3537
image: "${IMAGE_UBUNTU_X86_64}"
3638
plugins:
3739
- *gcp_oidc_plugin
40+
- *docker_elastic_login_plugin

.buildkite/hooks/pre-command

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,6 @@ set -euo pipefail
44

55
source .buildkite/scripts/common.sh
66

7-
DOCKER_REGISTRY_SECRET_PATH="kv/ci-shared/platform-ingest/docker_registry_prod"
8-
9-
# Secrets must be redacted
10-
# https://buildkite.com/docs/pipelines/managing-log-output#redacted-environment-variables
11-
12-
if [[ ("$BUILDKITE_PIPELINE_SLUG" == "golang-crossbuild" || "$BUILDKITE_PIPELINE_SLUG" == "llvm-apple" || "$BUILDKITE_PIPELINE_SLUG" == "fpm") && ( "$BUILDKITE_STEP_KEY" == build* || "$BUILDKITE_STEP_KEY" == release* ) ]]; then
13-
export DOCKER_USERNAME_SECRET=$(retry 5 vault kv get -field user "${DOCKER_REGISTRY_SECRET_PATH}")
14-
export DOCKER_PASSWORD_SECRET=$(retry 5 vault kv get -field password "${DOCKER_REGISTRY_SECRET_PATH}")
15-
docker login -u "${DOCKER_USERNAME_SECRET}" -p "${DOCKER_PASSWORD_SECRET}" "${DOCKER_REGISTRY}" 2>/dev/null
16-
fi
17-
187
if [[ "$BUILDKITE_PIPELINE_SLUG" == "golang-crossbuild" && "$BUILDKITE_STEP_KEY" == "release-post" ]]; then
198
export GITHUB_USERNAME="elasticmachine"
209
export GITHUB_EMAIL="[email protected]"

.buildkite/hooks/pre-exit

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,5 @@ source .buildkite/scripts/common.sh
66

77
unset_secrets
88

9-
if [[ ( "$BUILDKITE_PIPELINE_SLUG" == "golang-crossbuild" || "$BUILDKITE_PIPELINE_SLUG" == "llvm-apple" || "$BUILDKITE_PIPELINE_SLUG" == "fpm") && ( "$BUILDKITE_STEP_KEY" == build* ) ]]; then
10-
docker logout "${DOCKER_REGISTRY}"
11-
fi
12-
139
# Ensure that any temporal files created during any step are removed
1410
cleanup

.buildkite/llvm-apple-pipeline.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ env:
44
SETUP_GVM_VERSION: "v0.5.1"
55
IMAGE_UBUNTU_X86_64: "family/core-ubuntu-2204"
66
IMAGE_UBUNTU_ARM_64: "core-ubuntu-2004-aarch64"
7-
DOCKER_REGISTRY: "docker.elastic.co"
8-
STAGING_IMAGE: "${DOCKER_REGISTRY}/observability-ci"
7+
STAGING_IMAGE: "docker.elastic.co/observability-ci"
98
MAKEFILE: "go/llvm-apple"
109
BUILDX: "0"
1110

@@ -19,6 +18,9 @@ common:
1918
lifetime: 10800 # seconds
2019
project-id: "elastic-observability-ci"
2120
project-number: "911195782929"
21+
- docker_elastic_login_plugin: &docker_elastic_login_plugin
22+
elastic/vault-docker-login#v0.6.0:
23+
secret_path: 'kv/ci-shared/platform-ingest/elastic_docker_registry'
2224

2325
steps:
2426
- label: ":linux: Build LLVM Apple / Ubuntu X86_64 - {{matrix.debianVersion}}"
@@ -39,6 +41,7 @@ steps:
3941
image: "${IMAGE_UBUNTU_X86_64}"
4042
plugins:
4143
- *gcp_oidc_plugin
44+
- *docker_elastic_login_plugin
4245
matrix:
4346
setup:
4447
debianVersion:
@@ -65,6 +68,7 @@ steps:
6568
instanceType: "t4g.large"
6669
plugins:
6770
- *gcp_oidc_plugin
71+
- *docker_elastic_login_plugin
6872
matrix:
6973
setup:
7074
debianVersion:

.buildkite/pipeline.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ env:
55
IMAGE_UBUNTU_X86_64: "family/platform-ingest-beats-ubuntu-2204"
66
INSTANCE_TYPE_X86_64: "n2-standard-4"
77
IMAGE_UBUNTU_ARM_64: "core-ubuntu-2004-aarch64"
8-
DOCKER_REGISTRY: "docker.elastic.co"
9-
STAGING_IMAGE: "${DOCKER_REGISTRY}/observability-ci"
8+
STAGING_IMAGE: "docker.elastic.co/observability-ci"
109
BUILDX: 1
1110

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

2325
steps:
2426

@@ -111,6 +113,7 @@ steps:
111113
instanceType: "${INSTANCE_TYPE_X86_64}"
112114
plugins:
113115
- *gcp_oidc_plugin
116+
- *docker_elastic_login_plugin
114117
retry:
115118
automatic:
116119
limit: 1
@@ -146,6 +149,7 @@ steps:
146149
instanceType: "t4g.large"
147150
plugins:
148151
- *gcp_oidc_plugin
152+
- *docker_elastic_login_plugin
149153
retry:
150154
automatic:
151155
limit: 1
@@ -180,6 +184,7 @@ steps:
180184
instanceType: "${INSTANCE_TYPE_X86_64}"
181185
plugins:
182186
- *gcp_oidc_plugin
187+
- *docker_elastic_login_plugin
183188
retry:
184189
automatic:
185190
limit: 1
@@ -215,6 +220,7 @@ steps:
215220
instanceType: "t4g.large"
216221
plugins:
217222
- *gcp_oidc_plugin
223+
- *docker_elastic_login_plugin
218224
retry:
219225
automatic:
220226
limit: 1

.buildkite/scripts/build.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,4 @@ echo "--- List Docker images staging"
1818
docker images --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}" --filter=reference="${STAGING_IMAGE}/golang-crossbuild"
1919

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

0 commit comments

Comments
 (0)