diff --git a/.buildkite/bk.integration.pipeline.yml b/.buildkite/bk.integration.pipeline.yml index c3efe6265b2..d69aa9d7692 100644 --- a/.buildkite/bk.integration.pipeline.yml +++ b/.buildkite/bk.integration.pipeline.yml @@ -12,6 +12,7 @@ env: IMAGE_DEBIAN_12: "platform-ingest-elastic-agent-debian-12-1757120457" IMAGE_WIN_2022: "platform-ingest-elastic-agent-windows-2022-1757120457" IMAGE_WIN_2025: "platform-ingest-elastic-agent-windows-2025-1757120457" + ASDF_TERRAFORM_VERSION: 1.9.2 # This section is used to define the plugins that will be used in the pipeline. # See https://buildkite.com/docs/pipelines/integrations/plugins/using#using-yaml-anchors-with-plugins @@ -49,8 +50,6 @@ steps: notify: - github_commit_status: context: "buildkite/elastic-agent-extended-testing - ESS stack provision" - env: - ASDF_TERRAFORM_VERSION: 1.9.2 command: .buildkite/scripts/steps/ess_start.sh retry: automatic: diff --git a/.buildkite/scripts/steps/ess.ps1 b/.buildkite/scripts/steps/ess.ps1 index 6ab4dceb8e9..7722948273d 100644 --- a/.buildkite/scripts/steps/ess.ps1 +++ b/.buildkite/scripts/steps/ess.ps1 @@ -40,6 +40,9 @@ function ess_up { } function ess_down { + param ( + [string]$EssRegion = "gcp-us-west2" + ) $Workspace = & git rev-parse --show-toplevel $TfDir = Join-Path -Path $Workspace -ChildPath "test_infra/ess/" $stateFilePath = Join-Path -Path $TfDir -ChildPath "terraform.tfstate" @@ -52,7 +55,8 @@ function ess_down { try { Push-Location -Path $TfDir & terraform init - & terraform destroy -auto-approve + & terraform destroy -auto-approve ` + -var="ess_region=$EssRegion" Pop-Location } catch { Write-Output "Error: Failed to destroy ESS stack(it will be auto-deleted later): $_" diff --git a/.buildkite/scripts/steps/ess.sh b/.buildkite/scripts/steps/ess.sh index 13b0e9a9ced..a6cdbd4dd2a 100755 --- a/.buildkite/scripts/steps/ess.sh +++ b/.buildkite/scripts/steps/ess.sh @@ -39,13 +39,15 @@ function ess_up() { } function ess_down() { - echo "~~~ Tearing down the ESS Stack" + echo "~~~ Tearing down the ESS Stack" + local ESS_REGION=${1:-"gcp-us-west2"} local WORKSPACE=$(git rev-parse --show-toplevel) local TF_DIR="${WORKSPACE}/test_infra/ess/" pushd "${TF_DIR}" terraform init - terraform destroy -auto-approve + terraform destroy -auto-approve \ + -var="ess_region=${ESS_REGION}" popd } diff --git a/.buildkite/scripts/steps/ess_down.sh b/.buildkite/scripts/steps/ess_down.sh index 2de58a0c382..565d5fde845 100755 --- a/.buildkite/scripts/steps/ess_down.sh +++ b/.buildkite/scripts/steps/ess_down.sh @@ -3,4 +3,6 @@ set -euo pipefail source .buildkite/scripts/steps/ess.sh -ess_down || echo "Failed to stop ESS stack" >&2 +ESS_REGION="${ESS_REGION:-gcp-us-west2}" + +ess_down "$ESS_REGION" \ No newline at end of file