Description
Bug description
When you use variants with leeway and specify and environment variable and have a package which also specifies the same environment variable, the variant's setting will be preferred.
I believe this to be a bug because a package is more specific than a variant (although they're not directly related) and in our case in https://github.com/gitpod-io/gitpod it let to unexpected behavior with a global setting for GOARCH
and our inability to override it inside a package building our CLI for different platforms.
Steps to reproduce
WORKSPACE.yaml:
defaultVariant:
env:
- GOARCH=amd64
BUILD.yaml:
packages:
- name: env-test
type: generic
env:
- GOARCH=arm64
- GOOS=darwin
config:
commands:
- ["sh", "-c", "echo $GOARCH $GOOS && exit 1"]
Expected behavior
Building the above results in arm64 darwin
instead of the actual amd64 darwin
.
Example repository
No response
Anything else?
It may not be clear-cut what of the two should actually have preference over the other and if it's the case there's no common agreement, I can also see a possibility for a leeway package to specify its own default variant or other opt-out of global settings.
Activity