Files
threshold/scripts/build-ui.sh
T
CyberCoveandClaude Sonnet 5.5 89e73b4aa1 Build the embedded admin UI from CyberCoveLLC/threshold-ui
- internal/ui/VERSION pins the threshold-ui commit
- scripts/uiupdate.sh and scripts/build-ui.sh clone
  https://repo.anhonesthost.net/CyberCoveLLC/threshold-ui.git; the
  GitHub artifact download path (hashicorp/boundary-ui) is removed
- clone/embed directory renamed .tmp/boundary-ui -> .tmp/threshold-ui
  (Makefile, assets.go, .github build.yml paths)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 12:44:26 -07:00

56 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright IBM Corp. 2020, 2026
# SPDX-License-Identifier: BUSL-1.1
set -e
if [ -z "$UI_CLONE_DIR" ]; then
echo "Must set UI_CLONE_DIR"; exit 1
fi
if [ -z "$UI_VERSION_FILE" ]; then
echo "Must set UI_VERSION_FILE"; exit 1
fi
UI_EDITION=$(make --no-print-directory edition)
# Threshold ships a single (community) edition of the admin UI, built from the
# CyberCoveLLC/threshold-ui fork of hashicorp/boundary-ui.
UI_REPO=${UI_REPO:-https://repo.anhonesthost.net/CyberCoveLLC/threshold-ui.git}
UI_CURRENT_COMMIT=$(head -n1 < "${UI_VERSION_FILE}" | cut -d' ' -f1)
if [ -z "$UI_COMMITISH" ]; then
echo "==> Building default UI version from $UI_VERSION_FILE: $UI_CURRENT_COMMIT"
export UI_COMMITISH="$UI_CURRENT_COMMIT"
else
echo "==> Building custom UI version $UI_COMMITISH"
fi;
if ! which pnpm &> /dev/null; then
echo "Pnpm must be installed to build ui assets from a git clone.\nPlease ensure Node v20+ and Pnpm v10+ are installed."
exit 1
fi
tempdir="$(dirname "${UI_CLONE_DIR}")"
mkdir -p "${tempdir}"
echo "*" > "${tempdir}/.gitignore"
if ! [ -d "${UI_CLONE_DIR}/.git" ]; then
# clear out dir, incase it was previously an artifact download
rm -rf "${UI_CLONE_DIR}"
git clone "${UI_REPO}" "${UI_CLONE_DIR}"
fi
pushd "${UI_CLONE_DIR}"
git reset --hard
git fetch origin "${UI_COMMITISH}"
git checkout "${UI_COMMITISH}"
git pull --ff-only origin "${UI_COMMITISH}"
git reset --hard "${UI_COMMITISH}"
pnpm install --frozen-lockfile --filter "admin..."
EDITION=${UI_EDITION} pnpm build
popd