#!/bin/sh set -eu namespace="$1" test -n "$DRONE_COMMIT_SHA" test -n "$ATLAS_KUBECONFIG_B64" umask 077 atlas_kubeconfig=$(mktemp) trap 'rm -f "$atlas_kubeconfig"' EXIT printf '%s' "$ATLAS_KUBECONFIG_B64" | base64 -d > "$atlas_kubeconfig" unset ATLAS_KUBECONFIG_B64 export KUBECONFIG="$atlas_kubeconfig" set -- helm upgrade --install item-atlas deploy/helm/item-atlas --namespace "$namespace" \ --atomic --wait --timeout 12m --history-max 10 \ --set-string "image.tag=$DRONE_COMMIT_SHA" \ --set 'imagePullSecrets[0].name=item-atlas-registry' if [ -n "${ATLAS_MEDIA_SECRET:-}" ]; then set -- "$@" --set-string "mediaSecret=$ATLAS_MEDIA_SECRET" fi if [ -n "${ATLAS_OTLP_TRACES_ENDPOINT:-}" ]; then set -- "$@" --set-string "observability.otlpTracesEndpoint=$ATLAS_OTLP_TRACES_ENDPOINT" fi "$@"