diff --git a/.github/workflows/enos-run.yml b/.github/workflows/enos-run.yml index fa0e7cc2d6..491572a051 100644 --- a/.github/workflows/enos-run.yml +++ b/.github/workflows/enos-run.yml @@ -87,16 +87,14 @@ jobs: ENOS_VAR_aws_ssh_keypair_name: ${{ github.event.repository.name }}-ci-ssh-key ENOS_VAR_aws_ssh_private_key_path: ./support/private_key.pem ENOS_VAR_local_boundary_dir: ./support/boundary - ENOS_VAR_local_boundary_src_dir: ${{ github.workspace }} - ENOS_VAR_local_boundary_ui_src_dir: ./support/src/boundary-ui ENOS_VAR_crt_bundle_path: ./support/boundary.zip ENOS_VAR_test_email: ${{ secrets.SERVICE_USER_EMAIL }} - ENOS_VAR_boundary_edition: ${{ inputs.edition }} ENOS_VAR_boundary_docker_image_file: ./support/boundary_docker_image.tar ENOS_VAR_gcp_project_id: ${{ secrets.GCP_PROJECT_ID_CI }} ENOS_VAR_gcp_client_email: ${{ secrets.GCP_CLIENT_EMAIL_CI }} ENOS_VAR_gcp_private_key_id: ${{ secrets.GCP_PRIVATE_KEY_ID_CI }} ENOS_VAR_gcp_private_key: ${{ secrets.GCP_PRIVATE_KEY_CI }} + ENOS_VAR_is_ci: true steps: - name: Checkout uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 @@ -261,12 +259,6 @@ jobs: # redis sudo apt update && sudo apt install -y redis-tools mysql-client - - name: Output Terraform version info - run: | - mkdir -p ./enos/terraform-plugin-cache - export ENOS_VAR_enos_user=$GITHUB_ACTOR && \ - enos scenario check --chdir ./enos ${{ matrix.filter }} && \ - enos scenario exec --chdir ./enos ${{ matrix.filter }} --cmd "version" - name: Determine boundary version to test against previous worker version # Resolve the worker version from the previous release line. if: contains(matrix.filter, 'e2e_docker_base_with_worker_version') @@ -299,6 +291,12 @@ jobs: fi echo "ENOS_VAR_worker_version=$previous_version" >> "$GITHUB_ENV" + - name: Output Terraform version info + run: | + mkdir -p ./enos/terraform-plugin-cache + export ENOS_VAR_enos_user=$GITHUB_ACTOR && \ + enos scenario check --chdir ./enos ${{ matrix.filter }} && \ + enos scenario exec --chdir ./enos ${{ matrix.filter }} --cmd "version" - name: Run Enos scenario id: run # Continue once and retry diff --git a/enos/README.md b/enos/README.md index ded22ff7da..d12dd19447 100644 --- a/enos/README.md +++ b/enos/README.md @@ -17,29 +17,23 @@ for further information regarding installation, execution, or composing Enos sce * Doormat ```shell brew tap hashicorp/tap -brew install hashicorp/tap/vault brew install hashicorp/tap/terraform -brew install hashicorp/tap/enos -brew install coreutils +brew install hashicorp/tap/vault +brew install enos coreutils jq + +# (Optional) +export ENOS_VAR_boundary_license=${license_key} -# Install doormat cli +# Install doormat cli for AWS access brew tap hashicorp/security git@github.com:hashicorp/homebrew-security.git brew install hashicorp/security/doormat-cli + + +# + ``` * AWS access. HashiCorp Boundary developers should use Doormat. -* An SSH keypair in the AWS region you wish to run the scenario. You can use - doormat to login to the AWS console to create or upload an existing keypair. -```shell -# Create a SSH Key Pair -ssh-keygen -t ed25519 -C "your_email@example.com" - -# -# Go to the console for the corresponding AWS account -# Select the desired AWS region on the top-right -# Go to EC2 -> Key Pairs -> Actions -> Import Key Pair -> Import public key file (.pub) -# Note the name of the key pair -``` * Boundary CLI installed locally ### Enos Variables @@ -57,15 +51,6 @@ See [enos.vars.hcl](./enos.vars.hcl) for complete descriptions of each variable. You can either modify `enos.vars.hcl` directly or create your own copy at `enos-local.vars.hcl` which gets ignored by git. -### System File Modifications - -For docker-based scenarios, you will need to modify `/etc/hosts` to include the -following lines -``` -127.0.0.1 localhost boundary -127.0.0.1 localhost worker -127.0.0.1 localhost vault -``` ### AWS Credentials Copy the AWS Account credentials from doormat and set it in the terminal, where the enos commands are run. @@ -210,4 +195,4 @@ This can be done under `Firefox Settings > Privacy & Security > View Certificate ```shell > sudo cp mycert.crt /usr/local/share/ca-certificates/ > sudo update-ca-certificates -``` \ No newline at end of file +``` diff --git a/enos/ci/hcp-resources/variables.tf b/enos/ci/hcp-resources/variables.tf index f32f9f2647..060eb6646f 100644 --- a/enos/ci/hcp-resources/variables.tf +++ b/enos/ci/hcp-resources/variables.tf @@ -25,11 +25,13 @@ variable "boundary_license_path" { variable "aws_ssh_keypair_name" { description = "Name of the AWS EC2 keypair to use for SSH access" type = string + default = null } variable "aws_ssh_private_key_path" { description = "Path to the private key file for the AWS EC2 keypair" type = string + default = null } variable "worker_count" { diff --git a/enos/enos-modules.hcl b/enos/enos-modules.hcl index 98d301a382..1825267ab2 100644 --- a/enos/enos-modules.hcl +++ b/enos/enos-modules.hcl @@ -71,6 +71,10 @@ module "generate_aws_host_tag_vars" { source = "./modules/generate_aws_host_tag_vars" } +module "generate_docker_image_name" { + source = "./modules/generate_docker_image_name" +} + module "aws_iam_setup" { source = "./modules/aws_iam_setup" } @@ -221,3 +225,15 @@ module "gcp_target" { environment = var.environment enos_user = var.enos_user } + +module "get_repo_root" { + source = "./modules/get_repo_root" +} + +module "get_binary_path" { + source = "./modules/get_binary_path" +} + +module "get_boundary_edition" { + source = "./modules/get_boundary_edition" +} diff --git a/enos/enos-scenario-e2e-aws-base-with-vault.hcl b/enos/enos-scenario-e2e-aws-base-with-vault.hcl index 6b1a53e0df..768c5b3fd9 100644 --- a/enos/enos-scenario-e2e-aws-base-with-vault.hcl +++ b/enos/enos-scenario-e2e-aws-base-with-vault.hcl @@ -28,6 +28,19 @@ scenario "e2e_aws_base_with_vault" { }, var.tags) } + step "get_boundary_binary" { + skip_step = local.local_boundary_dir != null ? true : false + module = module.get_binary_path + + variables { + name = "boundary" + } + } + + step "get_boundary_edition" { + module = module.get_boundary_edition + } + step "find_azs" { module = module.aws_az_finder @@ -42,12 +55,12 @@ scenario "e2e_aws_base_with_vault" { } step "read_license" { - skip_step = var.boundary_edition == "oss" - module = module.read_license + module = module.read_license variables { license_path = local.license_path license = var.boundary_license + edition = step.get_boundary_edition.edition } } @@ -60,7 +73,7 @@ scenario "e2e_aws_base_with_vault" { variables { path = local.build_path[matrix.builder] - edition = var.boundary_edition + edition = step.get_boundary_edition.edition } } @@ -96,7 +109,7 @@ scenario "e2e_aws_base_with_vault" { variables { boundary_binary_name = var.boundary_binary_name boundary_install_dir = local.boundary_install_dir - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : null + boundary_license = step.read_license.license common_tags = local.tags controller_instance_type = var.controller_instance_type controller_count = var.controller_count @@ -164,13 +177,13 @@ scenario "e2e_aws_base_with_vault" { ] variables { + is_ci = var.is_ci test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/base_with_vault" - debug_no_run = var.e2e_debug_no_run alb_boundary_api_addr = step.create_boundary_cluster.alb_boundary_api_addr auth_method_id = step.create_boundary_cluster.auth_method_id auth_login_name = step.create_boundary_cluster.auth_login_name auth_password = step.create_boundary_cluster.auth_password - local_boundary_dir = local.local_boundary_dir + local_boundary_dir = local.local_boundary_dir != null ? local.local_boundary_dir : step.get_boundary_binary.path aws_ssh_private_key_path = step.generate_ssh_key.private_key_path target_address = step.create_target.target_private_ips[0] target_user = "ubuntu" diff --git a/enos/enos-scenario-e2e-aws-base.hcl b/enos/enos-scenario-e2e-aws-base.hcl index 662b33df1a..c3c69533d9 100644 --- a/enos/enos-scenario-e2e-aws-base.hcl +++ b/enos/enos-scenario-e2e-aws-base.hcl @@ -28,6 +28,19 @@ scenario "e2e_aws_base" { }, var.tags) } + step "get_boundary_binary" { + skip_step = local.local_boundary_dir != null ? true : false + module = module.get_binary_path + + variables { + name = "boundary" + } + } + + step "get_boundary_edition" { + module = module.get_boundary_edition + } + step "find_azs" { module = module.aws_az_finder @@ -41,12 +54,12 @@ scenario "e2e_aws_base" { } step "read_license" { - skip_step = var.boundary_edition == "oss" - module = module.read_license + module = module.read_license variables { license_path = local.license_path license = var.boundary_license + edition = step.get_boundary_edition.edition } } @@ -59,7 +72,7 @@ scenario "e2e_aws_base" { variables { path = local.build_path[matrix.builder] - edition = var.boundary_edition + edition = step.get_boundary_edition.edition } } @@ -96,7 +109,7 @@ scenario "e2e_aws_base" { variables { boundary_binary_name = var.boundary_binary_name boundary_install_dir = local.boundary_install_dir - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : null + boundary_license = step.read_license.license common_tags = local.tags controller_instance_type = var.controller_instance_type controller_count = var.controller_count @@ -142,13 +155,13 @@ scenario "e2e_aws_base" { ] variables { + is_ci = var.is_ci test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/base" - debug_no_run = var.e2e_debug_no_run alb_boundary_api_addr = step.create_boundary_cluster.alb_boundary_api_addr auth_method_id = step.create_boundary_cluster.auth_method_id auth_login_name = step.create_boundary_cluster.auth_login_name auth_password = step.create_boundary_cluster.auth_password - local_boundary_dir = local.local_boundary_dir + local_boundary_dir = local.local_boundary_dir != null ? local.local_boundary_dir : step.get_boundary_binary.path aws_ssh_private_key_path = step.generate_ssh_key.private_key_path target_address = step.create_target.target_private_ips[0] target_user = "ubuntu" diff --git a/enos/enos-scenario-e2e-aws-rdp-base.hcl b/enos/enos-scenario-e2e-aws-rdp-base.hcl index 73043c7665..91197434d8 100644 --- a/enos/enos-scenario-e2e-aws-rdp-base.hcl +++ b/enos/enos-scenario-e2e-aws-rdp-base.hcl @@ -26,7 +26,6 @@ scenario "e2e_aws_rdp_base" { aws_ssh_private_key_path = var.aws_ssh_private_key_path != null ? abspath(var.aws_ssh_private_key_path) : null boundary_install_dir = abspath(var.boundary_install_dir) local_boundary_dir = var.local_boundary_dir != null ? abspath(var.local_boundary_dir) : null - local_boundary_src_dir = var.local_boundary_src_dir != null ? abspath(var.local_boundary_src_dir) : null boundary_license_path = abspath(var.boundary_license_path != null ? var.boundary_license_path : joinpath(path.root, "./support/boundary.hclic")) ip_version = "4" @@ -49,6 +48,23 @@ scenario "e2e_aws_rdp_base" { collocated_tag = "collocated" } + step "get_repo_root" { + module = module.get_repo_root + } + + step "get_boundary_binary" { + skip_step = local.local_boundary_dir != null ? true : false + module = module.get_binary_path + + variables { + name = "boundary" + } + } + + step "get_boundary_edition" { + module = module.get_boundary_edition + } + step "find_azs" { module = module.aws_az_finder @@ -87,7 +103,7 @@ scenario "e2e_aws_rdp_base" { variables { path = local.build_path_linux[matrix.builder] - edition = var.boundary_edition + edition = step.get_boundary_edition.edition } } @@ -100,7 +116,7 @@ scenario "e2e_aws_rdp_base" { variables { path = local.build_path_windows[matrix.builder] - edition = var.boundary_edition + edition = step.get_boundary_edition.edition goos = "windows" build_target = "build" artifact_name = "boundary_windows" @@ -120,7 +136,7 @@ scenario "e2e_aws_rdp_base" { vpc_id = step.create_base_infra.vpc_id client_version = matrix.client boundary_cli_zip_path = step.build_boundary_windows.artifact_path - boundary_src_path = local.local_boundary_src_dir + boundary_src_path = step.get_repo_root.path github_token = var.github_token ip_version = local.ip_version vault_version = var.vault_version @@ -132,6 +148,8 @@ scenario "e2e_aws_rdp_base" { variables { license_path = local.boundary_license_path + license = var.boundary_license + edition = step.get_boundary_edition.edition } } @@ -193,7 +211,7 @@ scenario "e2e_aws_rdp_base" { variables { boundary_binary_name = var.boundary_binary_name boundary_install_dir = local.boundary_install_dir - boundary_license = var.boundary_edition != "oss" ? step.read_boundary_license.license : null + boundary_license = step.read_boundary_license.license common_tags = local.tags controller_instance_type = var.controller_instance_type controller_count = var.controller_count @@ -310,12 +328,11 @@ scenario "e2e_aws_rdp_base" { variables { test_package = "" - debug_no_run = true alb_boundary_api_addr = step.create_boundary_cluster.alb_boundary_api_addr auth_method_id = step.create_boundary_cluster.auth_method_id auth_login_name = step.create_boundary_cluster.auth_login_name auth_password = step.create_boundary_cluster.auth_password - local_boundary_dir = local.local_boundary_dir + local_boundary_dir = local.local_boundary_dir != null ? local.local_boundary_dir : step.get_boundary_binary.path aws_ssh_private_key_path = step.generate_ssh_key.private_key_path target_user = "ubuntu" target_port = "22" diff --git a/enos/enos-scenario-e2e-aws.hcl b/enos/enos-scenario-e2e-aws.hcl index 84911fd294..5331f4a297 100644 --- a/enos/enos-scenario-e2e-aws.hcl +++ b/enos/enos-scenario-e2e-aws.hcl @@ -33,6 +33,19 @@ scenario "e2e_aws" { }, var.tags) } + step "get_boundary_binary" { + skip_step = local.local_boundary_dir != null ? true : false + module = module.get_binary_path + + variables { + name = "boundary" + } + } + + step "get_boundary_edition" { + module = module.get_boundary_edition + } + step "find_azs" { module = module.aws_az_finder @@ -46,12 +59,12 @@ scenario "e2e_aws" { } step "read_boundary_license" { - skip_step = var.boundary_edition == "oss" - module = module.read_license + module = module.read_license variables { license_path = local.boundary_license_path license = var.boundary_license + edition = step.get_boundary_edition.edition } } @@ -64,7 +77,7 @@ scenario "e2e_aws" { variables { path = local.build_path[matrix.builder] - edition = var.boundary_edition + edition = step.get_boundary_edition.edition } } @@ -128,7 +141,7 @@ scenario "e2e_aws" { variables { boundary_binary_name = var.boundary_binary_name boundary_install_dir = local.boundary_install_dir - boundary_license = var.boundary_edition != "oss" ? step.read_boundary_license.license : null + boundary_license = step.read_boundary_license.license common_tags = local.tags controller_instance_type = var.controller_instance_type controller_count = var.controller_count @@ -284,13 +297,13 @@ scenario "e2e_aws" { ] variables { + is_ci = var.is_ci test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/aws" - debug_no_run = var.e2e_debug_no_run alb_boundary_api_addr = step.create_boundary_cluster.alb_boundary_api_addr auth_method_id = step.create_boundary_cluster.auth_method_id auth_login_name = step.create_boundary_cluster.auth_login_name auth_password = step.create_boundary_cluster.auth_password - local_boundary_dir = local.local_boundary_dir + local_boundary_dir = local.local_boundary_dir != null ? local.local_boundary_dir : step.get_boundary_binary.path target_user = "ubuntu" target_port = "22" aws_ssh_private_key_path = step.generate_ssh_key.private_key_path diff --git a/enos/enos-scenario-e2e-database.hcl b/enos/enos-scenario-e2e-database.hcl index abaf4e5808..32ffa77a73 100644 --- a/enos/enos-scenario-e2e-database.hcl +++ b/enos/enos-scenario-e2e-database.hcl @@ -20,13 +20,26 @@ scenario "e2e_database" { }, var.tags) } + step "get_boundary_binary" { + skip_step = local.local_boundary_dir != null ? true : false + module = module.get_binary_path + + variables { + name = "boundary" + } + } + + step "get_boundary_edition" { + module = module.get_boundary_edition + } + step "read_license" { - skip_step = var.boundary_edition == "oss" - module = module.read_license + module = module.read_license variables { license_path = local.license_path license = var.boundary_license + edition = step.get_boundary_edition.edition } } @@ -127,10 +140,10 @@ scenario "e2e_database" { ] variables { + is_ci = var.is_ci test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/database" - debug_no_run = var.e2e_debug_no_run - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : "" - local_boundary_dir = local.local_boundary_dir + boundary_license = step.read_license.license + local_boundary_dir = local.local_boundary_dir != null ? local.local_boundary_dir : step.get_boundary_binary.path target_user = "ubuntu" aws_ssh_private_key_path = step.generate_ssh_key.private_key_path aws_access_key_id = step.iam_setup.access_key_id diff --git a/enos/enos-scenario-e2e-docker-base-connect.hcl b/enos/enos-scenario-e2e-docker-base-connect.hcl index bb57eafba2..b1e74fd10b 100644 --- a/enos/enos-scenario-e2e-docker-base-connect.hcl +++ b/enos/enos-scenario-e2e-docker-base-connect.hcl @@ -12,7 +12,6 @@ scenario "e2e_docker_base_connect" { locals { aws_ssh_private_key_path = var.aws_ssh_private_key_path != null ? abspath(var.aws_ssh_private_key_path) : null local_boundary_dir = var.local_boundary_dir != null ? abspath(var.local_boundary_dir) : null - local_boundary_src_dir = var.local_boundary_src_dir != null ? abspath(var.local_boundary_src_dir) : null boundary_docker_image_file = abspath(var.boundary_docker_image_file) license_path = abspath(var.boundary_license_path != null ? var.boundary_license_path : joinpath(path.root, "./support/boundary.hclic")) @@ -29,13 +28,26 @@ scenario "e2e_docker_base_connect" { }, var.tags) } + step "get_boundary_binary" { + skip_step = local.local_boundary_dir != null ? true : false + module = module.get_binary_path + + variables { + name = "boundary" + } + } + + step "get_boundary_edition" { + module = module.get_boundary_edition + } + step "build_boundary_docker_image" { 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 + edition = step.get_boundary_edition.edition } } @@ -66,12 +78,12 @@ scenario "e2e_docker_base_connect" { } step "read_license" { - skip_step = var.boundary_edition == "oss" - module = module.read_license + module = module.read_license variables { license_path = local.license_path license = var.boundary_license + edition = step.get_boundary_edition.edition } } @@ -87,7 +99,7 @@ scenario "e2e_docker_base_connect" { network_name = [local.network_cluster] database_network = local.network_cluster postgres_address = step.create_boundary_database.address - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : "" + boundary_license = step.read_license.license } } @@ -110,15 +122,14 @@ scenario "e2e_docker_base_connect" { step.create_host, ] variables { + is_ci = var.is_ci test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/base_connect" network_name = step.create_docker_network.network_name - debug_no_run = var.e2e_debug_no_run alb_boundary_api_addr = step.create_boundary.address auth_method_id = step.create_boundary.auth_method_id auth_login_name = step.create_boundary.login_name auth_password = step.create_boundary.password - local_boundary_dir = local.local_boundary_dir - local_boundary_src_dir = local.local_boundary_src_dir + local_boundary_dir = local.local_boundary_dir != null ? local.local_boundary_dir : step.get_boundary_binary.path aws_ssh_private_key_path = step.generate_ssh_key.private_key_path target_address = step.create_host.address target_port = step.create_host.port diff --git a/enos/enos-scenario-e2e-docker-base-plus.hcl b/enos/enos-scenario-e2e-docker-base-plus.hcl index 71452ebc0c..85f25bc239 100644 --- a/enos/enos-scenario-e2e-docker-base-plus.hcl +++ b/enos/enos-scenario-e2e-docker-base-plus.hcl @@ -13,7 +13,6 @@ scenario "e2e_docker_base_plus" { locals { aws_ssh_private_key_path = var.aws_ssh_private_key_path != null ? abspath(var.aws_ssh_private_key_path) : null local_boundary_dir = var.local_boundary_dir != null ? abspath(var.local_boundary_dir) : null - local_boundary_src_dir = var.local_boundary_src_dir != null ? abspath(var.local_boundary_src_dir) : null boundary_docker_image_file = abspath(var.boundary_docker_image_file) license_path = abspath(var.boundary_license_path != null ? var.boundary_license_path : joinpath(path.root, "./support/boundary.hclic")) @@ -30,13 +29,26 @@ scenario "e2e_docker_base_plus" { }, var.tags) } + step "get_boundary_binary" { + skip_step = local.local_boundary_dir != null ? true : false + module = module.get_binary_path + + variables { + name = "boundary" + } + } + + step "get_boundary_edition" { + module = module.get_boundary_edition + } + step "build_boundary_docker_image" { 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 + edition = step.get_boundary_edition.edition } } @@ -67,12 +79,12 @@ scenario "e2e_docker_base_plus" { } step "read_license" { - skip_step = var.boundary_edition == "oss" - module = module.read_license + module = module.read_license variables { license_path = local.license_path license = var.boundary_license + edition = step.get_boundary_edition.edition } } @@ -88,7 +100,7 @@ scenario "e2e_docker_base_plus" { network_name = [local.network_cluster] database_network = local.network_cluster postgres_address = step.create_boundary_database.address - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : "" + boundary_license = step.read_license.license config_file = "boundary-config-rate-limit.hcl" } @@ -126,13 +138,11 @@ scenario "e2e_docker_base_plus" { test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/base_plus" controller_container_name = step.create_boundary.container_name network_name = step.create_docker_network.network_name - debug_no_run = var.e2e_debug_no_run alb_boundary_api_addr = step.create_boundary.address auth_method_id = step.create_boundary.auth_method_id auth_login_name = step.create_boundary.login_name auth_password = step.create_boundary.password - local_boundary_dir = local.local_boundary_dir - local_boundary_src_dir = local.local_boundary_src_dir + local_boundary_dir = local.local_boundary_dir != null ? local.local_boundary_dir : step.get_boundary_binary.path aws_ssh_private_key_path = step.generate_ssh_key.private_key_path target_address = step.create_host.address target_port = step.create_host.port diff --git a/enos/enos-scenario-e2e-docker-base-with-gcp.hcl b/enos/enos-scenario-e2e-docker-base-with-gcp.hcl index ec37b7f20e..3a1942c5fc 100644 --- a/enos/enos-scenario-e2e-docker-base-with-gcp.hcl +++ b/enos/enos-scenario-e2e-docker-base-with-gcp.hcl @@ -14,7 +14,6 @@ scenario "e2e_docker_base_with_gcp" { locals { local_boundary_dir = var.local_boundary_dir != null ? abspath(var.local_boundary_dir) : null - local_boundary_src_dir = var.local_boundary_src_dir != null ? abspath(var.local_boundary_src_dir) : null boundary_docker_image_file = abspath(var.boundary_docker_image_file) license_path = abspath(var.boundary_license_path != null ? var.boundary_license_path : joinpath(path.root, "./support/boundary.hclic")) gcp_private_key = var.gcp_private_key_path != null ? file(var.gcp_private_key_path) : var.gcp_private_key @@ -32,13 +31,26 @@ scenario "e2e_docker_base_with_gcp" { }, var.tags) } + step "get_boundary_binary" { + skip_step = local.local_boundary_dir != null ? true : false + module = module.get_binary_path + + variables { + name = "boundary" + } + } + + step "get_boundary_edition" { + module = module.get_boundary_edition + } + step "build_boundary_docker_image" { 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 + edition = step.get_boundary_edition.edition } } @@ -61,12 +73,12 @@ scenario "e2e_docker_base_with_gcp" { } step "read_license" { - skip_step = var.boundary_edition == "oss" - module = module.read_license + module = module.read_license variables { license_path = local.license_path license = var.boundary_license + edition = step.get_boundary_edition.edition } } @@ -82,7 +94,7 @@ scenario "e2e_docker_base_with_gcp" { network_name = [local.network_cluster] database_network = local.network_cluster postgres_address = step.create_boundary_database.address - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : "" + boundary_license = step.read_license.license } } @@ -111,28 +123,27 @@ scenario "e2e_docker_base_with_gcp" { step.create_gcp_target ] variables { - test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/gcp" - network_name = step.create_docker_network.network_name - debug_no_run = var.e2e_debug_no_run - alb_boundary_api_addr = step.create_boundary.address - auth_method_id = step.create_boundary.auth_method_id - auth_login_name = step.create_boundary.login_name - auth_password = step.create_boundary.password - local_boundary_dir = local.local_boundary_dir - local_boundary_src_dir = local.local_boundary_src_dir - gcp_host_set_filter1 = step.create_gcp_target.filter_label1 - gcp_host_set_filter2 = step.create_gcp_target.filter_label2 - gcp_private_key_id = var.gcp_private_key_id - gcp_private_key = local.gcp_private_key - gcp_zone = var.gcp_zone - gcp_project_id = var.gcp_project_id - gcp_client_email = var.gcp_client_email - gcp_target_ssh_key = step.create_gcp_target.target_ssh_key - gcp_host_set_ips = step.create_gcp_target.target_ips - target_address = step.create_gcp_target.target_public_ips[0] - target_port = "22" - target_user = "ubuntu" - max_page_size = step.create_boundary.max_page_size + is_ci = var.is_ci + test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/gcp" + network_name = step.create_docker_network.network_name + alb_boundary_api_addr = step.create_boundary.address + auth_method_id = step.create_boundary.auth_method_id + auth_login_name = step.create_boundary.login_name + auth_password = step.create_boundary.password + local_boundary_dir = local.local_boundary_dir != null ? local.local_boundary_dir : step.get_boundary_binary.path + gcp_host_set_filter1 = step.create_gcp_target.filter_label1 + gcp_host_set_filter2 = step.create_gcp_target.filter_label2 + gcp_private_key_id = var.gcp_private_key_id + gcp_private_key = local.gcp_private_key + gcp_zone = var.gcp_zone + gcp_project_id = var.gcp_project_id + gcp_client_email = var.gcp_client_email + gcp_target_ssh_key = step.create_gcp_target.target_ssh_key + gcp_host_set_ips = step.create_gcp_target.target_ips + target_address = step.create_gcp_target.target_public_ips[0] + target_port = "22" + target_user = "ubuntu" + max_page_size = step.create_boundary.max_page_size } } } diff --git a/enos/enos-scenario-e2e-docker-base-with-vault.hcl b/enos/enos-scenario-e2e-docker-base-with-vault.hcl index a4b8e1a621..0e8afcf68d 100644 --- a/enos/enos-scenario-e2e-docker-base-with-vault.hcl +++ b/enos/enos-scenario-e2e-docker-base-with-vault.hcl @@ -12,7 +12,6 @@ scenario "e2e_docker_base_with_vault" { locals { aws_ssh_private_key_path = var.aws_ssh_private_key_path != null ? abspath(var.aws_ssh_private_key_path) : null local_boundary_dir = var.local_boundary_dir != null ? abspath(var.local_boundary_dir) : null - local_boundary_src_dir = var.local_boundary_src_dir != null ? abspath(var.local_boundary_src_dir) : null boundary_docker_image_file = abspath(var.boundary_docker_image_file) license_path = abspath(var.boundary_license_path != null ? var.boundary_license_path : joinpath(path.root, "./support/boundary.hclic")) @@ -29,13 +28,26 @@ scenario "e2e_docker_base_with_vault" { }, var.tags) } + step "get_boundary_binary" { + skip_step = local.local_boundary_dir != null ? true : false + module = module.get_binary_path + + variables { + name = "boundary" + } + } + + step "get_boundary_edition" { + module = module.get_boundary_edition + } + step "build_boundary_docker_image" { 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 + edition = step.get_boundary_edition.edition } } @@ -66,12 +78,12 @@ scenario "e2e_docker_base_with_vault" { } step "read_license" { - skip_step = var.boundary_edition == "oss" - module = module.read_license + module = module.read_license variables { license_path = local.license_path license = var.boundary_license + edition = step.get_boundary_edition.edition } } @@ -87,7 +99,7 @@ scenario "e2e_docker_base_with_vault" { network_name = [local.network_cluster] database_network = local.network_cluster postgres_address = step.create_boundary_database.address - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : "" + boundary_license = step.read_license.license } } @@ -133,15 +145,14 @@ scenario "e2e_docker_base_with_vault" { step.create_host, ] variables { + is_ci = var.is_ci test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/base_with_vault" network_name = step.create_docker_network.network_name - debug_no_run = var.e2e_debug_no_run alb_boundary_api_addr = step.create_boundary.address auth_method_id = step.create_boundary.auth_method_id auth_login_name = step.create_boundary.login_name auth_password = step.create_boundary.password - local_boundary_dir = local.local_boundary_dir - local_boundary_src_dir = local.local_boundary_src_dir + local_boundary_dir = local.local_boundary_dir != null ? local.local_boundary_dir : step.get_boundary_binary.path aws_ssh_private_key_path = step.generate_ssh_key.private_key_path target_address = step.create_host.address target_port = step.create_host.port diff --git a/enos/enos-scenario-e2e-docker-base-with-worker-version.hcl b/enos/enos-scenario-e2e-docker-base-with-worker-version.hcl index 1c34bf0368..02268f42ad 100644 --- a/enos/enos-scenario-e2e-docker-base-with-worker-version.hcl +++ b/enos/enos-scenario-e2e-docker-base-with-worker-version.hcl @@ -12,11 +12,8 @@ scenario "e2e_docker_base_with_worker_version" { locals { aws_ssh_private_key_path = var.aws_ssh_private_key_path != null ? abspath(var.aws_ssh_private_key_path) : null local_boundary_dir = var.local_boundary_dir != null ? abspath(var.local_boundary_dir) : null - local_boundary_src_dir = var.local_boundary_src_dir != null ? abspath(var.local_boundary_src_dir) : null boundary_docker_image_file = abspath(var.boundary_docker_image_file) license_path = abspath(var.boundary_license_path != null ? var.boundary_license_path : joinpath(path.root, "./support/boundary.hclic")) - image_base_name = var.boundary_edition == "oss" ? "hashicorp/boundary" : "hashicorp/boundary-enterprise" - worker_version_tag = var.worker_version != null ? var.worker_version : "latest" network_cluster = "e2e_cluster" network_host = "e2e_host" @@ -33,13 +30,26 @@ scenario "e2e_docker_base_with_worker_version" { }, var.tags) } + step "get_boundary_binary" { + skip_step = local.local_boundary_dir != null ? true : false + module = module.get_binary_path + + variables { + name = "boundary" + } + } + + step "get_boundary_edition" { + module = module.get_boundary_edition + } + step "build_boundary_docker_image" { 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 + edition = step.get_boundary_edition.edition } } @@ -84,12 +94,12 @@ scenario "e2e_docker_base_with_worker_version" { } step "read_license" { - skip_step = var.boundary_edition == "oss" - module = module.read_license + module = module.read_license variables { license_path = local.license_path license = var.boundary_license + edition = step.get_boundary_edition.edition } } @@ -106,7 +116,7 @@ scenario "e2e_docker_base_with_worker_version" { network_name = [local.network_cluster, local.network_database] database_network = local.network_database postgres_address = step.create_boundary_database.address - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : "" + boundary_license = step.read_license.license } } @@ -135,10 +145,17 @@ scenario "e2e_docker_base_with_worker_version" { locals { egress_tag = "egress" - worker_tag = local.worker_version_tag != "latest" && var.boundary_edition != "oss" ? "${local.worker_version_tag}-ent" : local.worker_version_tag } + step "generate_docker_image_name" { + module = module.generate_docker_image_name + variables { + repository = "hashicorp/boundary" + image_tag = var.worker_version + edition = step.get_boundary_edition.edition + } + } step "create_worker" { module = module.docker_worker @@ -149,8 +166,8 @@ scenario "e2e_docker_base_with_worker_version" { step.create_boundary ] variables { - image_name = "${local.image_base_name}:${local.worker_tag}" - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : "" + image_name = step.generate_docker_image_name.image_name + boundary_license = step.read_license.license config_file = "worker-config.hcl" container_name = "worker" initial_upstream = step.create_boundary.upstream_address @@ -169,15 +186,14 @@ scenario "e2e_docker_base_with_worker_version" { step.create_worker, ] variables { + is_ci = var.is_ci test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/base_with_worker" network_name = step.create_docker_network_cluster.network_name - debug_no_run = var.e2e_debug_no_run alb_boundary_api_addr = step.create_boundary.address auth_method_id = step.create_boundary.auth_method_id auth_login_name = step.create_boundary.login_name auth_password = step.create_boundary.password - local_boundary_dir = local.local_boundary_dir - local_boundary_src_dir = local.local_boundary_src_dir + local_boundary_dir = local.local_boundary_dir != null ? local.local_boundary_dir : step.get_boundary_binary.path aws_ssh_private_key_path = step.generate_ssh_key.private_key_path target_address = step.create_host.address target_port = step.create_host.port diff --git a/enos/enos-scenario-e2e-docker-base-with-worker.hcl b/enos/enos-scenario-e2e-docker-base-with-worker.hcl index 64a4d75d07..c360fe9022 100644 --- a/enos/enos-scenario-e2e-docker-base-with-worker.hcl +++ b/enos/enos-scenario-e2e-docker-base-with-worker.hcl @@ -12,7 +12,6 @@ scenario "e2e_docker_base_with_worker" { locals { aws_ssh_private_key_path = var.aws_ssh_private_key_path != null ? abspath(var.aws_ssh_private_key_path) : null local_boundary_dir = var.local_boundary_dir != null ? abspath(var.local_boundary_dir) : null - local_boundary_src_dir = var.local_boundary_src_dir != null ? abspath(var.local_boundary_src_dir) : null boundary_docker_image_file = abspath(var.boundary_docker_image_file) license_path = abspath(var.boundary_license_path != null ? var.boundary_license_path : joinpath(path.root, "./support/boundary.hclic")) @@ -31,13 +30,27 @@ scenario "e2e_docker_base_with_worker" { }, var.tags) } + step "get_boundary_binary" { + skip_step = local.local_boundary_dir != null ? true : false + module = module.get_binary_path + + variables { + name = "boundary" + } + } + + step "get_boundary_edition" { + module = module.get_boundary_edition + } + + step "build_boundary_docker_image" { 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 + edition = step.get_boundary_edition.edition } } @@ -82,12 +95,12 @@ scenario "e2e_docker_base_with_worker" { } step "read_license" { - skip_step = var.boundary_edition == "oss" - module = module.read_license + module = module.read_license variables { license_path = local.license_path license = var.boundary_license + edition = step.get_boundary_edition.edition } } @@ -104,7 +117,7 @@ scenario "e2e_docker_base_with_worker" { network_name = [local.network_cluster, local.network_database] database_network = local.network_database postgres_address = step.create_boundary_database.address - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : "" + boundary_license = step.read_license.license } } @@ -145,7 +158,7 @@ scenario "e2e_docker_base_with_worker" { ] variables { image_name = step.build_boundary_docker_image.image_name - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : "" + boundary_license = step.read_license.license config_file = "worker-config.hcl" container_name = "worker" initial_upstream = step.create_boundary.upstream_address @@ -164,15 +177,14 @@ scenario "e2e_docker_base_with_worker" { step.create_worker, ] variables { + is_ci = var.is_ci test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/base_with_worker" network_name = step.create_docker_network_cluster.network_name - debug_no_run = var.e2e_debug_no_run alb_boundary_api_addr = step.create_boundary.address auth_method_id = step.create_boundary.auth_method_id auth_login_name = step.create_boundary.login_name auth_password = step.create_boundary.password - local_boundary_dir = local.local_boundary_dir - local_boundary_src_dir = local.local_boundary_src_dir + local_boundary_dir = local.local_boundary_dir != null ? local.local_boundary_dir : step.get_boundary_binary.path aws_ssh_private_key_path = step.generate_ssh_key.private_key_path target_address = step.create_host.address target_port = step.create_host.port diff --git a/enos/enos-scenario-e2e-docker-base.hcl b/enos/enos-scenario-e2e-docker-base.hcl index 9fcbce0487..4e57e741e7 100644 --- a/enos/enos-scenario-e2e-docker-base.hcl +++ b/enos/enos-scenario-e2e-docker-base.hcl @@ -12,7 +12,6 @@ scenario "e2e_docker_base" { locals { aws_ssh_private_key_path = var.aws_ssh_private_key_path != null ? abspath(var.aws_ssh_private_key_path) : null local_boundary_dir = var.local_boundary_dir != null ? abspath(var.local_boundary_dir) : null - local_boundary_src_dir = var.local_boundary_src_dir != null ? abspath(var.local_boundary_src_dir) : null boundary_docker_image_file = abspath(var.boundary_docker_image_file) license_path = abspath(var.boundary_license_path != null ? var.boundary_license_path : joinpath(path.root, "./support/boundary.hclic")) @@ -29,13 +28,26 @@ scenario "e2e_docker_base" { }, var.tags) } + step "get_boundary_binary" { + skip_step = local.local_boundary_dir != null ? true : false + module = module.get_binary_path + + variables { + name = "boundary" + } + } + + step "get_boundary_edition" { + module = module.get_boundary_edition + } + step "build_boundary_docker_image" { 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 + edition = step.get_boundary_edition.edition } } @@ -66,12 +78,12 @@ scenario "e2e_docker_base" { } step "read_license" { - skip_step = var.boundary_edition == "oss" - module = module.read_license + module = module.read_license variables { license_path = local.license_path license = var.boundary_license + edition = step.get_boundary_edition.edition } } @@ -87,7 +99,7 @@ scenario "e2e_docker_base" { network_name = [local.network_cluster] database_network = local.network_cluster postgres_address = step.create_boundary_database.address - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : "" + boundary_license = step.read_license.license } } @@ -110,15 +122,14 @@ scenario "e2e_docker_base" { step.create_host, ] variables { + is_ci = var.is_ci test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/base" network_name = step.create_docker_network.network_name - debug_no_run = var.e2e_debug_no_run alb_boundary_api_addr = step.create_boundary.address auth_method_id = step.create_boundary.auth_method_id auth_login_name = step.create_boundary.login_name auth_password = step.create_boundary.password - local_boundary_dir = local.local_boundary_dir - local_boundary_src_dir = local.local_boundary_src_dir + local_boundary_dir = local.local_boundary_dir != null ? local.local_boundary_dir : step.get_boundary_binary.path aws_ssh_private_key_path = step.generate_ssh_key.private_key_path target_address = step.create_host.address target_port = step.create_host.port diff --git a/enos/enos-scenario-e2e-docker-worker-registration-controller-led.hcl b/enos/enos-scenario-e2e-docker-worker-registration-controller-led.hcl index ec1abf9d02..ac38daa16e 100644 --- a/enos/enos-scenario-e2e-docker-worker-registration-controller-led.hcl +++ b/enos/enos-scenario-e2e-docker-worker-registration-controller-led.hcl @@ -12,7 +12,6 @@ scenario "e2e_docker_worker_registration_controller_led" { locals { aws_ssh_private_key_path = var.aws_ssh_private_key_path != null ? abspath(var.aws_ssh_private_key_path) : null local_boundary_dir = var.local_boundary_dir != null ? abspath(var.local_boundary_dir) : null - local_boundary_src_dir = var.local_boundary_src_dir != null ? abspath(var.local_boundary_src_dir) : null boundary_docker_image_file = abspath(var.boundary_docker_image_file) license_path = abspath(var.boundary_license_path != null ? var.boundary_license_path : joinpath(path.root, "./support/boundary.hclic")) @@ -31,13 +30,27 @@ scenario "e2e_docker_worker_registration_controller_led" { }, var.tags) } + step "get_boundary_binary" { + skip_step = local.local_boundary_dir != null ? true : false + module = module.get_binary_path + + variables { + name = "boundary" + } + } + + step "get_boundary_edition" { + module = module.get_boundary_edition + } + + step "build_boundary_docker_image" { 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 + edition = step.get_boundary_edition.edition } } @@ -82,12 +95,12 @@ scenario "e2e_docker_worker_registration_controller_led" { } step "read_license" { - skip_step = var.boundary_edition == "oss" - module = module.read_license + module = module.read_license variables { license_path = local.license_path license = var.boundary_license + edition = step.get_boundary_edition.edition } } @@ -104,7 +117,7 @@ scenario "e2e_docker_worker_registration_controller_led" { network_name = [local.network_cluster, local.network_database] database_network = local.network_database postgres_address = step.create_boundary_database.address - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : "" + boundary_license = step.read_license.license config_file = "boundary-config.hcl" } } @@ -159,7 +172,7 @@ scenario "e2e_docker_worker_registration_controller_led" { ] variables { image_name = step.build_boundary_docker_image.image_name - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : "" + boundary_license = step.read_license.license config_file = "worker-config-controller-led.hcl" container_name = "worker" initial_upstream = step.create_boundary.upstream_address @@ -179,15 +192,14 @@ scenario "e2e_docker_worker_registration_controller_led" { step.create_worker, ] variables { + is_ci = var.is_ci test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/base_with_worker" network_name = step.create_docker_network_cluster.network_name - debug_no_run = var.e2e_debug_no_run alb_boundary_api_addr = step.create_boundary.address auth_method_id = step.create_boundary.auth_method_id auth_login_name = step.create_boundary.login_name auth_password = step.create_boundary.password - local_boundary_dir = local.local_boundary_dir - local_boundary_src_dir = local.local_boundary_src_dir + local_boundary_dir = local.local_boundary_dir != null ? local.local_boundary_dir : step.get_boundary_binary.path aws_ssh_private_key_path = step.generate_ssh_key.private_key_path target_address = step.create_host.address target_port = step.create_host.port diff --git a/enos/enos-scenario-e2e-docker-worker-registration-worker-led.hcl b/enos/enos-scenario-e2e-docker-worker-registration-worker-led.hcl index d0f433c13f..90e1ad08b0 100644 --- a/enos/enos-scenario-e2e-docker-worker-registration-worker-led.hcl +++ b/enos/enos-scenario-e2e-docker-worker-registration-worker-led.hcl @@ -12,7 +12,6 @@ scenario "e2e_docker_worker_registration_worker_led" { locals { aws_ssh_private_key_path = var.aws_ssh_private_key_path != null ? abspath(var.aws_ssh_private_key_path) : null local_boundary_dir = var.local_boundary_dir != null ? abspath(var.local_boundary_dir) : null - local_boundary_src_dir = var.local_boundary_src_dir != null ? abspath(var.local_boundary_src_dir) : null boundary_docker_image_file = abspath(var.boundary_docker_image_file) license_path = abspath(var.boundary_license_path != null ? var.boundary_license_path : joinpath(path.root, "./support/boundary.hclic")) @@ -31,13 +30,27 @@ scenario "e2e_docker_worker_registration_worker_led" { }, var.tags) } + step "get_boundary_binary" { + skip_step = local.local_boundary_dir != null ? true : false + module = module.get_binary_path + + variables { + name = "boundary" + } + } + + step "get_boundary_edition" { + module = module.get_boundary_edition + } + + step "build_boundary_docker_image" { 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 + edition = step.get_boundary_edition.edition } } @@ -49,7 +62,6 @@ scenario "e2e_docker_worker_registration_worker_led" { } } - step "create_docker_network_database" { module = module.docker_network variables { @@ -83,12 +95,12 @@ scenario "e2e_docker_worker_registration_worker_led" { } step "read_license" { - skip_step = var.boundary_edition == "oss" - module = module.read_license + module = module.read_license variables { license_path = local.license_path license = var.boundary_license + edition = step.get_boundary_edition.edition } } @@ -105,7 +117,7 @@ scenario "e2e_docker_worker_registration_worker_led" { network_name = [local.network_cluster, local.network_database] database_network = local.network_database postgres_address = step.create_boundary_database.address - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : "" + boundary_license = step.read_license.license config_file = "boundary-config.hcl" } } @@ -147,7 +159,7 @@ scenario "e2e_docker_worker_registration_worker_led" { ] variables { image_name = step.build_boundary_docker_image.image_name - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : "" + boundary_license = step.read_license.license config_file = "worker-config-worker-led.hcl" container_name = "worker" initial_upstream = step.create_boundary.upstream_address @@ -195,15 +207,14 @@ scenario "e2e_docker_worker_registration_worker_led" { step.check_worker_health, ] variables { + is_ci = var.is_ci test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/base_with_worker" network_name = step.create_docker_network_cluster.network_name - debug_no_run = var.e2e_debug_no_run alb_boundary_api_addr = step.create_boundary.address auth_method_id = step.create_boundary.auth_method_id auth_login_name = step.create_boundary.login_name auth_password = step.create_boundary.password - local_boundary_dir = local.local_boundary_dir - local_boundary_src_dir = local.local_boundary_src_dir + local_boundary_dir = local.local_boundary_dir != null ? local.local_boundary_dir : step.get_boundary_binary.path aws_ssh_private_key_path = step.generate_ssh_key.private_key_path target_address = step.create_host.address target_port = step.create_host.port diff --git a/enos/enos-scenario-e2e-ui-aws.hcl b/enos/enos-scenario-e2e-ui-aws.hcl index 891cbc03cf..290cf9ebcf 100644 --- a/enos/enos-scenario-e2e-ui-aws.hcl +++ b/enos/enos-scenario-e2e-ui-aws.hcl @@ -14,11 +14,9 @@ scenario "e2e_ui_aws" { } locals { - aws_ssh_private_key_path = var.aws_ssh_private_key_path != null ? abspath(var.aws_ssh_private_key_path) : null - boundary_install_dir = abspath(var.boundary_install_dir) - license_path = abspath(var.boundary_license_path != null ? var.boundary_license_path : joinpath(path.root, "./support/boundary.hclic")) - local_boundary_dir = var.local_boundary_dir != null ? abspath(var.local_boundary_dir) : null - local_boundary_ui_src_dir = var.local_boundary_ui_src_dir != null ? abspath(var.local_boundary_ui_src_dir) : null + aws_ssh_private_key_path = var.aws_ssh_private_key_path != null ? abspath(var.aws_ssh_private_key_path) : null + boundary_install_dir = abspath(var.boundary_install_dir) + license_path = abspath(var.boundary_license_path != null ? var.boundary_license_path : joinpath(path.root, "./support/boundary.hclic")) build_path = { "local" = "/tmp", "crt" = var.crt_bundle_path == null ? null : abspath(var.crt_bundle_path) @@ -30,6 +28,10 @@ scenario "e2e_ui_aws" { }, var.tags) } + step "get_boundary_edition" { + module = module.get_boundary_edition + } + step "find_azs" { module = module.aws_az_finder @@ -43,12 +45,12 @@ scenario "e2e_ui_aws" { } step "read_license" { - skip_step = var.boundary_edition == "oss" - module = module.read_license + module = module.read_license variables { license_path = local.license_path license = var.boundary_license + edition = step.get_boundary_edition.edition } } @@ -61,7 +63,7 @@ scenario "e2e_ui_aws" { variables { path = local.build_path[matrix.builder] - edition = var.boundary_edition + edition = step.get_boundary_edition.edition } } @@ -101,7 +103,7 @@ scenario "e2e_ui_aws" { variables { boundary_binary_name = var.boundary_binary_name boundary_install_dir = local.boundary_install_dir - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : null + boundary_license = step.read_license.license common_tags = local.tags controller_instance_type = var.controller_instance_type controller_count = var.controller_count @@ -207,27 +209,24 @@ scenario "e2e_ui_aws" { ] variables { - debug_no_run = var.e2e_debug_no_run - alb_boundary_api_addr = step.create_boundary_cluster.alb_boundary_api_addr - auth_method_id = step.create_boundary_cluster.auth_method_id - auth_login_name = step.create_boundary_cluster.auth_login_name - auth_password = step.create_boundary_cluster.auth_password - local_boundary_dir = local.local_boundary_dir - local_boundary_ui_src_dir = local.local_boundary_ui_src_dir - aws_ssh_private_key_path = step.generate_ssh_key.private_key_path - target_address = step.create_targets_with_tag.target_private_ips[0] - target_user = "ubuntu" - target_port = "22" - vault_addr_public = step.create_vault_cluster.instance_addresses[0] - vault_addr_private = step.create_vault_cluster.instance_addresses_private[0] - vault_root_token = step.create_vault_cluster.vault_root_token - aws_access_key_id = step.iam_setup.access_key_id - aws_secret_access_key = step.iam_setup.secret_access_key - aws_host_set_filter = step.create_tag_inputs.tag_string - aws_host_set_ips = step.create_targets_with_tag.target_private_ips - worker_tag_egress = local.egress_tag - aws_region = var.aws_region - alb_cert = matrix.protocol == "https" ? step.create_boundary_cluster.alb_cert : "" + alb_boundary_api_addr = step.create_boundary_cluster.alb_boundary_api_addr + auth_method_id = step.create_boundary_cluster.auth_method_id + auth_login_name = step.create_boundary_cluster.auth_login_name + auth_password = step.create_boundary_cluster.auth_password + aws_ssh_private_key_path = step.generate_ssh_key.private_key_path + target_address = step.create_targets_with_tag.target_private_ips[0] + target_user = "ubuntu" + target_port = "22" + vault_addr_public = step.create_vault_cluster.instance_addresses[0] + vault_addr_private = step.create_vault_cluster.instance_addresses_private[0] + vault_root_token = step.create_vault_cluster.vault_root_token + aws_access_key_id = step.iam_setup.access_key_id + aws_secret_access_key = step.iam_setup.secret_access_key + aws_host_set_filter = step.create_tag_inputs.tag_string + aws_host_set_ips = step.create_targets_with_tag.target_private_ips + worker_tag_egress = local.egress_tag + aws_region = var.aws_region + alb_cert = matrix.protocol == "https" ? step.create_boundary_cluster.alb_cert : "" } } diff --git a/enos/enos-scenario-e2e-ui-docker.hcl b/enos/enos-scenario-e2e-ui-docker.hcl index cacfc39a93..69ecf228a9 100644 --- a/enos/enos-scenario-e2e-ui-docker.hcl +++ b/enos/enos-scenario-e2e-ui-docker.hcl @@ -11,8 +11,6 @@ scenario "e2e_ui_docker" { locals { aws_ssh_private_key_path = var.aws_ssh_private_key_path != null ? abspath(var.aws_ssh_private_key_path) : null - local_boundary_dir = var.local_boundary_dir != null ? abspath(var.local_boundary_dir) : null - local_boundary_ui_src_dir = var.local_boundary_ui_src_dir != null ? abspath(var.local_boundary_ui_src_dir) : null boundary_docker_image_file = abspath(var.boundary_docker_image_file) license_path = abspath(var.boundary_license_path != null ? var.boundary_license_path : joinpath(path.root, "./support/boundary.hclic")) @@ -29,13 +27,17 @@ scenario "e2e_ui_docker" { }, var.tags) } + step "get_boundary_edition" { + module = module.get_boundary_edition + } + step "build_boundary_docker_image" { 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 + edition = step.get_boundary_edition.edition ui_build_override = var.ui_build_override } } @@ -67,12 +69,12 @@ scenario "e2e_ui_docker" { } step "read_license" { - skip_step = var.boundary_edition == "oss" - module = module.read_license + module = module.read_license variables { license_path = local.license_path license = var.boundary_license + edition = step.get_boundary_edition.edition } } @@ -88,7 +90,7 @@ scenario "e2e_ui_docker" { network_name = [local.network_cluster] database_network = local.network_cluster postgres_address = step.create_boundary_database.address - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : "" + boundary_license = step.read_license.license } } @@ -128,7 +130,7 @@ scenario "e2e_ui_docker" { ] variables { image_name = step.build_boundary_docker_image.image_name - boundary_license = var.boundary_edition != "oss" ? step.read_license.license : "" + boundary_license = step.read_license.license config_file = "worker-config.hcl" container_name = "worker" initial_upstream = step.create_boundary.upstream_address @@ -159,32 +161,29 @@ scenario "e2e_ui_docker" { step.create_ldap_server, ] variables { - debug_no_run = var.e2e_debug_no_run - alb_boundary_api_addr = step.create_boundary.address - auth_method_id = step.create_boundary.auth_method_id - auth_login_name = step.create_boundary.login_name - auth_password = step.create_boundary.password - local_boundary_dir = local.local_boundary_dir - local_boundary_ui_src_dir = local.local_boundary_ui_src_dir - aws_ssh_private_key_path = step.generate_ssh_key.private_key_path - target_address = step.create_host.address - target_port = step.create_host.port - target_user = "ubuntu" - target_ca_key = step.create_host.ca_key_private - target_ca_key_public = step.create_host.ca_key_public - vault_addr_public = step.create_vault.address_public - vault_addr_private = step.create_vault.address_private - vault_addr_unified = step.create_vault.address_unified - vault_root_token = step.create_vault.token - vault_port = step.create_vault.port - ldap_address = step.create_ldap_server.address - ldap_domain_dn = step.create_ldap_server.domain_dn - ldap_admin_dn = step.create_ldap_server.admin_dn - ldap_admin_password = step.create_ldap_server.admin_password - ldap_user_name = step.create_ldap_server.user_name - ldap_user_password = step.create_ldap_server.user_password - ldap_group_name = step.create_ldap_server.group_name - worker_tag_egress = local.egress_tag + alb_boundary_api_addr = step.create_boundary.address + auth_method_id = step.create_boundary.auth_method_id + auth_login_name = step.create_boundary.login_name + auth_password = step.create_boundary.password + aws_ssh_private_key_path = step.generate_ssh_key.private_key_path + target_address = step.create_host.address + target_port = step.create_host.port + target_user = "ubuntu" + target_ca_key = step.create_host.ca_key_private + target_ca_key_public = step.create_host.ca_key_public + vault_addr_public = step.create_vault.address_public + vault_addr_private = step.create_vault.address_private + vault_addr_unified = step.create_vault.address_unified + vault_root_token = step.create_vault.token + vault_port = step.create_vault.port + ldap_address = step.create_ldap_server.address + ldap_domain_dn = step.create_ldap_server.domain_dn + ldap_admin_dn = step.create_ldap_server.admin_dn + ldap_admin_password = step.create_ldap_server.admin_password + ldap_user_name = step.create_ldap_server.user_name + ldap_user_password = step.create_ldap_server.user_password + ldap_group_name = step.create_ldap_server.group_name + worker_tag_egress = local.egress_tag } } } diff --git a/enos/enos-variables.hcl b/enos/enos-variables.hcl index 5ec302aef7..016184d5a0 100644 --- a/enos/enos-variables.hcl +++ b/enos/enos-variables.hcl @@ -94,18 +94,6 @@ variable "local_boundary_dir" { default = null } -variable "local_boundary_src_dir" { - description = "Path to local boundary source code directory" - type = string - default = null -} - -variable "local_boundary_ui_src_dir" { - description = "Path to local boundary-ui source code directory" - type = string - default = null -} - variable "crt_bundle_path" { description = "Path to CRT generated boundary bundle" type = string @@ -148,12 +136,6 @@ variable "local_build_target" { default = "build-ui build" } -variable "e2e_debug_no_run" { - description = "If set, this will prevent test suites from running" - type = bool - default = false -} - variable "docker_mirror" { description = "URL to the docker repository" type = string @@ -166,12 +148,6 @@ variable "boundary_binary_name" { default = "boundary" } -variable "boundary_edition" { - description = "Edition of boundary build" - type = string - default = "oss" -} - variable "boundary_license_path" { description = "Boundary license path" type = string @@ -286,3 +262,9 @@ variable "worker_version" { type = string default = null } + +variable "is_ci" { + description = "Whether the tests are running in CI" + type = bool + default = false +} diff --git a/enos/enos.vars.hcl b/enos/enos.vars.hcl index 2726168a21..93cde1b71e 100644 --- a/enos/enos.vars.hcl +++ b/enos/enos.vars.hcl @@ -7,18 +7,6 @@ // Recommended to copy this file to enos-local.vars.hcl and modify the values // there to avoid accidentally committing sensitive information. -// ============================================================================== -// REQUIRED VARIABLES -// ============================================================================== -// Build edition -// If using community edition, set to "oss" -// If using enterprise edition, set to "enterprise" -// boundary_edition = "oss" - -// Prevents the end-to-end test suites from running when starting scenarios. -// Recommend setting this to true unless running in CI. -// e2e_debug_no_run = true - // ============================================================================== // OPTIONAL VARIABLES // ============================================================================== @@ -59,19 +47,6 @@ // The GCP client_email used to authenticate with GCP // gcp_client_email = "my-gcp-client-email" -// The directory that contains the copy of the boundary cli that the e2e tests -// will use in CI. Only needed if e2e_debug_no_run = false. -// local_boundary_dir = "/Users//.go/bin" - -// The directory that contains the source code of boundary/boundary-enterprise. -// This is used in docker scenarios in CI in order to mount the source code into -// the container. Only needed if e2e_debug_no_run = false. -// local_boundary_src_dir = "/Users//Developer/boundary" - -// The directory that contains the source code of boundary-ui. This is used for -// front-end e2e testing (UI scenarios) in CI. Only needed if e2e_debug_no_run = false. -// local_boundary_ui_src_dir = "/Users//Developer/boundary-ui" - // Github token to load go modules on windows client // only required for running automation on RDP e2e test cases // Token requires read access to hashicorp repositories @@ -94,7 +69,7 @@ // Name of user. This is used to tag resources in AWS to more easily identify // your resources. Can be set to any string. -/// Applies to AWS scenarios only. +// Applies to AWS scenarios only. // enos_user = "enos" // The AWS region you want to create the resources in. Make sure you choose a diff --git a/enos/modules/aws_boundary/variables.tf b/enos/modules/aws_boundary/variables.tf index 5fd061c2cb..015be12229 100644 --- a/enos/modules/aws_boundary/variables.tf +++ b/enos/modules/aws_boundary/variables.tf @@ -337,7 +337,7 @@ variable "boundary_license" { description = "Boundary license (not needed for OSS, required for enterprise)" type = string sensitive = true - default = null + default = "" } variable "controller_config_file_path" { diff --git a/enos/modules/binary_finder/main.tf b/enos/modules/binary_finder/main.tf deleted file mode 100644 index 57a2bed38a..0000000000 --- a/enos/modules/binary_finder/main.tf +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright IBM Corp. 2020, 2026 -# SPDX-License-Identifier: BUSL-1.1 - -terraform { - required_providers { - enos = { - source = "registry.terraform.io/hashicorp-forge/enos" - } - } -} - -variable "name" { - description = "the binary name" -} - -resource "enos_local_exec" "find_binary" { - inline = ["type -P ${var.name} || (echo \"\n\nCould not find ${var.name} executable. Have you installed it?\n\n\" && exit 1)"] -} - -output "path" { - value = enos_local_exec.find_binary.stdout -} diff --git a/enos/modules/generate_docker_image_name/main.tf b/enos/modules/generate_docker_image_name/main.tf new file mode 100644 index 0000000000..d5d26d722c --- /dev/null +++ b/enos/modules/generate_docker_image_name/main.tf @@ -0,0 +1,28 @@ +# Copyright IBM Corp. 2020, 2026 +# SPDX-License-Identifier: BUSL-1.1 + +variable "image_tag" { + description = "the tag of the docker image (e.g. 1.2.3)" + type = string + default = "latest" +} + +variable "edition" { + description = "the edition of the docker image, either 'oss' or 'ent'" + type = string + default = "oss" + validation { + condition = contains(["oss", "ent"], var.edition) + error_message = "edition must be either 'oss' or 'ent'." + } +} + +variable "repository" { + description = "the repository of the docker image." + type = string + default = "hashicorp/boundary" +} + +output "image_name" { + value = "${var.repository}${var.edition == "ent" ? "-enterprise" : ""}:${var.image_tag}${var.edition == "ent" ? "-ent" : ""}" +} diff --git a/enos/modules/get_binary_path/main.tf b/enos/modules/get_binary_path/main.tf new file mode 100644 index 0000000000..95f0998de8 --- /dev/null +++ b/enos/modules/get_binary_path/main.tf @@ -0,0 +1,24 @@ +# Copyright IBM Corp. 2020, 2026 +# SPDX-License-Identifier: BUSL-1.1 + +terraform { + required_providers { + external = { + source = "hashicorp/external" + } + } +} + +variable "name" { + description = "the binary name" +} + +data "external" "find_binary" { + program = ["bash", "-c", "printf '{\"path\":\"%s\"}' \"$(which ${var.name})\""] +} + +output "path" { + value = dirname(abspath(data.external.find_binary.result.path)) +} + + diff --git a/enos/modules/get_boundary_edition/main.tf b/enos/modules/get_boundary_edition/main.tf new file mode 100644 index 0000000000..b39420af0b --- /dev/null +++ b/enos/modules/get_boundary_edition/main.tf @@ -0,0 +1,24 @@ +# Copyright IBM Corp. 2020, 2026 +# SPDX-License-Identifier: BUSL-1.1 + +terraform { + required_providers { + external = { + source = "hashicorp/external" + } + } +} + +data "external" "repo_root" { + program = ["bash", "-c", "printf '{\"path\":\"%s\"}' \"$(git rev-parse --show-toplevel)\""] +} + +data "external" "make_edition" { + program = ["bash", "-c", "edition=$(make -s -C '${data.external.repo_root.result.path}' edition | tr -d '\\r\\n') && printf '{\"edition\":\"%s\"}' \"$edition\""] +} + +output "edition" { + value = data.external.make_edition.result.edition +} + + diff --git a/enos/modules/get_repo_root/main.tf b/enos/modules/get_repo_root/main.tf new file mode 100644 index 0000000000..31df45cbe8 --- /dev/null +++ b/enos/modules/get_repo_root/main.tf @@ -0,0 +1,18 @@ +# Copyright IBM Corp. 2024, 2026 +# SPDX-License-Identifier: BUSL-1.1 + +terraform { + required_providers { + external = { + source = "hashicorp/external" + } + } +} + +data "external" "repo_root" { + program = ["bash", "-c", "printf '{\"path\":\"%s\"}' \"$(git rev-parse --show-toplevel)\""] +} + +output "path" { + value = abspath(data.external.repo_root.result.path) +} diff --git a/enos/modules/read_license/main.tf b/enos/modules/read_license/main.tf index c34908ddee..800b0fdc2e 100644 --- a/enos/modules/read_license/main.tf +++ b/enos/modules/read_license/main.tf @@ -2,16 +2,40 @@ # SPDX-License-Identifier: BUSL-1.1 -# Loads boundary license from file or environment variable +# Loads license from file or environment variable # If license is null or not provided, then the license is returned from the file at license_path variable "license_path" { - description = "Path to the boundary license file" + description = "Path to a boundary license file" + type = string + default = null } variable "license" { - description = "Boundary license" + description = "License key" + type = string default = null } +variable "edition" { + description = "Edition to determine if license is needed" + type = string + default = "oss" + validation { + condition = contains(["oss", "ent"], var.edition) + error_message = "edition must be either 'oss' or 'ent'." + } +} + +check "license_or_license_path_required" { + assert { + condition = ( + var.edition == "oss" || + var.license != null || + var.license_path != null + ) + error_message = "license_path must be provided when license is not set for non-oss editions." + } +} + output "license" { - value = var.license != null ? var.license : file(var.license_path) + value = var.edition == "ent" ? (var.license != null ? var.license : file(var.license_path)) : "" } diff --git a/enos/modules/test_e2e/main.tf b/enos/modules/test_e2e/main.tf index 8f59b91d30..77cb99a1f4 100644 --- a/enos/modules/test_e2e/main.tf +++ b/enos/modules/test_e2e/main.tf @@ -9,8 +9,8 @@ terraform { } } -variable "debug_no_run" { - description = "If set, this module will not execute the tests so that you can still access environment variables" +variable "is_ci" { + description = "Run tests automatically if in CI" type = bool default = false } @@ -45,6 +45,7 @@ variable "max_page_size" { variable "local_boundary_dir" { description = "Local Path to boundary executable" type = string + default = null } variable "target_user" { description = "SSH username for target" @@ -323,9 +324,9 @@ resource "enos_local_exec" "run_e2e_test" { E2E_CLIENT_SSH_KEY = var.client_ssh_key } - inline = var.debug_no_run ? [""] : [ + inline = var.is_ci ? [ "set -o pipefail; PATH=\"${var.local_boundary_dir}:$PATH\" go test -v ${var.test_package} -count=1 -timeout ${var.test_timeout} | tee ${path.module}/../../test-e2e-${local.package_name}.log" - ] + ] : [""] } output "test_results" { diff --git a/enos/modules/test_e2e_docker/main.tf b/enos/modules/test_e2e_docker/main.tf index 9be851295e..fba995c616 100644 --- a/enos/modules/test_e2e_docker/main.tf +++ b/enos/modules/test_e2e_docker/main.tf @@ -14,6 +14,11 @@ terraform { } } +variable "is_ci" { + description = "Run tests automatically if in CI" + type = bool + default = false +} variable "network_name" { description = "Name of Docker Network" type = string @@ -23,11 +28,6 @@ variable "controller_container_name" { type = string default = "" } -variable "debug_no_run" { - description = "If set, this module will not execute the tests so that you can still access environment variables" - type = bool - default = false -} variable "test_package" { description = "Name of Go test package to run" type = string @@ -55,10 +55,7 @@ variable "auth_password" { variable "local_boundary_dir" { description = "Local Path to boundary executable" type = string -} -variable "local_boundary_src_dir" { - description = "Local Path to boundary src code directory" - type = string + default = "" } variable "target_user" { description = "SSH username for target" @@ -352,12 +349,9 @@ resource "enos_local_exec" "run_e2e_test" { E2E_GCP_HOST_SET_IPS = jsonencode(var.gcp_host_set_ips) E2E_MAX_PAGE_SIZE = var.max_page_size E2E_CONTROLLER_CONTAINER_NAME = var.controller_container_name - BOUNDARY_DIR = abspath(var.local_boundary_src_dir) - BOUNDARY_CLI_DIR = abspath(var.local_boundary_dir) - MODULE_DIR = abspath(path.module) } - inline = var.debug_no_run ? [""] : [ + inline = var.is_ci ? [ "set -o pipefail; PATH=\"${var.local_boundary_dir}:$PATH\" go test -v ${var.test_package} -count=1 -timeout ${var.test_timeout} | tee ${path.module}/../../test-e2e-${local.package_name}.log" - ] + ] : [""] } diff --git a/enos/modules/test_e2e_ui/main.tf b/enos/modules/test_e2e_ui/main.tf index b5d552b363..83c76d2be1 100644 --- a/enos/modules/test_e2e_ui/main.tf +++ b/enos/modules/test_e2e_ui/main.tf @@ -9,11 +9,6 @@ terraform { } } -variable "debug_no_run" { - description = "If set, this module will not execute the tests so that you can still access environment variables" - type = bool - default = true -} variable "alb_boundary_api_addr" { description = "URL of the Boundary instance" type = string @@ -34,15 +29,6 @@ variable "auth_password" { type = string default = "" } -variable "local_boundary_dir" { - description = "Local Path to boundary executable" - type = string -} -variable "local_boundary_ui_src_dir" { - description = "Local Path to boundary-ui directory" - type = string -} - variable "aws_ssh_private_key_path" { description = "Local Path to key used to SSH onto created hosts" type = string @@ -250,7 +236,7 @@ resource "enos_local_exec" "run_e2e_test" { E2E_ALB_CERT = var.alb_cert } - inline = var.debug_no_run ? [""] : ["set -o pipefail; PATH=\"${var.local_boundary_dir}:$PATH\" pnpm --cwd ${var.local_boundary_ui_src_dir}/ui/admin run e2e 2>&1 | tee ${path.module}/../../test-e2e-ui.log"] + inline = [""] } output "test_results" {