Skip to content

Commit db7aff4

Browse files
authored
[8.17] (backport #8444) bk(docker-login): use BK plugin (#8475)
1 parent d6ddb52 commit db7aff4

11 files changed

+12
-32
lines changed

.buildkite/bk.integration.pipeline.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
22

33
env:
4-
DOCKER_REGISTRY: "docker.elastic.co"
54
VAULT_PATH: "kv/ci-shared/observability-ingest/cloud/gcp"
65
ASDF_MAGE_VERSION: 1.14.0
76

.buildkite/hooks/pre-command

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,11 @@ if [[ -z "${GO_VERSION-""}" ]]; then
1313
export GO_VERSION=$(cat "${WORKSPACE}/.go-version")
1414
fi
1515

16-
DOCKER_REGISTRY="docker.elastic.co"
17-
DOCKER_REGISTRY_SECRET_PATH="kv/ci-shared/platform-ingest/docker_registry_prod"
1816
CI_DRA_ROLE_PATH="kv/ci-shared/release/dra-role"
1917
CI_GCP_OBS_PATH="kv/ci-shared/observability-ingest/cloud/gcp"
2018
CI_ESS_PATH="kv/ci-shared/platform-ingest/platform-ingest-ec-prod"
2119
CI_DRA_ROLE_PATH="kv/ci-shared/release/dra-role"
2220

23-
24-
function docker_login {
25-
DOCKER_USERNAME_SECRET=$(retry 5 vault kv get -field user "${DOCKER_REGISTRY_SECRET_PATH}")
26-
DOCKER_PASSWORD_SECRET=$(retry 5 vault kv get -field password "${DOCKER_REGISTRY_SECRET_PATH}")
27-
docker login -u "${DOCKER_USERNAME_SECRET}" -p "${DOCKER_PASSWORD_SECRET}" "${DOCKER_REGISTRY}" 2>/dev/null
28-
unset DOCKER_USERNAME_SECRET DOCKER_PASSWORD_SECRET
29-
}
30-
3121
function release_manager_login {
3222
DRA_CREDS_SECRET=$(retry 5 vault kv get -field=data -format=json ${CI_DRA_ROLE_PATH})
3323
VAULT_ADDR_SECRET=$(echo ${DRA_CREDS_SECRET} | jq -r '.vault_addr')
@@ -37,10 +27,6 @@ function release_manager_login {
3727
}
3828

3929
if [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent-package" ]]; then
40-
if [[ "$BUILDKITE_STEP_KEY" == "package_elastic-agent" ]]; then
41-
docker_login
42-
fi
43-
4430
if [[ "$BUILDKITE_STEP_KEY" == "dra-publish" || "$BUILDKITE_STEP_KEY" == "bk-api-publish-independent-agent" ]]; then
4531
release_manager_login
4632
fi
@@ -61,11 +47,6 @@ if [[ "$BUILDKITE_STEP_KEY" == *"integration-tests"* ]]; then
6147
fi
6248

6349
if [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent-binary-dra" ]]; then
64-
if command -v docker &>/dev/null; then
65-
docker_login
66-
else
67-
echo "+++ docker not found"
68-
fi
6950
if [[ ("$BUILDKITE_STEP_KEY" == "publish-dra-snapshot" || "$BUILDKITE_STEP_KEY" == "publish-dra-staging") ]]; then
7051
echo "+++ Setting DRA params"
7152
# Shared secret path containing the dra creds for project teams

.buildkite/hooks/pre-exit

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,3 @@ if [ -n "$TEST_INTEG_AUTH_GCP_SERVICE_TOKEN_FILE" ]; then
2525
rm $TEST_INTEG_AUTH_GCP_SERVICE_TOKEN_FILE
2626
fi
2727
fi
28-
29-
if command -v docker &>/dev/null; then
30-
DOCKER_REGISTRY="docker.elastic.co"
31-
docker logout $DOCKER_REGISTRY
32-
fi

.buildkite/integration.pipeline.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
22

33
env:
4-
DOCKER_REGISTRY: "docker.elastic.co"
54
VAULT_PATH: "kv/ci-shared/observability-ingest/cloud/gcp"
65

76
steps:

.buildkite/pipeline.elastic-agent-binary-dra.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ env:
77
DRA_PROJECT_ID: "elastic-agent-core"
88
DRA_PROJECT_ARTIFACT_ID: "agent-core"
99

10+
# This section is used to define the plugins that will be used in the pipeline.
11+
# See https://buildkite.com/docs/pipelines/integrations/plugins/using#using-yaml-anchors-with-plugins
12+
common:
13+
- docker_login_plugin: &docker_login_plugin
14+
elastic/vault-docker-login#v0.5.2:
15+
secret_path: 'kv/ci-shared/platform-ingest/elastic_docker_registry'
16+
1017
steps:
1118
- group: ":beats: DRA Elastic-Agent Core Snapshot :beats:"
1219
key: "dra-core-snapshot"
@@ -56,6 +63,8 @@ steps:
5663
machineType: "c2-standard-16"
5764
env:
5865
DRA_WORKFLOW: "snapshot"
66+
plugins:
67+
- *docker_login_plugin
5968

6069
- group: ":beats: DRA Elastic-Agent Core Staging :beats:"
6170
key: "dra-core-staging"
@@ -107,6 +116,8 @@ steps:
107116
machineType: "c2-standard-16"
108117
env:
109118
DRA_WORKFLOW: "staging"
119+
plugins:
120+
- *docker_login_plugin
110121

111122
notify:
112123
- slack: "#ingest-notifications"

.buildkite/pipeline.elastic-agent-gce-cleanup.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# See gce-cleanup.sh and .buildkite/misc/gce-cleanup.yml
55
env:
66
VAULT_PATH: "kv/ci-shared/observability-ingest/cloud/gcp"
7-
DOCKER_REGISTRY: "docker.elastic.co"
87
steps:
98
- label: "GCE Cleanup"
109
key: "gce-cleanup"

.buildkite/pipeline.elastic-agent-package.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
22
env:
3-
DOCKER_REGISTRY: "docker.elastic.co"
43
# this is required in order to allow the build process to override the default PWD of the BEAT_NAME.
54
BEAT_NAME: "elastic-agent"
65
# after moving elastic-agent out of beats, we should update the URL of the packaging.

.buildkite/pipeline.integration-test-matrix.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
22

33
env:
4-
DOCKER_REGISTRY: "docker.elastic.co"
54
VAULT_PATH: "kv/ci-shared/observability-ingest/cloud/gcp"
65

76
steps:

.buildkite/pipeline.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
env:
44
VAULT_PATH: "kv/ci-shared/observability-ingest/cloud/gcp"
5-
DOCKER_REGISTRY: "docker.elastic.co"
65

76
# The following images are defined here and their values will be updated by updatecli
87
# Please do not change them manually.

.buildkite/scripts/steps/gce-cleanup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ docker run -v $(pwd)/.buildkite/misc/gce-cleanup.yml:/etc/cloud-reaper/config.ym
1212
-e ACCOUNT_KEY="$ACCOUNT_KEY_SECRET" \
1313
-e ACCOUNT_PROJECT=$ACCOUNT_PROJECT_SECRET \
1414
-e DELETE_CREATED_AFTER_DATE=$DELETE_CREATED_AFTER_DATE \
15-
${DOCKER_REGISTRY}/observability-ci/cloud-reaper:0.3.0 cloud-reaper --config /etc/cloud-reaper/config.yml destroy --confirm
15+
docker.elastic.co/observability-ci/cloud-reaper:0.3.0 cloud-reaper --config /etc/cloud-reaper/config.yml destroy --confirm

0 commit comments

Comments
 (0)