Skip to content
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

Move secrets fetching to pre-command hook #2923

Merged
merged 1 commit into from
Feb 6, 2024
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
3 changes: 2 additions & 1 deletion .buildkite/air_gapped_pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
steps:
- label: ":white_check_mark: Build air-gapped"
- key: "publish-air-gapped-doc"
label: ":white_check_mark: Build and publish air-gapped doc"
command: ".buildkite/scripts/publish_air_gapped_docs.sh"
env:
AIR_GAPPED: "docker.elastic.co/docs-private/bk_air_gapped:latest"
Expand Down
3 changes: 3 additions & 0 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ elif [[ "$BUILDKITE_PIPELINE_SLUG" == "docs-preview-cleaner" ]];then
export GITHUB_TOKEN=$(retry 5 vault kv get -field=value secret/ci/elastic-docs/docs_preview_cleaner)
elif [[ "$BUILDKITE_PIPELINE_SLUG" == "docs-build" ]];then
export BUILD_MACHINE_TYPE="n2-highcpu-32"
elif [[ "$BUILDKITE_PIPELINE_SLUG" == "docs-build-air-gapped" ]] && [[ "$BUILDKITE_STEP_KEY" == "publish-air-gapped-doc" ]]; then
export DOCKER_USERNAME=$(retry 5 vault kv get -field=username secret/ci/elastic-docs/docker.elastic.co)
export DOCKER_PASSWORD=$(retry 5 vault kv get -field=password secret/ci/elastic-docs/docker.elastic.co)
fi
12 changes: 2 additions & 10 deletions .buildkite/scripts/publish_air_gapped_docs.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
#!/bin/bash
set -eo pipefail

# Log in to docker.elastic.co.
set +x
DOCKER_USERNAME=$(vault kv get -field=username secret/ci/elastic-docs/docker.elastic.co)
DOCKER_PASSWORD=$(vault kv get -field=password secret/ci/elastic-docs/docker.elastic.co)
source .buildkite/scripts/retry.sh
retry 5 docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD docker.elastic.co
unset DOCKER_USERNAME
unset DOCKER_PASSWORD
set -x

source ./air_gapped/build_bk.sh
echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin docker.elastic.co
echo "Pushing doc to $AIR_GAPPED"
docker push "$AIR_GAPPED"
29 changes: 0 additions & 29 deletions .buildkite/scripts/retry.sh

This file was deleted.

1 change: 0 additions & 1 deletion air_gapped/build_bk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Build the docker image for the air gapped docs.

set -eo pipefail

cd $(git rev-parse --show-toplevel)

if [[ ! -d /opt/git-mirrors/built-docs.git ]]; then
Expand Down