Commit 24690d0f authored by Jorge Moratinos's avatar Jorge Moratinos
Browse files

Setup template environment and creation of env file by using that template

parent b2be063b
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -275,7 +275,7 @@ deploy_ocf_staging:

        echo "Generate env file for helm scripts"

        cat <<EOF > helm/scripts/envs/$NAMESPACE_DEV_TO_STAGING-mr.env
        cat <<EOF > helm/scripts/envs/$NAMESPACE_DEV_TO_STAGING-mr.env.template
        # This file is generated by the GitLab CI pipeline for deploying CAPIF to the staging environment. 
        # It contains environment variables that are used in the deployment process. 
        # The values of these variables are set based on the current GitLab CI environment and the configuration 
@@ -292,7 +292,7 @@ deploy_ocf_staging:
        export CAPIF_IMAGE_TAG=$CI_COMMIT_REF_SLUG
        export VAULT_INTERNAL_HOSTNAME=$VAULT_HOSTNAME
        export VAULT_PORT=$VAULT_PORT
        export VAULT_ACCESS_TOKEN=$VAULT_ACCESS_TOKEN
        export VAULT_ACCESS_TOKEN=<REDACTED>

        export CAPIF_HOSTNAME=capif-$CI_ENV_ENDPOINT-mr.$DOMAIN_DEV
        export REGISTER_HOSTNAME=register-$CI_ENV_ENDPOINT-mr.$DOMAIN_DEV
@@ -336,7 +336,8 @@ deploy_ocf_staging:
        # Only Common configuration of env apply to both mongo express components. REGISTER_HOSTNAME

      EOF

        sed -e "s/^export VAULT_ACCESS_TOKEN=.*/export VAULT_ACCESS_TOKEN=$VAULT_ACCESS_TOKEN/" \
        helm/scripts/envs/$NAMESPACE_DEV_TO_STAGING-mr.env.template > helm/scripts/envs/$NAMESPACE_DEV_TO_STAGING-mr.env
        ./helm/scripts/install_capif.sh $NAMESPACE_DEV_TO_STAGING-mr
      fi

@@ -358,7 +359,7 @@ delete_ocf_staging:
          echo "### env file found for $NAMESPACE_DEV_TO_STAGING-mr, deleting with helm script ###"
        else
          echo "### No helm capif directory and no env file found for $NAMESPACE_DEV_TO_STAGING-mr, create file ###"
          cat <<EOF > helm/scripts/envs/$NAMESPACE_DEV_TO_STAGING-mr.env
          cat <<EOF > helm/scripts/envs/$NAMESPACE_DEV_TO_STAGING-mr.env.template
          # This file is generated by the GitLab CI pipeline for deploying CAPIF to the staging environment. 
          # It contains environment variables that are used in the deployment process. 
          # The values of these variables are set based on the current GitLab CI environment and the configuration 
@@ -375,7 +376,7 @@ delete_ocf_staging:
          export CAPIF_IMAGE_TAG=$CI_COMMIT_REF_SLUG
          export VAULT_INTERNAL_HOSTNAME=$VAULT_HOSTNAME
          export VAULT_PORT=$VAULT_PORT
          export VAULT_ACCESS_TOKEN=$VAULT_ACCESS_TOKEN
          export VAULT_ACCESS_TOKEN=<REDACTED>

          export CAPIF_HOSTNAME=capif-$CI_ENV_ENDPOINT-mr.$DOMAIN_DEV
          export REGISTER_HOSTNAME=register-$CI_ENV_ENDPOINT-mr.$DOMAIN_DEV
@@ -419,6 +420,9 @@ delete_ocf_staging:
          # Only Common configuration of env apply to both mongo express components. REGISTER_HOSTNAME

      EOF
          sed -e "s/^export VAULT_ACCESS_TOKEN=.*/export VAULT_ACCESS_TOKEN=$VAULT_ACCESS_TOKEN/" \
          helm/scripts/envs/$NAMESPACE_DEV_TO_STAGING-mr.env.template > helm/scripts/envs/$NAMESPACE_DEV_TO_STAGING-mr.env
        
        fi
        ./helm/scripts/uninstall_capif.sh $NAMESPACE_DEV_TO_STAGING-mr
      fi