diff --git a/lib/get-tags.sh b/lib/get-tags.sh index f0f1e45..894b1be 100644 --- a/lib/get-tags.sh +++ b/lib/get-tags.sh @@ -40,7 +40,7 @@ function getTags() { RETRY_COUNT=${BUILDKITE_RETRY_COUNT:-0} ADDITIONAL_TAGS=$(readAdditionalTags) - RESULT="is_master:${IS_MASTER},pipeline_slug:${PIPELINE_SLUG},step_command:${BK_COMMAND},step_label:${BK_LABEL},retry_count:${RETRY_COUNT},agent_queue=${BK_AGENT_QUEUE}" + RESULT="is_master:${IS_MASTER},pipeline_slug:${PIPELINE_SLUG},step_command:${BK_COMMAND},step_label:${BK_LABEL},retry_count:${RETRY_COUNT},agent_queue:${BK_AGENT_QUEUE}" if [ -n "$ADDITIONAL_TAGS" ]; then RESULT+=",${ADDITIONAL_TAGS}" diff --git a/tests/post-checkout.bats b/tests/post-checkout.bats index f5f71fa..c1c6823 100644 --- a/tests/post-checkout.bats +++ b/tests/post-checkout.bats @@ -9,16 +9,18 @@ load "$BATS_PATH/load.bash" export BUILDKITE_PIPELINE_SLUG=monorepo export BUILDKITE_COMMAND="cd somewhere && make do-something" export BUILDKITE_LABEL=":shipit: deploy-prod" + export BUILDKITE_AGENT_META_DATA_QUEUE="default" run "$PWD/hooks/post-checkout" assert_success assert_output --partial "Reporting buildkite.steps.checkout.duration with value=90" - assert_output --partial "tags=is_master:true,pipeline_slug:monorepo,step_command:cd somewhere && make do-something,step_label::shipit: deploy-prod,retry_count:0" + assert_output --partial "tags=is_master:true,pipeline_slug:monorepo,step_command:cd somewhere && make do-something,step_label::shipit: deploy-prod,retry_count:0,agent_queue:default" unset BUILDKITE_PLUGIN_DATADOG_STATS_COMMAND_START_TIME_MS unset BUILDKITE_BRANCH unset BUILDKITE_PIPELINE_SLUG unset BUILDKITE_COMMAND unset BUILDKITE_LABEL + unset BUILDKITE_AGENT_META_DATA_QUEUE } diff --git a/tests/post-command.bats b/tests/post-command.bats index b827c07..8d7a201 100644 --- a/tests/post-command.bats +++ b/tests/post-command.bats @@ -9,6 +9,7 @@ load "$BATS_PATH/load.bash" export BUILDKITE_PIPELINE_SLUG=monorepo export BUILDKITE_COMMAND="cd somewhere && make do-something" export BUILDKITE_LABEL=":shipit: deploy-prod" + export BUILDKITE_AGENT_META_DATA_QUEUE="default" run "$PWD/hooks/post-command" @@ -21,6 +22,7 @@ load "$BATS_PATH/load.bash" unset BUILDKITE_PIPELINE_SLUG unset BUILDKITE_COMMAND unset BUILDKITE_LABEL + unset BUILDKITE_AGENT_META_DATA_QUEUE } @test "Sets the correct tags and runtime for a non-master branch" { @@ -30,6 +32,7 @@ load "$BATS_PATH/load.bash" export BUILDKITE_PIPELINE_SLUG=monorepo export BUILDKITE_COMMAND="cd somewhere && make do-something" export BUILDKITE_LABEL=":shipit: deploy-prod" + export BUILDKITE_AGENT_META_DATA_QUEUE="default" run "$PWD/hooks/post-command" @@ -42,6 +45,7 @@ load "$BATS_PATH/load.bash" unset BUILDKITE_PIPELINE_SLUG unset BUILDKITE_COMMAND unset BUILDKITE_LABEL + unset BUILDKITE_AGENT_META_DATA_QUEUE } @test "It supports specifying additional tags by value and env var" { @@ -56,12 +60,13 @@ load "$BATS_PATH/load.bash" export MY_ENV_VAR="my-tag-value" export BUILDKITE_PLUGIN_DATADOG_STATS_ADDITIONAL_TAGS_1_TAG="my-other-tag" export BUILDKITE_PLUGIN_DATADOG_STATS_ADDITIONAL_TAGS_1_VALUE="my-other-tag-value" + export BUILDKITE_AGENT_META_DATA_QUEUE="default" run "$PWD/hooks/post-command" assert_success assert_output --partial "Reporting buildkite.steps.command.duration with value=90" - assert_output --partial "tags=is_master:false,pipeline_slug:monorepo,step_command:cd somewhere && make do-something,step_label::shipit: deploy-prod,retry_count:0,my-tag:my-tag-value,my-other-tag:my-other-tag-value" + assert_output --partial "tags=is_master:false,pipeline_slug:monorepo,step_command:cd somewhere && make do-something,step_label::shipit: deploy-prod,retry_count:0,agent_queue:default,my-tag:my-tag-value,my-other-tag:my-other-tag-value" unset BUILDKITE_PLUGIN_DATADOG_STATS_COMMAND_START_TIME_MS unset BUILDKITE_BRANCH @@ -73,4 +78,5 @@ load "$BATS_PATH/load.bash" unset MY_ENV_VAR unset BUILDKITE_PLUGIN_DATADOG_STATS_ADDITIONAL_TAGS_1_TAG unset BUILDKITE_PLUGIN_DATADOG_STATS_ADDITIONAL_TAGS_1_VALUE + unset BUILDKITE_AGENT_META_DATA_QUEUE } diff --git a/tests/pre-exit.bats b/tests/pre-exit.bats index 4f29f03..f9c20a2 100644 --- a/tests/pre-exit.bats +++ b/tests/pre-exit.bats @@ -9,6 +9,7 @@ load "$BATS_PATH/load.bash" export BUILDKITE_PIPELINE_SLUG=monorepo export BUILDKITE_COMMAND="cd somewhere && make do-something" export BUILDKITE_LABEL=":shipit: deploy-prod" + export BUILDKITE_AGENT_META_DATA_QUEUE="default" run "$PWD/hooks/pre-exit" @@ -21,4 +22,5 @@ load "$BATS_PATH/load.bash" unset BUILDKITE_PIPELINE_SLUG unset BUILDKITE_COMMAND unset BUILDKITE_LABEL + unset BUILDKITE_AGENT_META_DATA_QUEUE }