diff options
author | Lamont Granquist <lamont@chef.io> | 2020-06-04 10:18:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-04 10:18:34 -0700 |
commit | 6bbb1e5c5e98904f9a0c857bdad6f787c0b12a49 (patch) | |
tree | b9ab80b1c599b5b5b610921a749ab9216aac0c72 | |
parent | cbf2666da391bde24de60b726d22486545693ae3 (diff) | |
parent | 1234b745a93167d2227c9ab840706377393665e0 (diff) | |
download | chef-6bbb1e5c5e98904f9a0c857bdad6f787c0b12a49.tar.gz |
Merge pull request #9943 from chef/csnapp/cleanup_orphaned_test_resources
Add nightly cleanup of orphaned test resources
-rwxr-xr-x | .expeditor/cleanup_orphaned_test_resources.sh | 15 | ||||
-rw-r--r-- | .expeditor/config.yml | 9 |
2 files changed, 24 insertions, 0 deletions
diff --git a/.expeditor/cleanup_orphaned_test_resources.sh b/.expeditor/cleanup_orphaned_test_resources.sh new file mode 100755 index 0000000000..ccf1c7473a --- /dev/null +++ b/.expeditor/cleanup_orphaned_test_resources.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -euo pipefail + +echo "--- Setting up Azure credentials" +export VAULT_UTIL_SECRETS="{\"ARM_TENANT_ID\":{\"account\":\"azure/engineering-dev-test\",\"field\":\"tenant_id\"},\"ARM_CLIENT_ID\":{\"account\":\"azure/engineering-dev-test\",\"field\":\"client_id\"},\"ARM_CLIENT_SECRET\":{\"account\":\"azure/engineering-dev-test\",\"field\":\"client_secret\"}}" +. <(vault-util fetch-secret-env) + +# this allows time for the new service-principal to become available +sleep 10 + +az login --service-principal --tenant "$ARM_TENANT_ID" --username "$ARM_CLIENT_ID" --password "$ARM_CLIENT_SECRET" + +echo "--- Deleting Azure kitchen-end-to-end-windows-10 resource groups" +az group list --query "[?starts_with(name, 'kitchen-end-to-end-windows-10-')].name" --output tsv | xargs -n1 -t -I% az group delete -y --no-wait --name "%" diff --git a/.expeditor/config.yml b/.expeditor/config.yml index e76830b4b4..7858f9d866 100644 --- a/.expeditor/config.yml +++ b/.expeditor/config.yml @@ -69,6 +69,11 @@ github: - chef-14: version_constraint: 14* +schedules: + - name: cleanup_orphaned_test_resources + description: Cleanup orphaned test resources + cronline: "0 1 * * *" # every day at 1am + changelog: rollup_header: Changes not yet released to stable @@ -96,6 +101,10 @@ merge_actions: only_if: built_in:bump_version subscriptions: + - workload: schedule_triggered:{{agent_id}}:cleanup_orphaned_test_resources:* + actions: + - bash:.expeditor/cleanup_orphaned_test_resources.sh + # the omnibus/docker/gem chain - workload: artifact_published:unstable:chef:{{version_constraint}} actions: |