From 23f1cdea27674b8aa767dabf346e6c39ad2cba64 Mon Sep 17 00:00:00 2001 From: Ryan Cragun Date: Mon, 19 Dec 2022 12:35:10 -0700 Subject: [PATCH] enos: make the local build target configurable (#2313) This makes the `make` build target that is used for local builder variant configurable. This will allow us to utilize the local builder variant in downstreams that might use different targets for their build. * Make the local build target configurable * Allow cross compiling `linux/amd64` on different platforms. --- enos/enos-modules.hcl | 2 ++ enos/enos-variables.hcl | 6 ++++++ enos/modules/build_local/main.tf | 5 +++++ enos/modules/build_local/templates/build.sh | 3 +-- scripts/build.sh | 2 +- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/enos/enos-modules.hcl b/enos/enos-modules.hcl index 247404eaea..c8e48ecc0a 100644 --- a/enos/enos-modules.hcl +++ b/enos/enos-modules.hcl @@ -33,6 +33,8 @@ module "build_crt" { module "build_local" { source = "./modules/build_local" + + build_target = var.local_build_target } module "generate_aws_host_tag_vars" { diff --git a/enos/enos-variables.hcl b/enos/enos-variables.hcl index 81ad5a1bf9..da6caf4bb5 100644 --- a/enos/enos-variables.hcl +++ b/enos/enos-variables.hcl @@ -121,3 +121,9 @@ variable "test_email" { type = string default = null } + +variable "local_build_target" { + description = "Which make build target(s) to use for the local builder variant" + type = string + default = "build-ui build" +} diff --git a/enos/modules/build_local/main.tf b/enos/modules/build_local/main.tf index f53056fb8f..3178b10d70 100644 --- a/enos/modules/build_local/main.tf +++ b/enos/modules/build_local/main.tf @@ -10,12 +10,17 @@ variable "path" { default = "/tmp" } +variable "build_target" { + default = "build-ui build" +} + resource "enos_local_exec" "build" { environment = { "GOOS" = "linux", "GOARCH" = "amd64", "CGO_ENABLED" = 0, "ARTIFACT_PATH" = var.path + "BUILD_TARGET" = var.build_target } scripts = ["${path.module}/templates/build.sh"] } diff --git a/enos/modules/build_local/templates/build.sh b/enos/modules/build_local/templates/build.sh index 0a719fc732..783d017d27 100755 --- a/enos/modules/build_local/templates/build.sh +++ b/enos/modules/build_local/templates/build.sh @@ -10,8 +10,7 @@ npm install --global yarn || true root_dir="$(git rev-parse --show-toplevel)" pushd "${root_dir}" > /dev/null -make build-ui -make build +make ${BUILD_TARGET} zip -j ${ARTIFACT_PATH}/boundary.zip bin/boundary popd > /dev/null diff --git a/scripts/build.sh b/scripts/build.sh index d4625eda96..c0ad62d581 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -88,4 +88,4 @@ fi # Done! echo "==> Results:" -ls -hl ${BIN_PARENT_DIR} \ No newline at end of file +ls -hl ${BIN_PARENT_DIR}