vault/enos/modules/build_local/scripts/build.sh
Vault Automation 7b474da570
[VAULT-44431] enos: merge changes for enterprise zap scenario into ce/main
Backport community files that changed as part the enterprise only zap scenarios. This mostly includes fixes to scenario execution,  retries, and blackbox SDK tests that were broken.

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
2026-05-18 10:07:46 -06:00

42 lines
1.5 KiB
Bash
Executable file

#!/usr/bin/env bash
# Copyright IBM Corp. 2016, 2025
# SPDX-License-Identifier: BUSL-1.1
# This script builds Vault binaries and optionally packages them.
#
# Two distinct workflows are supported:
# 1. Standard build: Builds to dist/ and creates zip bundle from dist/
# 2. Target path build: Builds to dist/, copies to TARGET_BIN_PATH, skips bundling
# (bundling is skipped to avoid confusion when binary exists in multiple locations)
#
# Environment variables:
# - BUILD_UI: Set to "true" to build UI components
# - TARGET_BIN_PATH: If set, copies built binary to this location instead of bundling
# - BUNDLE_PATH: If set (and TARGET_BIN_PATH is not), creates zip bundle at this path
set -eux -o pipefail
export CGO_ENABLED=0
root_dir="$(git rev-parse --show-toplevel)"
pushd "$root_dir" > /dev/null
if [ -n "$BUILD_UI" ] && [ "$BUILD_UI" = "true" ]; then
if ! output=$(make ci-build-ui 2>&1); then
echo "Failed to build the UI assets. Make sure you have the required node version (defined in ui/package.json) install and have set up pnpm (npm i -g pnpm): ${output}" 1>&2
fi
fi
make ci-build
popd > /dev/null
if [ -n "$TARGET_BIN_PATH" ]; then
echo "--> Target binary path specified, copying binary and skipping bundle"
make -C "$root_dir" ci-copy-binary
elif [ -n "$BUNDLE_PATH" ]; then
echo "--> Creating zip bundle from dist/"
make -C "$root_dir" ci-bundle
else
echo "--> No post-build packaging requested (neither TARGET_BIN_PATH nor BUNDLE_PATH specified)"
fi