diff --git a/.github/workflows/on_branch_del.yml b/.github/workflows/on_branch_del.yml new file mode 100644 index 0000000000000000000000000000000000000000..2e04886d1d7c4ebd964f793d5acfff076498e4a5 --- /dev/null +++ b/.github/workflows/on_branch_del.yml @@ -0,0 +1,44 @@ +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 diff --git a/src/util/regDereg.base.ts b/src/util/regDereg.base.ts index fa8eda97a57128a165cb1a6c5efe116130783ae5..8322eed9a4ded888dd1fc7fc96b016fceef4f386 100644 --- a/src/util/regDereg.base.ts +++ b/src/util/regDereg.base.ts @@ -7,9 +7,9 @@ type TRegDeregConfig = { * a pattern which is observed very frequently */ export class RegDereg<T, Y = void> { - constructor(){ - } + // eslint-disable-next-line @typescript-eslint/no-empty-function + constructor(){} public allowDuplicate = false protected callbacks: ((allArg: T) => Y)[] = [] register(fn: (allArg: T) => Y, config?: TRegDeregConfig) {