Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/operator-sdk/build: expand env in go build #1535

Merged
merged 3 commits into from
Jun 7, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Fixes a regression that causes Helm RBAC generation to contain an empty custom ruleset when the chart's default manifest contains only namespaced resources. ([#1456](https://github.com/operator-framework/operator-sdk/pull/1456))
- Fixes an issue that causes Helm RBAC generation to fail when creating new operators with a Kubernetes context configured to connect to an OpenShift cluster. ([#1461](https://github.com/operator-framework/operator-sdk/pull/1461))
- Generated CSV's that include a deployment install strategy will be checked for a reference to `metadata.annotations['olm.targetNamespaces']`, and if one is not found a reference will be added to the `WATCH_NAMESPACE` env var for all containers in the deployment. This is a bug because any other value that references the CSV's namespace is incorrect. ([#1396](https://github.com/operator-framework/operator-sdk/pull/1396))
- Build `-trimpath` was not being respected. `$GOPATH` was not expending because `exec.Cmd{}` is not executed in a shell environment. ([#1535](https://github.com/operator-framework/operator-sdk/pull/1535))

## v0.8.0

Expand Down
3 changes: 2 additions & 1 deletion cmd/operator-sdk/build/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ func buildFunc(cmd *cobra.Command, args []string) error {
goBuildEnv = append(goBuildEnv, "CGO_ENABLED=0")
}

goTrimFlags := []string{"-gcflags", "all=-trimpath=${GOPATH}", "-asmflags", "all=-trimpath=${GOPATH}"}
trimPath := os.ExpandEnv("all=-trimpath=${GOPATH}")
goTrimFlags := []string{"-gcflags", trimPath, "-asmflags", trimPath}
absProjectPath := projutil.MustGetwd()
projectName := filepath.Base(absProjectPath)

Expand Down
3 changes: 2 additions & 1 deletion internal/util/projutil/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ func getGeneralArgs(cmd string, opts GoCmdOptions) ([]string, error) {
}

func setCommandFields(c *exec.Cmd, opts GoCmdOptions) {
c.Env = append(c.Env, os.Environ()...)
if len(opts.Env) != 0 {
c.Env = append(os.Environ(), opts.Env...)
c.Env = append(c.Env, opts.Env...)
}
if opts.Dir != "" {
c.Dir = opts.Dir
Expand Down