chanzuckerberg / github-actions

A collection of re-usable GitHub Actions
MIT License
5 stars 3 forks source link

feat: add ability to delete all stacks in happy environment #275

Closed shitchcock closed 3 months ago

shitchcock commented 4 months ago

We have a bunch of stacks that don't belong to apps with automated happy cleanup jobs.

We want the ability to delete any stale stacks in the whole edu environment

https://czi-tech.atlassian.net/jira/software/c/projects/EFI/boards/209?selectedIssue=EFI-1888

Test details. Open up bash and run commands

ENV="rdev"
list="happy list --all --output json --env $ENV"
force=""
for i in $($(echo $list) | jq -r --arg date "$date" '.[] | select(.last_updated < $date) | .stack'); do
          echo "Deleting stack: $i"
done

The following fails

happy delete smp-shitchcock --env $ENV "$force"

The following succeeds

force="--force"
happy delete smp-shitchcock --env $ENV "$force"
shitchcock commented 3 months ago

Where do we plan to run this action with all: true?

I plan on writing a Github action that runs once every couple weeks and deletes any stacks in edu platform that have been running for longer than 30 days.

Also check for understanding, does this mean running this action in edu-platform-observability with all: true will remove all stale stacks for different apps?

Yes for all stale stacks in the edu platform happy environment