GoogleCloudPlatform / GoogleCloudPlatform/cloud-builders-community

Windows builder : Environment variables not accessible in powershell script

Open
#414 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.3k
Forks
848
PR merge metrics
No merged PRs in 30d

Description

## Affected builder image

https://github.com/GoogleCloudPlatform/cloud-builders-community/tree/master/windows-builder

## Expected Behavior
Environment variable values set in cloudbuild.yml must be accessible inside PowerShell script
## Actual Behavior
Environment variables does seem to be set inside the container.
## Steps to Reproduce the Problem
cloudbuild.yaml content
```YAML
- name: 'gcr.io/$PROJECT_ID/windows-builder'
args: [ '--command', 'powershell.exe -file build.ps1' ]
env:
- 'ZONE_VALUE=test_var_value'
```
Expected `ZONE_VALUE` to be printed, but looks like it is not set.
```
Get-ChildItem Env:
echo $env:ZONE_VALUE
```
However, I can see it in execution details -
![image](https://user-images.githubusercontent.com/2736597/82207615-76a0c280-994d-11ea-8ba5-da4ae1a376e7.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.