Validate, publish and deploy Gramps Web / validate (push) Successful in 25s
Validate, publish and deploy Gramps Web / ensure-postgresql-image (push) Successful in 2m13s
Validate, publish and deploy Gramps Web / publish (push) Successful in 23s
Validate, publish and deploy Gramps Web / deploy (push) Successful in 2m31s
42 lines
1.6 KiB
Bash
Executable File
42 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
export HELM_DRIVER=${HELM_DRIVER:-configmap}
|
|
|
|
registry=${CHART_REGISTRY:-oci://registry.brunner.ninja/feedc0de/charts}
|
|
version=${CHART_VERSION:?Set CHART_VERSION to the published chart version}
|
|
namespace=${NAMESPACE:-gramps}
|
|
release=${RELEASE:-gramps}
|
|
project_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
helm_args=(
|
|
upgrade --install "${release}" "${registry}/gramps-web"
|
|
--version "${version}"
|
|
--namespace "${namespace}"
|
|
--values "${project_dir}/values-arschrock.yaml"
|
|
--take-ownership --force-conflicts --wait --timeout 20m
|
|
)
|
|
|
|
# Remove the old raw-manifest containers left in the existing Deployments.
|
|
# The Helm chart now owns the correctly named application and worker containers;
|
|
# retaining both copies makes them contend for the same ports and resources.
|
|
for deployment in grampsweb grampsweb-celery; do
|
|
legacy_container=${deployment}
|
|
if kubectl --namespace "${namespace}" get "deployment/${deployment}" -o json \
|
|
| jq --exit-status --arg name "${legacy_container}" \
|
|
'.spec.template.spec.containers | any(.name == $name)' >/dev/null; then
|
|
kubectl --namespace "${namespace}" patch "deployment/${deployment}" \
|
|
--type=strategic \
|
|
--patch "{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"${legacy_container}\",\"\$patch\":\"delete\"}]}}}}"
|
|
fi
|
|
done
|
|
|
|
# Never auto-uninstall resources during the initial ownership transfer. Once
|
|
# the parent release exists, normal upgrades may safely roll back to it.
|
|
if helm status "${release}" --namespace "${namespace}" 2>/dev/null \
|
|
| grep -q '^STATUS: deployed$'; then
|
|
helm_args+=(--rollback-on-failure)
|
|
fi
|
|
helm "${helm_args[@]}"
|