Skip to content

Commit

Permalink
BC-6013 - move namespace remove to owne file
Browse files Browse the repository at this point in the history
  • Loading branch information
mamutmk5 authored Dec 11, 2023
1 parent 9ba7c70 commit df1c9cd
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 43 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/clean_branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ jobs:
branch: ${{ github.event.ref }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
DEV_KUBE_CONFIG: ${{ secrets.DEV_KUBE_CONFIG }}
DEV_KUBE_CONFIG_BRB: ${{ secrets.DEV_KUBE_CONFIG_BRB }}
DEV_KUBE_CONFIG_NBC: ${{ secrets.DEV_KUBE_CONFIG_NBC }}
DEV_KUBE_CONFIG_THR: ${{ secrets.DEV_KUBE_CONFIG_THR }}
DEV_KUBE_CONFIG_DBC: ${{ secrets.DEV_KUBE_CONFIG_DBC }}
BINGO_REPO_TOKEN: ${{ secrets.BINGO_REPO_TOKEN }}
57 changes: 15 additions & 42 deletions .github/workflows/clean_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,61 +123,34 @@ jobs:
needs:
- examine_branch_existence
- create_branch_identifier
steps:
- run: |
mkdir files
echo "${{ secrets.DEV_KUBE_CONFIG_BRB }}" > files/config
- name: delete custom resources and namespaces
run: |
branch_identifier='${{ needs.create_branch_identifier.outputs.id_branch }}'
kubectl --kubeconfig=files/config --namespace brb-$branch_identifier delete --ignore-not-found=true --all=true ScaledObject
kubectl --kubeconfig=files/config --namespace brb-$branch_identifier delete --ignore-not-found=true --all=true TriggerAuthentication
kubectl --kubeconfig=files/config --namespace brb-$branch_identifier delete --ignore-not-found=true --all=true OnePasswordItem
kubectl --kubeconfig=files/config delete --ignore-not-found=true ns brb-$branch_identifier
- name: remove kubeconfig
run: |
rm -rf /config
uses: hpi-schul-cloud/dof_app_deploy/.github/workflows/namespace.yml@BC-6013-split
with:
name: brb-${{ needs.create_branch_identifier.outputs.id_branch }}
secrets:
KUBECONFIG: ${{ secrets.DEV_KUBE_CONFIG_BRB }}

delete_namespaces_nbc:
runs-on: ubuntu-latest
if: needs.examine_branch_existence.outputs.are_all_branches_deleted == 'true'
needs:
- examine_branch_existence
- create_branch_identifier
steps:
- run: |
mkdir files
echo "${{ secrets.DEV_KUBE_CONFIG_NBC }}" > files/config
- name: delete custom resources and namespaces
run: |
branch_identifier='${{ needs.create_branch_identifier.outputs.id_branch }}'
kubectl --kubeconfig=files/config --namespace nbc-$branch_identifier delete --ignore-not-found=true --all=true ScaledObject
kubectl --kubeconfig=files/config --namespace nbc-$branch_identifier delete --ignore-not-found=true --all=true TriggerAuthentication
kubectl --kubeconfig=files/config --namespace nbc-$branch_identifier delete --ignore-not-found=true --all=true OnePasswordItem
kubectl --kubeconfig=files/config delete --ignore-not-found=true ns nbc-$branch_identifier
- name: remove kubeconfig
run: |
rm -rf /config
uses: hpi-schul-cloud/dof_app_deploy/.github/workflows/namespace.yml@BC-6013-split
with:
name: nbc-${{ needs.create_branch_identifier.outputs.id_branch }}
secrets:
KUBECONFIG: ${{ secrets.DEV_KUBE_CONFIG_NBC }}

delete_namespaces_dbc:
runs-on: ubuntu-latest
if: needs.examine_branch_existence.outputs.are_all_branches_deleted == 'true'
needs:
- examine_branch_existence
- create_branch_identifier
steps:
- run: |
mkdir files
echo "${{ secrets.DEV_KUBE_CONFIG_DBC }}" > files/config
- name: delete custom resources and namespaces
run: |
branch_identifier='${{ needs.create_branch_identifier.outputs.id_branch }}'
kubectl --kubeconfig=files/config --namespace default-$branch_identifier delete --ignore-not-found=true --all=true ScaledObject
kubectl --kubeconfig=files/config --namespace default-$branch_identifier delete --ignore-not-found=true --all=true TriggerAuthentication
kubectl --kubeconfig=files/config --namespace default-$branch_identifier delete --ignore-not-found=true --all=true OnePasswordItem
kubectl --kubeconfig=files/config delete --ignore-not-found=true ns default-$branch_identifier
- name: remove kubeconfig
run: |
rm -rf /config
uses: hpi-schul-cloud/dof_app_deploy/.github/workflows/namespace.yml@BC-6013-split
with:
name: default-${{ needs.create_branch_identifier.outputs.id_branch }}
secrets:
KUBECONFIG: ${{ secrets.DEV_KUBE_CONFIG_DBC }}


36 changes: 36 additions & 0 deletions .github/workflows/clean_workflow_dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: deploy dev

on:
workflow_call:
inputs:
namespace:
required: true
type: string
secrets:
KUBECONFIG:
required: true

permissions:
contents: read

jobs:
delete_namespaces_dbc:
runs-on: ubuntu-latest
if: needs.examine_branch_existence.outputs.are_all_branches_deleted == 'true'
needs:
- examine_branch_existence
- create_branch_identifier
steps:
- run: |
mkdir files
echo "${{ secrets.KUBECONFIG }}" > files/config
- name: delete custom resources and namespaces
run: |
kubectl --kubeconfig=files/config --namespace ${{ inputs.namespace }} delete --ignore-not-found=true --all=true ScaledObject
kubectl --kubeconfig=files/config --namespace ${{ inputs.namespace }} delete --ignore-not-found=true --all=true TriggerAuthentication
kubectl --kubeconfig=files/config --namespace ${{ inputs.namespace }} delete --ignore-not-found=true --all=true OnePasswordItem
kubectl --kubeconfig=files/config delete --ignore-not-found=true ns ${{ inputs.namespace }}
- name: remove kubeconfig
run: |
rm -rf /config

0 comments on commit df1c9cd

Please sign in to comment.