Skip to content

Commit

Permalink
BC-6013 - update workflows for dev cluster by tenant
Browse files Browse the repository at this point in the history
  • Loading branch information
mamutmk5 authored Dec 11, 2023
1 parent b0c17f5 commit a8e3ff9
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 21 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@ jobs:
branch: ${{ needs.branch_name.outputs.branch }}
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_BRB }}
DEV_KUBE_CONFIG_DBC: ${{ secrets.DEV_KUBE_CONFIG_DBC }}
BINGO_REPO_TOKEN: ${{ secrets.BINGO_REPO_TOKEN }}
58 changes: 50 additions & 8 deletions .github/workflows/clean_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ on:
secrets:
token:
required: true
DEV_KUBE_CONFIG:
DEV_KUBE_CONFIG_BRB:
required: true
DEV_KUBE_CONFIG_NBC:
required: true
DEV_KUBE_CONFIG_THR:
required: true
DEV_KUBE_CONFIG_DBC:
required: true
BINGO_REPO_TOKEN:
required: true
Expand Down Expand Up @@ -111,7 +117,7 @@ jobs:
secrets:
bingo_token: ${{ secrets.BINGO_REPO_TOKEN }}

delete_namespaces:
delete_namespaces_brb:
runs-on: ubuntu-latest
if: needs.examine_branch_existence.outputs.are_all_branches_deleted == 'true'
needs:
Expand All @@ -120,20 +126,56 @@ jobs:
steps:
- run: |
mkdir files
echo "${{ secrets.DEV_KUBE_CONFIG }}" > files/config
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 nbc-$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 ScaledObject
kubectl --kubeconfig=files/config --namespace brb-$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 TriggerAuthentication
kubectl --kubeconfig=files/config --namespace default-$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
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
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 brb-$branch_identifier nbc-$branch_identifier default-$branch_identifier
kubectl --kubeconfig=files/config delete --ignore-not-found=true ns default-$branch_identifier
- name: remove kubeconfig
run: |
rm -rf /config
Expand Down
28 changes: 20 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,21 @@ on:
secrets:
token:
required: true
DEV_VAULT:
DEV_VAULT_BRB:
required: true
DEV_KUBE_CONFIG:
DEV_VAULT_THR:
required: true
DEV_VAULT_NBC:
required: true
DEV_VAULT_DBC:
required: true
DEV_KUBE_CONFIG_BRB:
required: true
DEV_KUBE_CONFIG_NBC:
required: true
DEV_KUBE_CONFIG_THR:
required: true
DEV_KUBE_CONFIG_DBC:
required: true
BINGO_REPO_TOKEN:
required: true
Expand Down Expand Up @@ -128,8 +140,8 @@ jobs:
host_name: default_host
tenannt: dbc
secrets:
ONEPASSWORD_VAULT: ${{ secrets.DEV_VAULT }}
KUBECONFIG: ${{ secrets.DEV_KUBE_CONFIG }}
ONEPASSWORD_VAULT: ${{ secrets.DEV_VAULT_DBC }}
KUBECONFIG: ${{ secrets.DEV_KUBE_CONFIG_DBC }}

deploy_nbc_dev:
needs:
Expand All @@ -140,8 +152,8 @@ jobs:
host_name: nbc_host
tenannt: nbc
secrets:
ONEPASSWORD_VAULT: ${{ secrets.DEV_VAULT }}
KUBECONFIG: ${{ secrets.DEV_KUBE_CONFIG }}
ONEPASSWORD_VAULT: ${{ secrets.DEV_VAULT_NBC }}
KUBECONFIG: ${{ secrets.DEV_KUBE_CONFIG_NBC }}

deploy_brb_dev:
needs:
Expand All @@ -152,5 +164,5 @@ jobs:
host_name: brb_host
tenannt: brb
secrets:
ONEPASSWORD_VAULT: ${{ secrets.DEV_VAULT }}
KUBECONFIG: ${{ secrets.DEV_KUBE_CONFIG }}
ONEPASSWORD_VAULT: ${{ secrets.DEV_VAULT_BRB }}
KUBECONFIG: ${{ secrets.DEV_KUBE_CONFIG_BRB }}
10 changes: 8 additions & 2 deletions .github/workflows/dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ jobs:
branch: ${{ needs.branch_name.outputs.branch }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
DEV_VAULT: ${{ secrets.DEV_VAULT }}
DEV_KUBE_CONFIG: ${{ secrets.DEV_KUBE_CONFIG }}
DEV_VAULT_BRB: ${{ secrets.DEV_VAULT_BRB }}
DEV_VAULT_NBC: ${{ secrets.DEV_VAULT_NBC }}
DEV_VAULT_THR: ${{ secrets.DEV_VAULT_THR }}
DEV_VAULT_DBC: ${{ secrets.DEV_VAULT_DBC }}
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_BRB }}
DEV_KUBE_CONFIG_DBC: ${{ secrets.DEV_KUBE_CONFIG_DBC }}

10 changes: 8 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ jobs:
branch: ${{ needs.branch_name.outputs.branch }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
DEV_VAULT: ${{ secrets.DEV_VAULT }}
DEV_KUBE_CONFIG: ${{ secrets.DEV_KUBE_CONFIG }}
DEV_VAULT_BRB: ${{ secrets.DEV_VAULT_BRB }}
DEV_VAULT_NBC: ${{ secrets.DEV_VAULT_NBC }}
DEV_VAULT_THR: ${{ secrets.DEV_VAULT_THR }}
DEV_VAULT_DBC: ${{ secrets.DEV_VAULT_DBC }}
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_BRB }}
DEV_KUBE_CONFIG_DBC: ${{ secrets.DEV_KUBE_CONFIG_DBC }}
BINGO_REPO_TOKEN: ${{ secrets.BINGO_REPO_TOKEN }}

deploy-successful:
Expand Down

0 comments on commit a8e3ff9

Please sign in to comment.