diff --git a/.buildkite/README.md b/.buildkite/README.md new file mode 100644 index 00000000000..6848e2337a4 --- /dev/null +++ b/.buildkite/README.md @@ -0,0 +1,14 @@ +### Overriding DRA version for ITs + +There are instances when the DRA does not generate the latest versions, which can occur during the Feature Freeze. However, the ITs need these latest versions for testing. + +To address this issue, you can force the DRA version by creating the following two files: + +* `.agent-version` +* `.beat-version` + +The content, should be the version to be used, normally, `major.minor.patch`. + +These files will be read by the `pre-command` hook, which will then create the environment variables `AGENT_VERSION`, `BEAT_VERSION`, and `AGENT_PACKAGE_VERSION`. + +Those environment variables are consumed by the Mage files. \ No newline at end of file diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index f11f9f6b2cc..b8759dcfb0d 100755 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -13,6 +13,19 @@ if [[ -z "${GO_VERSION-""}" ]]; then export GO_VERSION=$(cat "${WORKSPACE}/.go-version") fi +# Begin DRA override +# When DRA is not creating the binaries, we can use the files +# to override +if [[ -f "${WORKSPACE}/.beat-version" ]]; then + export BEAT_VERSION=$(cat "${WORKSPACE}/.beat-version") +fi + +if [[ -f "${WORKSPACE}/.agent-version" ]]; then + export AGENT_PACKAGE_VERSION=$(cat "${WORKSPACE}/.agent-version") + export AGENT_VERSION="$(cat "${WORKSPACE}/.agent-version")-SNAPSHOT" +fi +# End DRA override + CI_DRA_ROLE_PATH="kv/ci-shared/release/dra-role" CI_GCP_OBS_PATH="kv/ci-shared/observability-ingest/cloud/gcp" # This key exists for backward compatibility with OGC framework diff --git a/.buildkite/hooks/pre-command.ps1 b/.buildkite/hooks/pre-command.ps1 index 13eecf8c14b..7ff1830f7f5 100644 --- a/.buildkite/hooks/pre-command.ps1 +++ b/.buildkite/hooks/pre-command.ps1 @@ -1,2 +1,18 @@ # Shorten BUILDKITE_MESSAGE if needed to avoid filling the Windows env var buffer $env:BUILDKITE_MESSAGE = $env:BUILDKITE_MESSAGE.Substring(0, [System.Math]::Min(2048, $env:BUILDKITE_MESSAGE.Length)) + +# Begin DRA override +# When DRA is not creating the binaries, we can use the files +# to override +if (Test-Path -Path .beat-version) { + $beat_version = Get-Content -Path .beat-version -Raw + $env:BEAT_VERSION = $beat_version.Trim() +} + +if (Test-Path -Path .agent-version) { + $agent_version = Get-Content -Path .agent-version -Raw + $agent_version = $agent_version.Trim() + $env:AGENT_PACKAGE_VERSION = $agent_version + $env:AGENT_VERSION = "$agent_version-SNAPSHOT" +} +# End DRA override