From 725093f8d894c936191543f9a9af83f701d63dfe Mon Sep 17 00:00:00 2001 From: dillanb-hashi Date: Thu, 16 Oct 2025 15:09:45 -0700 Subject: [PATCH] chore(e2e): Add some dependencies for RDP automation * added dependencies for automation --- enos/enos-scenario-e2e-aws-rdp-base.hcl | 1 + enos/enos-variables.hcl | 6 +++++ enos/enos.vars.hcl | 7 +++++- enos/modules/aws_windows_client/main.tf | 6 +++++ .../aws_windows_client/scripts/setup.ps1 | 22 ++++++++++++++++++- enos/modules/aws_windows_client/variables.tf | 6 +++++ 6 files changed, 46 insertions(+), 2 deletions(-) diff --git a/enos/enos-scenario-e2e-aws-rdp-base.hcl b/enos/enos-scenario-e2e-aws-rdp-base.hcl index 6d8a305d3..929d60ab7 100644 --- a/enos/enos-scenario-e2e-aws-rdp-base.hcl +++ b/enos/enos-scenario-e2e-aws-rdp-base.hcl @@ -112,6 +112,7 @@ scenario "e2e_aws_rdp_base" { client_version = matrix.client boundary_cli_zip_path = step.build_boundary_windows.artifact_path boundary_src_path = local.local_boundary_src_dir + github_token = var.github_token } } diff --git a/enos/enos-variables.hcl b/enos/enos-variables.hcl index 4bcac203a..9d8b7b1b8 100644 --- a/enos/enos-variables.hcl +++ b/enos/enos-variables.hcl @@ -271,3 +271,9 @@ variable "windows_instance_type" { type = string default = "m7i-flex.xlarge" } + +variable "github_token" { + description = "github token needed to run automated tests (requires read access to hashicorp repos)" + type = string + default = null +} diff --git a/enos/enos.vars.hcl b/enos/enos.vars.hcl index 9d9f10944..26bea917d 100644 --- a/enos/enos.vars.hcl +++ b/enos/enos.vars.hcl @@ -73,7 +73,7 @@ // if running GCP scenarios. This should not be used in combination with gcp_private_key_path. // gcp_private_key = "" -// The GCP private_key_id. Only needed if running GCP scenarios. +// The GCP private_key_id. Only needed if running GCP scenarios. // gcp_private_key_id = "" // The GCP client_email used to authenticate with GCP @@ -91,3 +91,8 @@ // 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 +// github_token = "" \ No newline at end of file diff --git a/enos/modules/aws_windows_client/main.tf b/enos/modules/aws_windows_client/main.tf index b616ef88b..e2b531563 100644 --- a/enos/modules/aws_windows_client/main.tf +++ b/enos/modules/aws_windows_client/main.tf @@ -285,6 +285,10 @@ resource "enos_local_exec" "wait_for_ssh" { inline = ["timeout 600s bash -c 'until ssh -i ${abspath(local_sensitive_file.private_key.filename)} -o BatchMode=Yes -o IdentitiesOnly=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no Administrator@${aws_instance.client.public_ip} \"echo ready\"; do sleep 10; done'"] } +resource "enos_local_exec" "get_go_version" { + inline = ["cat $(echo $(git rev-parse --show-toplevel))/.go-version | xargs"] +} + resource "enos_local_exec" "make_dir" { count = var.boundary_cli_zip_path != "" ? 1 : 0 depends_on = [ @@ -333,6 +337,8 @@ resource "local_file" "powershell_script" { content = templatefile("${path.module}/scripts/setup.ps1", { boundary_cli_zip_path = "${local.test_dir}/${basename(local.boundary_cli_zip_path)}" boundary_src_zip_path = "${local.test_dir}/${basename(archive_file.boundary_src_zip[0].output_path)}" + go_version = "${enos_local_exec.get_go_version.stdout}" + github_token = "${var.github_token}" }) filename = "${path.root}/.terraform/tmp/setup_windows_client.ps1" } diff --git a/enos/modules/aws_windows_client/scripts/setup.ps1 b/enos/modules/aws_windows_client/scripts/setup.ps1 index 150aef26d..e098ff388 100644 --- a/enos/modules/aws_windows_client/scripts/setup.ps1 +++ b/enos/modules/aws_windows_client/scripts/setup.ps1 @@ -5,6 +5,11 @@ $destination = Split-Path -Path ${boundary_cli_zip_path} Expand-Archive -Path ${boundary_cli_zip_path} -DestinationPath $destination -Force +# Unzip boundary src to new directory +$base = [System.IO.Path]::GetFileNameWithoutExtension("${boundary_src_zip_path}") +$src_destination = Join-Path (Split-Path ${boundary_src_zip_path}) $base +Expand-Archive -Path ${boundary_src_zip_path} -DestinationPath $src_destination -Force + # Add Boundary CLI to PATH $existingPath = [Environment]::GetEnvironmentVariable( "Path", @@ -28,4 +33,19 @@ Import-Module "$env:ChocolateyInstall/helpers/chocolateyInstaller.psm1" refreshenv # install mremoteng -choco install mremoteng -y \ No newline at end of file +choco install mremoteng -y + +choco install golang -y --version ${go_version} +refreshenv +choco install git -y +refreshenv +choco install mingw -y +refreshenv +# needs cmake >3.7 and <4.0 +choco install cmake --version 3.31.8 -y +refreshenv + +# Set the github token if provided +if ("${github_token}" -ne "") { + git config --system url."https://oauth2:${github_token}@github.com".insteadOf "https://github.com" +} \ No newline at end of file diff --git a/enos/modules/aws_windows_client/variables.tf b/enos/modules/aws_windows_client/variables.tf index 0525ca963..0ebe4195c 100644 --- a/enos/modules/aws_windows_client/variables.tf +++ b/enos/modules/aws_windows_client/variables.tf @@ -47,3 +47,9 @@ variable "boundary_src_path" { type = string default = "" } + +variable "github_token" { + description = "Github token needed to run automated tests. Token requires read access to hashicorp repositories" + type = string + default = "" +} \ No newline at end of file