Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
e3b0c442 committed Mar 7, 2023
1 parent 97b3b9b commit b6b8d93
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/e2e-infra-cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ jobs:
mapfile -t WORKSPACES < <(terraform workspace list | grep -o 'automation-\w*')
declare -a EXPIRED_WORKSPACES
for workspace in "${WORKSPACES[@]}"; do
export TF_WORKSPACE="${workspace}"
COMPLETION=$(date -d "$(terraform output -no-color -raw completion_timestamp)" +%s) || continue
[ $(($(date +%s) - COMPLETION)) -gt $((60 * 60 * CLEANUP_INTERVAL_HOURS)) ] && EXPIRED_WORKSPACES+=("${TF_WORKSPACE}")
COMPLETION=$(date -d "$(TF_WORKSPACE="${workspace}" terraform output -no-color -raw completion_timestamp)" +%s) || continue
[ $(($(date +%s) - COMPLETION)) -gt $((60 * 60 * CLEANUP_INTERVAL_HOURS)) ] && EXPIRED_WORKSPACES+=("${workspace}")
done
echo "workspaces=$(printf '%s\n' "${EXPIRED_WORKSPACES[@]}" | head -c -1 | jq -R . | jq -sc .)" >> "$GITHUB_OUTPUT"
echo "count=$(printf '%s\n' "${EXPIRED_WORKSPACES[@]}" | head -c -1 | jq -R . | jq -sc '. | length')" >> "$GITHUB_OUTPUT"
Expand Down

0 comments on commit b6b8d93

Please sign in to comment.