Skip to content

feat: notification to analysts when upcoming milestone is due #424

feat: notification to analysts when upcoming milestone is due

feat: notification to analysts when upcoming milestone is due #424

name: clean-feature-env
on:
pull_request:
branches: [main]
types: [closed, converted_to_draft]
workflow_call:
secrets:
OPENSHIFT_TOKEN: { required: true }
OPENSHIFT_APP_NAMESPACE: { required: true }
OPENSHIFT_SERVER: { required: true }
env:
FEATURE_NAME: ${{ github.head_ref }}
jobs:
clean-feature-env:
runs-on: ubuntu-latest
environment:
name: development
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Authenticate with OpenShift
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
- name: Clean feature environment db
run: |
chmod +x ./lib/feature_envs/delete_feature_db.sh
./lib/feature_envs/delete_feature_db.sh ccbc ${{ env.FEATURE_NAME }} ${{ secrets.OPENSHIFT_APP_NAMESPACE }}
- name: Uninstall feature Helm release
run: |
FEATURE_NAME_LOWER=$(echo $FEATURE_NAME | tr '[:upper:]' '[:lower:]' | sed 's/-*$//')
FEATURE_NAME_LOWER_SHORT=$(echo $FEATURE_NAME_LOWER | cut -c -30 | sed 's/-*$//')
NAMESPACE="${{ secrets.OPENSHIFT_APP_NAMESPACE }}"
# Check if the release exists
if helm list -n "$NAMESPACE" | grep -q "^$FEATURE_NAME_LOWER_SHORT\s"; then
# Release exists, uninstall it
helm uninstall "$FEATURE_NAME_LOWER_SHORT" -n "$NAMESPACE"
else
echo "Helm release $FEATURE_NAME_LOWER_SHORT not found, nothing to do"
fi