Files
holos/hack/deploy
Jeff McCune f1dc54650e builder: fill #UserData from userdata/**/*.json (#210)
Now that we have multi-platform images, we need a way to easily deploy
them.  This involves changing the image tag.  kustomize edit is often
used to bump image tags, but we can do better providing it directly in
the unified CUE configuration.

This patch modifies the builder to unify user data *.json files
recursively under userdata/ into the #UserData definition of the holos
entrypoint.

This is to support automation that writes simple json files to version
control, executes holos render platform, then commits and pushes the
results for git ops to take over deployment.

The make deploy target is the reason this change exists, to demonstrate
how to automatically deploy a new container image.
2024-07-21 21:22:22 -07:00

26 lines
624 B
Bash
Executable File

#! /bin/bash
#
tmpdir="$(mktemp -d)"
finish() {
rm -rf "$tmpdir"
}
trap finish EXIT
set -euo pipefail
: ${GIT_DETAIL:=$(git describe --tags HEAD)}
: ${GIT_SUFFIX:=$(test -n "`git status --porcelain`" && echo "-dirty" || echo "")}
cd "$tmpdir"
git clone --depth 1 git@github.com:holos-run/holos-infra.git
cd holos-infra/saas
echo '{"HolosVersion":"'${GIT_DETAIL}${GIT_SUFFIX}'"}' > userdata/holos.json
holos render platform ./platform
git add .
git commit -m "${GIT_DETAIL}${GIT_SUFFIX} [auto]"
git --no-pager show --stat
git push origin HEAD
echo
echo "https://argocd.admin.aws2.holos.run/applications/prod-holos-app"