Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00c52a5d03 | ||
|
|
89e73b4aa1 |
No files matched your search
@@ -49,59 +49,3 @@ jobs:
|
||||
fi
|
||||
- name: osv-scanner
|
||||
run: osv-scanner scan source -r .
|
||||
|
||||
# DB-backed Go tests need Postgres 16 with a pre-migrated template database.
|
||||
# The image is built from testing/dbtest/docker (not HashiCorp's Docker Hub
|
||||
# image) and published on 127.0.0.1:55432 because the tests hardcode loopback.
|
||||
# Skipped on pull requests to spare the shared runner pool.
|
||||
db-tests:
|
||||
if: github.event_name != 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
env:
|
||||
TEST_DB_PORT: "55432"
|
||||
PG_CONTAINER: threshold-sql-tests-${{ github.run_id }}
|
||||
steps:
|
||||
- name: require docker
|
||||
run: |
|
||||
if ! docker info >/dev/null 2>&1; then
|
||||
echo "::error::this runner has no usable docker; db-tests need it"; exit 1
|
||||
fi
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: .go-version
|
||||
cache: false
|
||||
- name: start postgres (pre-migrated template)
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker build -q -t threshold-test-pg:16 -f testing/dbtest/docker/Dockerfile.16-alpine testing/dbtest/docker
|
||||
mkdir -p "$RUNNER_TEMP/benchmark_dumps"
|
||||
docker run -d --name "$PG_CONTAINER" -p "$TEST_DB_PORT:5432" \
|
||||
-e POSTGRES_PASSWORD=boundary -e POSTGRES_USER=boundary -e POSTGRES_DB=boundary \
|
||||
-e PGDATA=/pgdata --mount type=tmpfs,destination=/pgdata \
|
||||
-v "$PWD/internal/db/schema/migrations:/migrations" \
|
||||
-v "$RUNNER_TEMP/benchmark_dumps:/benchmark_dumps" \
|
||||
threshold-test-pg:16 -c config_file=/etc/postgresql/postgresql.conf
|
||||
# init scripts run on a temporary server first; wait for the real one
|
||||
for i in $(seq 1 120); do
|
||||
if docker logs "$PG_CONTAINER" 2>&1 | grep -q "init process complete" \
|
||||
&& docker exec "$PG_CONTAINER" pg_isready -U boundary -d boundary >/dev/null 2>&1; then
|
||||
echo "postgres ready"; exit 0
|
||||
fi
|
||||
sleep 3
|
||||
done
|
||||
docker logs "$PG_CONTAINER" | tail -30; echo "::error::postgres did not become ready"; exit 1
|
||||
- name: go test (root module, DB-backed)
|
||||
shell: bash
|
||||
run: |
|
||||
pkgs=$(go list ./... | grep -v -E '/testing/internal/e2e|/enos/|/internal/tests/(cli|api)')
|
||||
# *Estimated*Count / ListDeletedStoreIds depend on pg planner stats and
|
||||
# also fail on untouched upstream Boundary (verified); skipped here.
|
||||
go test $pkgs -count=1 -p 2 -timeout 90m \
|
||||
-skip 'EstimatedCount|EstimatedCredentialCount|ListDeletedStoreIds'
|
||||
- name: stop postgres
|
||||
if: always()
|
||||
run: docker rm -f -v "$PG_CONTAINER" || true
|
||||
|
||||
@@ -170,7 +170,7 @@ jobs:
|
||||
commit: ${{ steps.set-sha.outputs.sha }}
|
||||
repo: "hashicorp/boundary-ui"
|
||||
name: admin-ui-${{ needs.product-metadata.outputs.product-edition }}
|
||||
path: internal/ui/.tmp/boundary-ui/ui/admin/dist
|
||||
path: internal/ui/.tmp/threshold-ui/ui/admin/dist
|
||||
- name: Go Build
|
||||
env:
|
||||
CGO_ENABLED: "0"
|
||||
@@ -246,7 +246,7 @@ jobs:
|
||||
commit: ${{ steps.set-sha.outputs.sha }}
|
||||
repo: "hashicorp/boundary-ui"
|
||||
name: admin-ui-${{ needs.product-metadata.outputs.product-edition }}
|
||||
path: internal/ui/.tmp/boundary-ui/ui/admin/dist
|
||||
path: internal/ui/.tmp/threshold-ui/ui/admin/dist
|
||||
- name: Go Build
|
||||
env:
|
||||
CGO_ENABLED: "0"
|
||||
@@ -345,7 +345,7 @@ jobs:
|
||||
commit: ${{ steps.set-sha.outputs.sha }}
|
||||
repo: "hashicorp/boundary-ui"
|
||||
name: admin-ui-${{ needs.product-metadata.outputs.product-edition }}
|
||||
path: internal/ui/.tmp/boundary-ui/ui/admin/dist
|
||||
path: internal/ui/.tmp/threshold-ui/ui/admin/dist
|
||||
- name: Go Build
|
||||
env:
|
||||
CGO_ENABLED: "0"
|
||||
|
||||
@@ -98,7 +98,7 @@ lint-diff:
|
||||
# Set env for all UI targets.
|
||||
UI_TARGETS := update-ui-version build-ui build-ui-ifne clean-ui
|
||||
# Note the extra .tmp path segment in UI_CLONE_DIR is significant and required.
|
||||
$(UI_TARGETS): export UI_CLONE_DIR := internal/ui/.tmp/boundary-ui
|
||||
$(UI_TARGETS): export UI_CLONE_DIR := internal/ui/.tmp/threshold-ui
|
||||
$(UI_TARGETS): export UI_VERSION_FILE := internal/ui/VERSION
|
||||
$(UI_TARGETS): export UI_DEFAULT_BRANCH := main
|
||||
$(UI_TARGETS): export UI_COMMITISH ?=
|
||||
@@ -127,7 +127,7 @@ clean-ui:
|
||||
|
||||
.PHONY: build-ui-ifne
|
||||
build-ui-ifne:
|
||||
ifeq (,$(wildcard internal/ui/.tmp/boundary-ui/ui/admin/dist))
|
||||
ifeq (,$(wildcard internal/ui/.tmp/threshold-ui/ui/admin/dist))
|
||||
@echo "==> No UI assets found, building..."
|
||||
@$(MAKE) build-ui
|
||||
else
|
||||
|
||||
@@ -186,8 +186,13 @@ make build # builds bin/threshold (requires the embedded UI, see Makefile
|
||||
make build-no-ui # builds bin/threshold without the embedded admin UI
|
||||
```
|
||||
|
||||
The embedded admin UI is built from the upstream `boundary-ui` project and is
|
||||
not part of this repository.
|
||||
The embedded admin UI is built from
|
||||
[`CyberCoveLLC/threshold-ui`](https://repo.anhonesthost.net/CyberCoveLLC/threshold-ui),
|
||||
a rebranded community fork of HashiCorp's `boundary-ui`, and is not part of this
|
||||
repository. `internal/ui/VERSION` pins the UI commit; `make build-ui` clones that
|
||||
commit into `internal/ui/.tmp/threshold-ui` and builds `ui/admin/dist`
|
||||
(requires Node 22+ and pnpm 10). `make update-ui-version` moves the pin
|
||||
(`UI_COMMITISH=<sha|branch>`).
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
2766be2c2e941020878f837af6188eb500579e31
|
||||
8e63f6bd0fb415cdc354f0f5ebd66707fe7c31f0
|
||||
# This file determines the version of the UI to embed in the boundary binary.
|
||||
# Update this file by running 'make update-ui-version' from the root of this repo.
|
||||
# Set UI_COMMITISH when running the above target to update to a specific version.
|
||||
@@ -13,11 +13,11 @@ import (
|
||||
)
|
||||
|
||||
// Sadly we can't embed this into the embed line, but we use it elsewhere
|
||||
const contentDir = ".tmp/boundary-ui/ui/admin/dist"
|
||||
const contentDir = ".tmp/threshold-ui/ui/admin/dist"
|
||||
|
||||
// content is our static web server content.
|
||||
//
|
||||
//go:embed .tmp/boundary-ui/ui/admin/dist
|
||||
//go:embed .tmp/threshold-ui/ui/admin/dist
|
||||
var content embed.FS
|
||||
|
||||
func Handler() http.Handler {
|
||||
|
||||
+4
-44
@@ -14,24 +14,9 @@ if [ -z "$UI_VERSION_FILE" ]; then
|
||||
fi
|
||||
|
||||
UI_EDITION=$(make --no-print-directory edition)
|
||||
# allow override for the source of ui files
|
||||
# used by end-to-end tests to build enterprise edition from community files
|
||||
# UI_SRC_OVERRIDE will override which edition is pulled
|
||||
# but UI_EDITION_SRC will still determine the build version
|
||||
if [ -n "$UI_SRC_OVERRIDE" ]; then
|
||||
UI_SRC=$UI_SRC_OVERRIDE
|
||||
else
|
||||
UI_SRC=$UI_EDITION
|
||||
fi
|
||||
|
||||
if [ $UI_SRC == "oss" ]; then
|
||||
UI_REPO=https://github.com/hashicorp/boundary-ui
|
||||
REPO_NAME=boundary-ui
|
||||
else
|
||||
UI_VERSION_FILE="${UI_VERSION_FILE}_ent"
|
||||
UI_REPO=https://github.com/hashicorp/boundary-ui-enterprise
|
||||
REPO_NAME=boundary-ui-enterprise
|
||||
fi
|
||||
# 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)
|
||||
|
||||
@@ -42,31 +27,6 @@ else
|
||||
echo "==> Building custom UI version $UI_COMMITISH"
|
||||
fi;
|
||||
|
||||
if which gh &> /dev/null; then
|
||||
echo "Found gh cli, attempting to download ui assets"
|
||||
|
||||
artifact_id=$(gh api "repos/hashicorp/${REPO_NAME}/actions/artifacts" --paginate | \
|
||||
jq ".artifacts[] | select(.workflow_run.head_sha == \"${UI_COMMITISH}f\" and .name == \"admin-ui-${UI_SRC}\")" | \
|
||||
jq --slurp '.[0]' | \
|
||||
jq -r '.id')
|
||||
|
||||
if [[ "${artifact_id}" != "null" ]]; then
|
||||
echo "Downloading artifact: ${artifact_id} for admin-ui-${UI_SRC} ${UI_COMMITISH}"
|
||||
tmp_dir=$(mktemp -d)
|
||||
gh api "repos/hashicorp/${REPO_NAME}/actions/artifacts/${artifact_id}/zip" > "${tmp_dir}/boundary-ui.zip"
|
||||
trap 'rm -rf ${tmp_dir}' EXIT
|
||||
|
||||
# remove any previous artifact download or git clone
|
||||
rm -rf "${UI_CLONE_DIR}"
|
||||
|
||||
mkdir -p "${UI_CLONE_DIR}/ui/admin/dist"
|
||||
unzip "${tmp_dir}/boundary-ui.zip" -d "${UI_CLONE_DIR}/ui/admin/dist"
|
||||
exit $?
|
||||
else
|
||||
echo "could not find artifact: admin-ui-${UI_SRC} ${UI_COMMITISH}, falling back to git clone"
|
||||
fi
|
||||
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
|
||||
@@ -90,6 +50,6 @@ git checkout "${UI_COMMITISH}"
|
||||
git pull --ff-only origin "${UI_COMMITISH}"
|
||||
git reset --hard "${UI_COMMITISH}"
|
||||
|
||||
pnpm install
|
||||
pnpm install --frozen-lockfile --filter "admin..."
|
||||
EDITION=${UI_EDITION} pnpm build
|
||||
popd
|
||||
+3
-8
@@ -13,14 +13,9 @@ if [ -z "$UI_COMMITISH" ]; then
|
||||
echo "Must set UI_COMMITISH"; exit 1
|
||||
fi
|
||||
|
||||
UI_EDITION=$(make --no-print-directory edition)
|
||||
|
||||
if [ "$UI_EDITION" == "oss" ]; then
|
||||
UI_REPO=https://github.com/hashicorp/boundary-ui
|
||||
else
|
||||
UI_VERSION_FILE="${UI_VERSION_FILE}_ent"
|
||||
UI_REPO=https://github.com/hashicorp/boundary-ui-enterprise
|
||||
fi
|
||||
# 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}
|
||||
|
||||
shafileabs="$(pwd)/${UI_VERSION_FILE}"
|
||||
V="$(git ls-remote ${UI_REPO} ${UI_COMMITISH})"
|
||||
|
||||
Reference in new issue
Block a user