From 2cc62dff4c52cb0b1adea17d3074c4da640d8912 Mon Sep 17 00:00:00 2001 From: Rafael Solorzano <61289255+rafasdc@users.noreply.github.com> Date: Mon, 24 Jun 2024 09:21:16 -0700 Subject: [PATCH 1/4] fix: feature db name to match release name --- .github/workflows/deploy_feature.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy_feature.yaml b/.github/workflows/deploy_feature.yaml index adc9a5279..1c08109fc 100644 --- a/.github/workflows/deploy_feature.yaml +++ b/.github/workflows/deploy_feature.yaml @@ -62,6 +62,8 @@ jobs: openshift_token: ${{ secrets.OPENSHIFT_TOKEN }} - name: Setup database run: | + FEATURE_NAME_LOWER=$(echo $FEATURE_NAME | tr '[:upper:]' '[:lower:]') + FEATURE_NAME_LOWER_SHORT=$(echo $FEATURE_NAME_LOWER | cut -c -30) chmod +x ./lib/feature_envs/create_feature_db.sh ./lib/feature_envs/create_feature_db.sh ccbc ${{ env.FEATURE_NAME }} ${{ secrets.OPENSHIFT_APP_NAMESPACE }} deploy-feature-to-openshift-development: From 7558872b8b6eb0f1239707b17dc5b0c1285c3354 Mon Sep 17 00:00:00 2001 From: Rafael Solorzano <61289255+rafasdc@users.noreply.github.com> Date: Mon, 24 Jun 2024 09:52:43 -0700 Subject: [PATCH 2/4] chore: pass correct value to create feature db sh --- .github/workflows/deploy_feature.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy_feature.yaml b/.github/workflows/deploy_feature.yaml index 1c08109fc..dd3f6e06f 100644 --- a/.github/workflows/deploy_feature.yaml +++ b/.github/workflows/deploy_feature.yaml @@ -65,7 +65,7 @@ jobs: FEATURE_NAME_LOWER=$(echo $FEATURE_NAME | tr '[:upper:]' '[:lower:]') FEATURE_NAME_LOWER_SHORT=$(echo $FEATURE_NAME_LOWER | cut -c -30) chmod +x ./lib/feature_envs/create_feature_db.sh - ./lib/feature_envs/create_feature_db.sh ccbc ${{ env.FEATURE_NAME }} ${{ secrets.OPENSHIFT_APP_NAMESPACE }} + ./lib/feature_envs/create_feature_db.sh ccbc "$FEATURE_NAME_LOWER_SHORT" ${{ secrets.OPENSHIFT_APP_NAMESPACE }} deploy-feature-to-openshift-development: needs: [setup-feature-database] runs-on: ubuntu-latest From a321b951ee0da2bf89776eded8745f67a6d86fcc Mon Sep 17 00:00:00 2001 From: Rafael Solorzano <61289255+rafasdc@users.noreply.github.com> Date: Mon, 24 Jun 2024 09:56:18 -0700 Subject: [PATCH 3/4] chore: add missing sed command --- .github/workflows/deploy_feature.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy_feature.yaml b/.github/workflows/deploy_feature.yaml index dd3f6e06f..3e26d6519 100644 --- a/.github/workflows/deploy_feature.yaml +++ b/.github/workflows/deploy_feature.yaml @@ -62,8 +62,8 @@ jobs: openshift_token: ${{ secrets.OPENSHIFT_TOKEN }} - name: Setup database run: | - FEATURE_NAME_LOWER=$(echo $FEATURE_NAME | tr '[:upper:]' '[:lower:]') - FEATURE_NAME_LOWER_SHORT=$(echo $FEATURE_NAME_LOWER | cut -c -30) + FEATURE_NAME_LOWER=$(echo $FEATURE_NAME | tr '[:upper:]' '[:lower:]' | sed 's/-*$//') + FEATURE_NAME_LOWER_SHORT=$(echo $FEATURE_NAME_LOWER | cut -c -30 | sed 's/-*$//') chmod +x ./lib/feature_envs/create_feature_db.sh ./lib/feature_envs/create_feature_db.sh ccbc "$FEATURE_NAME_LOWER_SHORT" ${{ secrets.OPENSHIFT_APP_NAMESPACE }} deploy-feature-to-openshift-development: From a772e9b93e5832677d8b7abd5eea5f56380c4a7e Mon Sep 17 00:00:00 2001 From: Rafael Solorzano <61289255+rafasdc@users.noreply.github.com> Date: Mon, 24 Jun 2024 10:13:01 -0700 Subject: [PATCH 4/4] chore: set proper feature name for cleanup --- .github/workflows/clean-feature-env.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/clean-feature-env.yaml b/.github/workflows/clean-feature-env.yaml index b3b0ca0cb..7dba09146 100644 --- a/.github/workflows/clean-feature-env.yaml +++ b/.github/workflows/clean-feature-env.yaml @@ -32,12 +32,13 @@ jobs: ./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 "${{ env.FEATURE_NAME }}" | tr '[:upper:]' '[:lower:]') + 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\s"; then + if helm list -n "$NAMESPACE" | grep -q "^$FEATURE_NAME_LOWER_SHORT\s"; then # Release exists, uninstall it - helm uninstall "$FEATURE_NAME_LOWER" -n "$NAMESPACE" + helm uninstall "$FEATURE_NAME_LOWER_SHORT" -n "$NAMESPACE" else - echo "Helm release $FEATURE_NAME_LOWER not found, nothing to do" + echo "Helm release $FEATURE_NAME_LOWER_SHORT not found, nothing to do" fi