Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
18cf8ef
Add three-layer defense against orphaned test resources
Nov 5, 2025
b222487
Fix shellcheck errors in cleanup workflow
Nov 5, 2025
95c608c
Fix shellcheck errors in cleanup-test-resources script
Nov 5, 2025
b5bb6eb
TICKET-942 Remove scheduled orphaned detection workflow
Nov 5, 2025
05f934c
Address PR review feedback
Nov 14, 2025
9aad608
Add scheduled workflow to scan for orphaned test resources
Nov 14, 2025
c57578a
Add retry logic to teardown functions
Nov 14, 2025
d745061
Address PR review comments
Nov 25, 2025
0438773
Merge branch 'main' into fix/improve-test-cleanup-process
sean-navapbc Nov 25, 2025
c553d1c
Add runCommandWithRetry helper function to template_infra_test.go
Nov 26, 2025
68401b4
Temporarily trigger scan workflow on feature branch for testing
Nov 26, 2025
203df2f
Rename workflows to template-only- prefix for consistency
Nov 26, 2025
d9d84d5
Remove unnecessary chmod commands from workflows
Nov 26, 2025
322efb1
Rename cleanup script to template-only- prefix
Nov 26, 2025
240f872
Fix shellcheck warning SC2129 - group redirects
Nov 26, 2025
44c06b8
Merge branch 'main' into fix/improve-test-cleanup-process
sean-navapbc Dec 1, 2025
edc0de4
Update .github/workflows/template-only-cleanup-orphaned-infra-test-re…
sean-navapbc Dec 1, 2025
c65abc7
Rename script and update workflow display names
Dec 1, 2025
41d64d7
Continue cleanup even when state bucket is missing
Dec 1, 2025
882a63c
Suppress broken pipe errors in scan workflow
Dec 1, 2025
383f93c
Fix broken pipe errors by redirecting entire pipeline stderr
Dec 1, 2025
9a11699
Add ECS task definition cleanup to cleanup script
Dec 1, 2025
4529637
Fix cleanup script to handle all orphaned resource types
Dec 8, 2025
5a83472
Remove unnecessary private zone filter from Route53 cleanup
Dec 8, 2025
964db22
Improve task definition cleanup logic
Dec 8, 2025
f3af99c
Fix broken pipe errors in scan workflow
Dec 8, 2025
bee83f4
Fix all broken pipe errors in scan workflow
Dec 9, 2025
a5d77ae
Fix shellcheck lint warning in cleanup script
Dec 9, 2025
eda7577
Clean up task definitions in destroy-app-service script
Dec 9, 2025
29ab11d
Remove notify block from scan workflow
Dec 9, 2025
743d112
Fix broken pipe errors by disabling pipefail around head commands
Dec 9, 2025
1f56642
Merge branch 'main' into fix/improve-test-cleanup-process
sean-navapbc Dec 11, 2025
daa0f2e
Fix broken pipe errors and add inactive task definition cleanup
Dec 11, 2025
b6dd99c
Fix broken pipe by trapping SIGPIPE signal
Dec 11, 2025
aea90f5
Suppress broken pipe error messages with stderr redirect
Dec 11, 2025
2dc6051
Fix broken pipe error and show full scan output
Dec 16, 2025
765325e
Fix broken pipe errors by using temp file instead of pipes
Dec 16, 2025
c318ace
Fix inactive task definition lookup to check tags instead of family p…
Dec 16, 2025
005881a
Remove temporary push trigger for testing
Dec 22, 2025
b46f459
Remove unused runCommandWithRetry helper function
Jan 5, 2026
355e27d
Remove unused AGE_HOURS variable from cleanup script
Jan 5, 2026
b9cbff5
Improve task definition cleanup comments and use pushd/popd
Jan 6, 2026
5192884
Get project config from terraform instead of pwd/aws config
Jan 6, 2026
4c768fe
Remove unused --age-hours argument from scan workflow
Jan 6, 2026
e451aa4
Remove unused --age-hours parameter from cleanup workflow
Jan 6, 2026
9acd97c
Fix GitHub issue link for task definition deletion
Jan 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Template CI Infra Checks Cleanup

on:
# Manual trigger only - cleanup is intentionally not automatic
# to avoid masking underlying test issues that should be fixed
workflow_dispatch:
inputs:
project_name:
description: 'Specific project to clean up (e.g., plt-tst-act-12345). Leave empty to find all projects.'
required: false
type: string
dry_run:
description: 'Dry run - list resources without deleting them'
required: false
default: true
type: boolean

jobs:
cleanup:
name: Cleanup Test Resources
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
aws-access-key-id: ${{ secrets.TESTER_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.TESTER_AWS_SECRET_ACCESS_KEY }}

- name: Run cleanup script
run: |
args=()
if [ "${{ inputs.dry_run }}" = "true" ]; then
args+=(--dry-run)
fi

if [ -n "${{ inputs.project_name }}" ]; then
args+=("${{ inputs.project_name }}")
fi

./template-only-bin/cleanup-test-resources "${args[@]}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Template Scan Orphaned Infra Test Resources

on:
workflow_dispatch:
schedule:
# Run every day at 08:00 UTC (4:00am ET, 1:00am PT)
- cron: "0 8 * * *"

jobs:
scan:
name: Scan for orphaned test resources
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
aws-access-key-id: ${{ secrets.TESTER_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.TESTER_AWS_SECRET_ACCESS_KEY }}

- name: Scan for orphaned resources
id: scan
shell: bash
run: |
# Run in dry-run mode to see what would be deleted
# Write to temp file to avoid broken pipe errors from piping large output
tmpfile=$(mktemp)
./template-only-bin/cleanup-test-resources --dry-run > "$tmpfile" 2>&1 || true

# Print full output for debugging
cat "$tmpfile"

# Check if any resources were found (look for "Found X resources" in output)
if grep -q "Found [1-9][0-9]* resources" "$tmpfile"; then
# Extract resource count and project names for notification
resource_info=$(grep -E "(Found [0-9]+ resources|Cleaning up project:|Would delete)" "$tmpfile" | head -30 || true)

{
echo "found=true"
echo "resource_info<<EOF"
echo "$resource_info"
echo "EOF"
} >> "$GITHUB_OUTPUT"
rm -f "$tmpfile"
exit 1
else
echo "found=false" >> "$GITHUB_OUTPUT"
echo ""
echo "=== Summary ==="
echo "No orphaned resources found that need cleanup."
# Show how many projects were checked
project_count=$(grep -c "^=== Cleaning up project:" "$tmpfile" || echo "0")
echo "Checked ${project_count} projects."
rm -f "$tmpfile"
fi
Loading
Loading