refactor: enhance deploy_preview.sh for idempotent Helm repo addition… (#41043)
… and plugin management
### Changes Made
- Updated Helm repo addition to be idempotent, preventing errors if the
repo is already added.
- Added logic to check for the existence of the mapkubeapis plugin
before attempting installation, improving script robustness.
- Enhanced error handling for optional commands to ensure the deployment
process continues smoothly even if certain steps fail.
These improvements streamline the deployment process and enhance the
reliability of the script.
## Description
> [!TIP]
> _Add a TL;DR when the description is longer than 500 words or
extremely technical (helps the content, marketing, and DevRel team)._
>
> _Please also include relevant motivation and context. List any
dependencies that are required for this change. Add links to Notion,
Figma or any other documents that might be relevant to the PR._
Fixes #`Issue Number`
_or_
Fixes `Issue URL`
> [!WARNING]
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._
## Automation
/ok-to-test tags=""
### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results -->
> [!CAUTION]
> If you modify the content in this section, you are likely to disrupt
the CI result for your PR.
<!-- end of auto-generated comment: Cypress test results -->
## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No
This commit is contained in:
parent
3bac05feeb
commit
bde2554782
|
|
@ -66,12 +66,24 @@ kubectl create secret docker-registry "$SECRET" \
|
||||||
--docker-password="$DOCKER_HUB_ACCESS_TOKEN" \
|
--docker-password="$DOCKER_HUB_ACCESS_TOKEN" \
|
||||||
-n "$NAMESPACE" || true
|
-n "$NAMESPACE" || true
|
||||||
|
|
||||||
# Add Helm repo and deploy
|
# Add Helm repo (idempotent)
|
||||||
AWS_REGION=us-east-2 helm repo add appsmith-ee "$HELMCHART_URL"
|
AWS_REGION=us-east-2 helm repo add appsmith-ee "$HELMCHART_URL" || echo "Helm repo already added."
|
||||||
helm repo update
|
helm repo update
|
||||||
helm plugin install https://github.com/helm/helm-mapkubeapis -n "$NAMESPACE" || true
|
|
||||||
helm mapkubeapis "$CHARTNAME" -n "$NAMESPACE"
|
# Attempt to install the plugin only if it's not installed
|
||||||
helm show chart appsmith-ee/$HELMCHART
|
if ! helm plugin list | grep -q mapkubeapis; then
|
||||||
|
echo "Installing mapkubeapis plugin..."
|
||||||
|
helm plugin install https://github.com/helm/helm-mapkubeapis || echo "Plugin installation failed, continuing..."
|
||||||
|
else
|
||||||
|
echo "mapkubeapis plugin already installed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run mapkubeapis (safe to fail)
|
||||||
|
echo "Running helm mapkubeapis (optional)..."
|
||||||
|
helm mapkubeapis "$CHARTNAME" -n "$NAMESPACE" || echo "mapkubeapis failed, continuing..."
|
||||||
|
|
||||||
|
# Show chart metadata
|
||||||
|
helm show chart appsmith-ee/$HELMCHART || echo "helm show chart failed (non-blocking)."
|
||||||
|
|
||||||
echo "Deploying Appsmith Helm chart..."
|
echo "Deploying Appsmith Helm chart..."
|
||||||
helm upgrade -i "$CHARTNAME" "appsmith-ee/$HELMCHART" -n "$NAMESPACE" --create-namespace --recreate-pods \
|
helm upgrade -i "$CHARTNAME" "appsmith-ee/$HELMCHART" -n "$NAMESPACE" --create-namespace --recreate-pods \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user