ai cooking
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

deploy script (#240)

authored by

Paul Miller and committed by
GitHub
8f3666f3 4be2a201

+39 -2
+37
deploy/deploy.sh
··· 1 + #!/usr/bin/env bash 2 + set -euo pipefail 3 + 4 + ref="${1:-origin/master}" 5 + deploy_file="deploy/deploy.yaml" 6 + namespace="${2:-careme}" 7 + short_len=7 8 + 9 + if ! command -v envsubst >/dev/null 2>&1; then 10 + echo "error: envsubst is required but not found in PATH" >&2 11 + exit 1 12 + fi 13 + 14 + if ! command -v kubectl >/dev/null 2>&1; then 15 + echo "error: kubectl is required but not found in PATH" >&2 16 + exit 1 17 + fi 18 + 19 + if ! commit_hash="$(git rev-parse --verify "${ref}^{commit}" 2>/dev/null)"; then 20 + echo "error: could not resolve ref '${ref}' to a commit" >&2 21 + exit 1 22 + fi 23 + 24 + export IMAGE_TAG="${commit_hash:0:${short_len}}" 25 + 26 + if [[ ! -f "${deploy_file}" ]]; then 27 + echo "error: deploy file not found: ${deploy_file}" >&2 28 + exit 1 29 + fi 30 + 31 + if [[ "$(<"${deploy_file}")" != *'${IMAGE_TAG}'* ]]; then 32 + echo "error: ${deploy_file} does not contain \${IMAGE_TAG}" >&2 33 + exit 1 34 + fi 35 + 36 + echo "Deploying image: ${IMAGE_TAG}" 37 + envsubst '${IMAGE_TAG}' <"${deploy_file}" | kubectl apply -f - -n "${namespace}"
+2 -2
deploy/deploy.yaml
··· 21 21 runAsGroup: 65532 22 22 containers: 23 23 - name: careme 24 - image: ghcr.io/paulgmiller/careme:aabeb63 24 + image: ghcr.io/paulgmiller/careme:${IMAGE_TAG} 25 25 imagePullPolicy: IfNotPresent 26 26 ports: 27 27 - containerPort: 8080 ··· 85 85 runAsGroup: 65532 86 86 containers: 87 87 - name: careme-mail 88 - image: ghcr.io/paulgmiller/careme:aabeb63 88 + image: ghcr.io/paulgmiller/careme:${IMAGE_TAG} 89 89 imagePullPolicy: IfNotPresent 90 90 args: ["-mail"] 91 91 envFrom: