From 88d37c80ae3c1846f6060ed3007549f1a8d890c2 Mon Sep 17 00:00:00 2001 From: 1Copenut Date: Wed, 6 Dec 2023 16:55:24 -0600 Subject: [PATCH 1/3] [BUG] Buildkite did not pick up new env variable. --- .../pipelines/pipeline_pull_request_test_and_deploy.yml | 1 + .buildkite/scripts/lifecycle/pre_command.sh | 3 +++ scripts/deploy/deploy_docs | 8 ++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.buildkite/pipelines/pipeline_pull_request_test_and_deploy.yml b/.buildkite/pipelines/pipeline_pull_request_test_and_deploy.yml index 8322fcbfbe5..8d418d90efb 100644 --- a/.buildkite/pipelines/pipeline_pull_request_test_and_deploy.yml +++ b/.buildkite/pipelines/pipeline_pull_request_test_and_deploy.yml @@ -14,3 +14,4 @@ steps: env: GIT_BRANCH: "${BUILDKITE_BRANCH}" GIT_PULL_REQUEST_ID: "${BUILDKITE_PULL_REQUEST}" + DEPLOY_ROOT: "false" #TODO: Revert diff --git a/.buildkite/scripts/lifecycle/pre_command.sh b/.buildkite/scripts/lifecycle/pre_command.sh index 9dbaffd6dcd..744021a0b3a 100644 --- a/.buildkite/scripts/lifecycle/pre_command.sh +++ b/.buildkite/scripts/lifecycle/pre_command.sh @@ -17,5 +17,8 @@ export GCE_ACCOUNT GITHUB_TOKEN=$(retry 5 vault read -field=github_token $GITHUB_ACCOUNT) export GITHUB_TOKEN +GCE_IMAGE=google/cloud-sdk:slim +export GCE_IMAGE + GPROJECT=elastic-bekitzur export GPROJECT diff --git a/scripts/deploy/deploy_docs b/scripts/deploy/deploy_docs index 2470b3db98f..c90e0de6d68 100755 --- a/scripts/deploy/deploy_docs +++ b/scripts/deploy/deploy_docs @@ -13,12 +13,16 @@ set +x # Expected env variables: # * GPROJECT - GCE project name, e.g. elastic-bekitzur # * GCE_ACCOUNT - credentials for the google service account (JSON blob) +# * GCE_IMAGE - Google's Docker image to publish docs # * GIT_BRANCH - current Git branch or tag (e.g. "refs/heads/main", "v18.2.1") # * GIT_PULL_REQUEST_ID - current Git PR (Ex. 6999) or "false" from Buildkite env # * GIT_TAG - current Git tag (Ex. v87.0.0) from Buildkite env +# * DEPLOY_ROOT - passed in from Buildkite UI to manually run release docs deployment -# Docker images -GCE_IMAGE=google/cloud-sdk:slim +# Test that DEPLOY_ROOT is being passed properly +# TODO: Revert +echo "Testing deploy_root should be output" +echo ${DEPLOY_ROOT} if [[ -z "${GPROJECT}" ]]; then echo "GPROJECT is not set, e.g. 'GPROJECT=elastic-bekitzur'" From 467f14e31dae23a96b76c54b38761c8b4a9999dd Mon Sep 17 00:00:00 2001 From: 1Copenut Date: Wed, 6 Dec 2023 17:08:44 -0600 Subject: [PATCH 2/3] Removing test env variable, leaving echo in place for now. --- .buildkite/pipelines/pipeline_pull_request_test_and_deploy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.buildkite/pipelines/pipeline_pull_request_test_and_deploy.yml b/.buildkite/pipelines/pipeline_pull_request_test_and_deploy.yml index 8d418d90efb..8322fcbfbe5 100644 --- a/.buildkite/pipelines/pipeline_pull_request_test_and_deploy.yml +++ b/.buildkite/pipelines/pipeline_pull_request_test_and_deploy.yml @@ -14,4 +14,3 @@ steps: env: GIT_BRANCH: "${BUILDKITE_BRANCH}" GIT_PULL_REQUEST_ID: "${BUILDKITE_PULL_REQUEST}" - DEPLOY_ROOT: "false" #TODO: Revert From a9f6dff18ebc9216ac36fc95cab82703b998b2e1 Mon Sep 17 00:00:00 2001 From: 1Copenut Date: Thu, 7 Dec 2023 15:16:03 -0600 Subject: [PATCH 3/3] Passing env variable into Docker run call. --- scripts/deploy/deploy_docs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/deploy/deploy_docs b/scripts/deploy/deploy_docs index c90e0de6d68..6e4a8258394 100755 --- a/scripts/deploy/deploy_docs +++ b/scripts/deploy/deploy_docs @@ -17,12 +17,11 @@ set +x # * GIT_BRANCH - current Git branch or tag (e.g. "refs/heads/main", "v18.2.1") # * GIT_PULL_REQUEST_ID - current Git PR (Ex. 6999) or "false" from Buildkite env # * GIT_TAG - current Git tag (Ex. v87.0.0) from Buildkite env -# * DEPLOY_ROOT - passed in from Buildkite UI to manually run release docs deployment +# * DEPLOY_ROOT - passed in from Buildkite UI or undefined. Manually publishes release docs when set to true. # Test that DEPLOY_ROOT is being passed properly # TODO: Revert -echo "Testing deploy_root should be output" -echo ${DEPLOY_ROOT} +echo "Testing deploy_root is ${DEPLOY_ROOT}" if [[ -z "${GPROJECT}" ]]; then echo "GPROJECT is not set, e.g. 'GPROJECT=elastic-bekitzur'" @@ -107,6 +106,7 @@ if [[ "$1" != "nodocker" ]]; then --env GIT_PULL_REQUEST_ID \ --env GIT_TAG \ --env CURRENT_RELEASE="${CURRENT_RELEASE}" \ + --env DEPLOY_ROOT="${DEPLOY_ROOT}" \ --env HOME=/tmp \ --user="$(id -u):$(id -g)" \ --volume "${PWD}":/app:ro \ @@ -141,7 +141,7 @@ else # Our branched docs deploys are **only** ever triggered by tags # https://buildkite.com/docs/pipelines/environment-variables#BUILDKITE_TAG - elif [[ ! -z "${GIT_TAG}" ]]; then + elif [[ -n "${GIT_TAG}" ]]; then echo "Deploying eui.elastic.co/${GIT_TAG}" full_bucket_path="gs://${BUCKET}/${GIT_TAG}/" max_age="1800" # Reducing to 15 minutes to limit stale docs