Skip to content

Commit

Permalink
Trying cloud-nuke to clear aws resources
Browse files Browse the repository at this point in the history
  • Loading branch information
aktech committed Aug 3, 2023
1 parent f06fa54 commit 81154e8
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 5 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/test_integration.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "Integration Tests"

on:
push:
schedule:
- cron: "0 0 * * MON"
workflow_dispatch:
Expand All @@ -16,8 +17,8 @@ jobs:
matrix:
provider:
- aws
- do
- gcp
# - do
# - gcp
fail-fast: false
steps:
- name: "Checkout Infrastructure"
Expand Down Expand Up @@ -85,7 +86,19 @@ jobs:
echo "SPACES_SECRET_ACCESS_KEY=${{ secrets.SPACES_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV
echo "NEBARI_K8S_VERSION"=1.25.12-do.0 >> $GITHUB_ENV
- name: Integration Tests
# - name: Integration Tests
# run: |
# pytest --version
# pytest tests/tests_integration/ -vvv -s -m ${{ matrix.provider }}

- name: Cloud Nuke AWS
if: ${{ matrix.provider == 'aws' && always()}}
run: |
pytest --version
pytest tests/tests_integration/ -vvv -s -m ${{ matrix.provider }}
mkdir -p bin
pushd bin
wget https://github.com/gruntwork-io/cloud-nuke/releases/download/v0.32.0/cloud-nuke_linux_amd64
mv cloud-nuke_linux_amd64 cloud-nuke
chmod +x cloud-nuke
echo "$PWD" >> $GITHUB_PATH
popd
./tests/scripts/nuke-aws.sh
File renamed without changes.
28 changes: 28 additions & 0 deletions tests/scripts/nuke-aws.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

set -ex

nuke_aws() {
cloud-nuke --version
cloud-nuke aws \
--log-level debug \
--resource-type s3 \
--resource-type vpc \
--resource-type ebs \
--resource-type eip \
--resource-type ec2 \
--resource-type efs \
--resource-type asg \
--resource-type ekscluster \
--resource-type nat-gateway \
--resource-type iam-role \
--resource-type elb \
--region us-west-2 \
--log-level debug \
--config tests/common/cloud-nuke-config.yml --dry-run
}

nuke_aws || true
echo "Trying again to nuke to be sure"
nuke_aws
echo "Done"

0 comments on commit 81154e8

Please sign in to comment.