Skip to content

Adding a EKS Purge Job, removing the AKS job, making the frequency once a day for test job #9

Adding a EKS Purge Job, removing the AKS job, making the frequency once a day for test job

Adding a EKS Purge Job, removing the AKS job, making the frequency once a day for test job #9

name: Purge AWS EKS Clusters
on:
schedule:
# Runs every 6 hours
- cron: "0 */6 * * *"
pull_request:
types: [opened, synchronize, reopened]
branches:
- v*.*
- edge
env:
GH_TOKEN: ${{ github.token }}
AWS_REGION: us-west-2
jobs:
purge_eks_clusters:
name: Purge AWS EKS Clusters
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install AWS CLI
run: |
sudo apt-get update
sudo apt-get install -y awscli
- name: Install eksctl
run: |
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
- name: Delete old EKS clusters
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ env.AWS_REGION }}
run: bash .github/scripts/purge-aws-eks-clusters.sh
- name: Create GitHub issue on failure
if: failure() && github.event_name != 'pull_request'
run: |
gh issue create --title "Purge AWS EKS Clusters workflow failed" \
--body "Test failed on ${{ github.repository }}. See [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details." \
--repo ${{ github.repository }}