File tree Expand file tree Collapse file tree 4 files changed +34
-19
lines changed Expand file tree Collapse file tree 4 files changed +34
-19
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,32 @@ function ess_up {
2525
2626 # Store the cluster name as a meta-data
2727 & buildkite- agent meta- data set cluster- name $ClusterName
28+
29+ # Load the ESS stack secrets
30+ # QUESTION: should we support the case when using the ESS stack in local environment?
31+ & oblt- cli cluster secrets env -- cluster- name $ClusterName -- output- file= " secrets.env"
32+
33+ # Load environment variables from secrets.env
34+ $envFile = Join-Path $PSScriptRoot " secrets.env"
35+
36+ if (Test-Path $envFile ) {
37+ Get-Content $envFile | ForEach-Object {
38+ $name , $value = $_.split (' =' , 2 )
39+ if ($name -and $value ) {
40+ # Remove any surrounding quotes from the value
41+ $value = $value.Trim (' "'' ' )
42+
43+ # Set the environment variable
44+ [System.Environment ]::SetEnvironmentVariable($name.Trim (), $value )
45+ Write-Output " Set environment variable: $ ( $name.Trim ()) "
46+ }
47+ }
48+ Write-Output " Environment variables loaded successfully from $envFile " - ForegroundColor Green
49+ Remove-Item - Path $envFile - Force - ErrorAction Stop
50+ } else {
51+ Write-Error " secrets.env file not found at $envFile "
52+ return 1
53+ }
2854}
2955
3056function ess_down {
Original file line number Diff line number Diff line change @@ -24,6 +24,14 @@ function ess_up() {
2424
2525 # Store the cluster name as a meta-data
2626 buildkite-agent meta-data set cluster-name " ${CLUSTER_NAME} "
27+
28+ # Load the ESS stack secrets
29+ # QUESTION: should we support the case when using the ESS stack in local environment?
30+ oblt-cli cluster secrets env --cluster-name=" ${CLUSTER_NAME} " --output-file=" secrets.env"
31+
32+ # Source the secrets file
33+ source " secrets.env" || rm " secrets.env"
34+ rm secrets.env || true
2735}
2836
2937function ess_down() {
Original file line number Diff line number Diff line change 2929 # Get-Ess-Stack will start the ESS stack if it is a BK retry, otherwise it will retrieve ESS stack metadata
3030 Get-Ess - Stack - StackVersion $PACKAGE_VERSION
3131
32- # Load the ESS stack secrets
33- # Get the cluster name from the meta-data (CI specific)
34- # QUESTION: should we support the case when using the ESS stack in local environment?
35- $ClusterName = & buildkite- agent meta- data get cluster- name
36- & oblt- cli cluster secrets env -- cluster- nam $ClusterName -- output- file= " env.sh"
37-
38- # TODO: source the secrets file
39- source " ${PWD} /env.sh" || rm " ${PWD} /env.sh"
40-
4132 & " $PWD \.buildkite\scripts\buildkite-integration-tests.ps1" $GROUP_NAME $TEST_SUDO
4233 $TestsExitCode = $LASTEXITCODE
4334 if ($TestsExitCode -ne 0 )
Original file line number Diff line number Diff line change @@ -39,16 +39,6 @@ if [[ "${BUILDKITE_RETRY_COUNT}" -gt 0 ]]; then
3939 preinstall_fleet_packages
4040fi
4141
42- # Load the ESS stack secrets
43- # Get the cluster name from the meta-data (CI specific)
44- # QUESTION: should we support the case when using the ESS stack in local environment?
45- CLUSTER_NAME=" $( buildkite-agent meta-data get cluster-name) "
46-
47- oblt-cli cluster secrets env --cluster-name=" ${CLUSTER_NAME} " --output-file=" ${PWD} /env.sh"
48-
49- # Source the secrets file
50- source " ${PWD} /env.sh" || rm " ${PWD} /env.sh"
51-
5242# Run integration tests
5343echo " ~~~ Running integration tests"
5444
You can’t perform that action at this time.
0 commit comments