diff --git a/enos/enos-variables.hcl b/enos/enos-variables.hcl index 8690e77ea..8ee11a553 100644 --- a/enos/enos-variables.hcl +++ b/enos/enos-variables.hcl @@ -279,7 +279,7 @@ variable "ui_build_override" { } variable "github_token" { - description = "github token needed to run automated tests (requires read access to hashicorp repos)" + description = "github token to the hashicorp org. needed to run RDP automated tests (requires contents (read-only) and actions (read-only) with fine-grained tokens or repo access using classic tokens)" type = string default = "" } diff --git a/enos/modules/aws_windows_client/scripts/setup.ps1 b/enos/modules/aws_windows_client/scripts/setup.ps1 index e098ff388..3c3bd7765 100644 --- a/enos/modules/aws_windows_client/scripts/setup.ps1 +++ b/enos/modules/aws_windows_client/scripts/setup.ps1 @@ -35,6 +35,7 @@ refreshenv # install mremoteng choco install mremoteng -y +# install dependencies for rdp automated tests choco install golang -y --version ${go_version} refreshenv choco install git -y @@ -47,5 +48,43 @@ refreshenv # Set the github token if provided if ("${github_token}" -ne "") { + # configure git to be able to download from private repos git config --system url."https://oauth2:${github_token}@github.com".insteadOf "https://github.com" -} \ No newline at end of file + + # download opencv artifact if available + [Environment]::SetEnvironmentVariable("GITHUB_TOKEN", "${github_token}", [EnvironmentVariableTarget]::Machine) + choco install gh -y + refreshenv + + $repo = "hashicorp/boundary-enterprise" + $workflow = "build-opencv-ent.yml" + $branch = "main" + $artifactName = "opencv" + + $run = gh run list --repo $repo --workflow=$workflow --branch=$branch --status success --limit 1 --json databaseId | ConvertFrom-Json + if (-not $run -or -not $run[0].databaseId) { + Write-Error "Could not find a workflow run for $workflow in $repo." + exit 1 + } + Write-Host "Found workflow run: $($run[0])" + $run_id = $run[0].databaseId + + New-Item -ItemType Directory -Path "C:/opencv/build" -Force + $downloadResult = gh run download $run_id --repo $repo -n $artifactName --dir C:/opencv/build + if ($LASTEXITCODE -ne 0) { + Write-Error "Failed to download artifact $artifactName from workflow run $run_id." + exit 1 + } + + # add opencv to path + $existingPath = [Environment]::GetEnvironmentVariable( + "Path", + [EnvironmentVariableTarget]::Machine + ) + $newPath = $existingPath + ";C:\opencv\build\install\x64\mingw\bin;" + [Environment]::SetEnvironmentVariable( + "Path", + $newPath, + [EnvironmentVariableTarget]::Machine + ) +} diff --git a/enos/modules/aws_windows_client/variables.tf b/enos/modules/aws_windows_client/variables.tf index 0ebe4195c..3632f7acb 100644 --- a/enos/modules/aws_windows_client/variables.tf +++ b/enos/modules/aws_windows_client/variables.tf @@ -49,7 +49,7 @@ variable "boundary_src_path" { } variable "github_token" { - description = "Github token needed to run automated tests. Token requires read access to hashicorp repositories" + description = "github token to the hashicorp org. needed to run RDP automated tests (requires contents (read-only) and actions (read-only) with fine-grained tokens or repo access using classic tokens)" type = string default = "" -} \ No newline at end of file +}