Skip to content
Snippets Groups Projects
Commit 3ac0ef14 authored by Xiao Gui's avatar Xiao Gui
Browse files

chore: add on branch delete hook

parent 3690ffa4
No related branches found
No related tags found
No related merge requests found
name: '[undeploy from OKD]'
# only trigger on delete non master/staging branch
on:
delete:
branches:
- '!master'
- '!staging'
jobs:
remove-deploy:
runs-on: ubuntu-latest
steps:
- uses: action/checkout@v2
- name: 'Set env var'
run: |
echo "Using github.ref: $GITHUB_REF"
BRANCH_NAME=${GITHUB_REF#refs/heads/}
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
echo "OKD_URL=https://okd-dev.hbp.eu:443" >> $GITHUB_ENV
echo "OKD_SECRET=${{ secrets.OKD_DEV_SECRET }}" >> $GITHUB_ENV
echo "OKD_PROJECT=interactive-atlas-viewer" >> $GITHUB_ENV
echo "Remove deploy from dev cluster..."
- name: 'Login via oc cli'
run: |
oc login $OKD_URL --token=$OKD_SECRET
oc project $OKD_PROJECT
# sanitized branchname == remove _ / and lowercase everything
SANITIZED_BRANCH_NAME=$(echo ${BRANCH_NAME//[_\/]/} | awk '{ print tolower($0) }')
echo "SANITIZED_BRANCH_NAME=$SANITIZED_BRANCH_NAME" >> $GITHUB_ENV
echo "Working branch name: $BRANCH_NAME, sanitized branch name: $SANITIZED_BRANCH_NAME"
- name: 'List and delete all labelled resoures'
run: |
oc get all \
-l template=siibra-explorer-branch-deploy-template \
-l app=siibra-explorer-branch-deploy-$SANITIZED_BRANCH_NAME
oc delete all \
-l template=siibra-explorer-branch-deploy-template \
-l app=siibra-explorer-branch-deploy-$SANITIZED_BRANCH_NAME
\ No newline at end of file
......@@ -3,3 +3,7 @@
## Bugfixes
- Fix issues with not fetching datasets
## Under the hood stuff
- Added CI for removing deploy on branch deletion
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment