chore(e2e): Add source override to admin ui build script
* override build source for automation. Allowing enterprise builds from boundary-ui source
This commit is contained in:
1 parent
725093f8d8
commit
f7a52473b0
7 files changed
+48
-18
No files matched your search
@@ -39,9 +39,10 @@ scenario "e2e_ui_docker" {
|
||||
module = matrix.builder == "crt" ? module.build_boundary_docker_crt : module.build_boundary_docker_local
|
||||
|
||||
variables {
|
||||
path = matrix.builder == "crt" ? local.boundary_docker_image_file : ""
|
||||
cli_build_path = local.build_path[matrix.builder]
|
||||
edition = var.boundary_edition
|
||||
path = matrix.builder == "crt" ? local.boundary_docker_image_file : ""
|
||||
cli_build_path = local.build_path[matrix.builder]
|
||||
edition = var.boundary_edition
|
||||
ui_build_override = var.ui_build_override
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -272,6 +272,12 @@ variable "windows_instance_type" {
|
||||
default = "m7i-flex.xlarge"
|
||||
}
|
||||
|
||||
variable "ui_build_override" {
|
||||
description = "Override for build for UI automation"
|
||||
type = string
|
||||
default = null
|
||||
}
|
||||
|
||||
variable "github_token" {
|
||||
description = "github token needed to run automated tests (requires read access to hashicorp repos)"
|
||||
type = string
|
||||
|
||||
@@ -15,6 +15,7 @@ export DEV_DOCKER_GOARCH=$(uname -m)
|
||||
if [[ $DEV_DOCKER_GOARCH == "x86_64" ]]; then
|
||||
export DEV_DOCKER_GOARCH="amd64"
|
||||
fi
|
||||
export UI_SRC_OVERRIDE="${UI_BUILD_OVERRIDE}"
|
||||
export IMAGE_TAG_DEV="${IMAGE_NAME}"
|
||||
make build-ui docker-build-dev
|
||||
|
||||
|
||||
@@ -24,6 +24,11 @@ variable "edition" {
|
||||
default = "oss"
|
||||
}
|
||||
|
||||
variable "ui_build_override" {
|
||||
description = "Override for build for UI automation (oss or ent)"
|
||||
default = null
|
||||
}
|
||||
|
||||
resource "enos_local_exec" "get_git_sha" {
|
||||
inline = ["git rev-parse --short HEAD"]
|
||||
}
|
||||
@@ -34,9 +39,10 @@ locals {
|
||||
|
||||
resource "enos_local_exec" "build_docker_image" {
|
||||
environment = {
|
||||
"IMAGE_NAME" = local.image_name
|
||||
"ARTIFACT_PATH" = var.cli_build_path
|
||||
"EDITION" = var.edition
|
||||
"IMAGE_NAME" = local.image_name
|
||||
"ARTIFACT_PATH" = var.cli_build_path
|
||||
"EDITION" = var.edition
|
||||
"UI_BUILD_OVERRIDE" = var.ui_build_override
|
||||
}
|
||||
scripts = ["${path.module}/build.sh"]
|
||||
}
|
||||
|
||||
@@ -33,16 +33,22 @@ variable "goos" {
|
||||
default = "linux"
|
||||
}
|
||||
|
||||
variable "ui_build_override" {
|
||||
description = "Override for build for UI automation (oss or ent)"
|
||||
default = null
|
||||
}
|
||||
|
||||
resource "enos_local_exec" "build" {
|
||||
environment = {
|
||||
"GOOS" = var.goos,
|
||||
"GOARCH" = "amd64",
|
||||
"CGO_ENABLED" = 0,
|
||||
"ARTIFACT_PATH" = var.path
|
||||
"ARTIFACT_NAME" = var.artifact_name
|
||||
"BINARY_NAME" = var.binary_name
|
||||
"BUILD_TARGET" = var.build_target
|
||||
"EDITION" = var.edition
|
||||
"GOOS" = var.goos,
|
||||
"GOARCH" = "amd64",
|
||||
"CGO_ENABLED" = 0,
|
||||
"ARTIFACT_PATH" = var.path
|
||||
"ARTIFACT_NAME" = var.artifact_name
|
||||
"BINARY_NAME" = var.binary_name
|
||||
"BUILD_TARGET" = var.build_target
|
||||
"EDITION" = var.edition
|
||||
"UI_BUILD_OVERRIDE" = var.ui_build_override
|
||||
}
|
||||
scripts = ["${path.module}/templates/build.sh"]
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ npm install --global pnpm || true
|
||||
root_dir="$(git rev-parse --show-toplevel)"
|
||||
pushd "${root_dir}" > /dev/null
|
||||
|
||||
export UI_SRC_OVERRIDE="${UI_BUILD_OVERRIDE}"
|
||||
make ${BUILD_TARGET}
|
||||
zip -j ${ARTIFACT_PATH}/${ARTIFACT_NAME}.zip bin/${BINARY_NAME}
|
||||
|
||||
|
||||
+13
-4
@@ -14,8 +14,17 @@ 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_EDITION" == "oss" ]; then
|
||||
if [ $UI_SRC == "oss" ]; then
|
||||
UI_REPO=https://github.com/hashicorp/boundary-ui
|
||||
REPO_NAME=boundary-ui
|
||||
else
|
||||
@@ -37,12 +46,12 @@ 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_EDITION}\")" | \
|
||||
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_EDITION} ${UI_COMMITISH}"
|
||||
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
|
||||
@@ -54,7 +63,7 @@ if which gh &> /dev/null; then
|
||||
unzip "${tmp_dir}/boundary-ui.zip" -d "${UI_CLONE_DIR}/ui/admin/dist"
|
||||
exit $?
|
||||
else
|
||||
echo "could not find artifact: admin-ui-${UI_EDITION} ${UI_COMMITISH}, falling back to git clone"
|
||||
echo "could not find artifact: admin-ui-${UI_SRC} ${UI_COMMITISH}, falling back to git clone"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Reference in new issue
Block a user