Skip to content

Commit

Permalink
Fix helm pr delete
Browse files Browse the repository at this point in the history
Signed-off-by: Colin Wilk <[email protected]>
  • Loading branch information
kliwniloc committed Sep 5, 2024
1 parent 8628c50 commit 2e99209
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 28 deletions.
29 changes: 1 addition & 28 deletions .github/workflows/helm_pr_deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy PR to Kubernetes

on:
pull_request:
types: [opened, synchronize, reopened, closed]
types: [opened, synchronize, reopened]
workflow_run:
workflows: ["tests"]
branches: [main]
Expand All @@ -11,7 +11,6 @@ on:

jobs:
deploy:
if: github.event.action != 'closed'
runs-on: ubuntu-latest
environment: k8s
concurrency: k8s
Expand Down Expand Up @@ -107,29 +106,3 @@ jobs:
`
});
destroy:
if: github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- name: Setup Helm
uses: azure/setup-helm@v3
with:
version: v3.15.0

- name: Setup Kubectl
uses: azure/setup-kubectl@v3
with:
version: v1.30.1

- name: Authenticate to Kubernetes cluster
run: |
echo "${{ secrets.KUBECONFIG }}" > $HOME/.kube/config
- name: Delete Helm release
run: |
helm uninstall artemis --namespace artemis-pr${{ github.event.pull_request.number }}
- name: Delete Kubernetes namespace
run: |
kubectl delete namespace pr${{ github.event.pull_request.number }}
39 changes: 39 additions & 0 deletions .github/workflows/helm_pr_deployment_delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy PR to Kubernetes

on:
pull_request:
types: [opened, synchronize, reopened]
workflow_run:
workflows: ["tests"]
branches: [main]
types:
- completed

jobs:
destroy:
runs-on: ubuntu-latest
environment: k8s
concurrency: k8s

steps:
- name: Setup Helm
uses: azure/setup-helm@v3
with:
version: v3.15.0

- name: Setup Kubectl
uses: azure/setup-kubectl@v3
with:
version: v1.30.1

- name: Authenticate to Kubernetes cluster
run: |
echo "${{ secrets.KUBECONFIG }}" > $HOME/.kube/config
- name: Delete Helm release
run: |
helm uninstall artemis --namespace artemis-pr${{ github.event.pull_request.number }}
- name: Delete Kubernetes namespace
run: |
kubectl delete namespace pr${{ github.event.pull_request.number }}

0 comments on commit 2e99209

Please sign in to comment.