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

feat: Add platform template parameters #1301

Closed
nmittler opened this issue May 9, 2024 · 1 comment · Fixed by #1302
Closed

feat: Add platform template parameters #1301

nmittler opened this issue May 9, 2024 · 1 comment · Fixed by #1302

Comments

@nmittler
Copy link
Contributor

nmittler commented May 9, 2024

It seems that ko follows goreleaser's approach for providing template parameters for environment variables ({{ .Env.XXX }}. However, it would useful to have build-specific parameters accessible as well. One good example is providing access GOOS and GOARCH used to build a given binary (e.g. {{ .GOOS }} }. AFAICT from the current docs, this isn't available today.

@nmittler nmittler changed the title Expose additional template parameters Expose platform information via template parameters May 9, 2024
nmittler added a commit to nmittler/ko that referenced this issue May 9, 2024
This restructures the build logic in order to expand the buildArgs to include:

- `Env`: the actual environment variables used to execute the build. This includes platform info (e.g. `GOOS`, `GOARCH`).
- `GoEnv`: the map of variables from `go env`, but overridden with any platform-specific values defined in `Env`.

Fixes ko-build#1301
@nmittler
Copy link
Contributor Author

nmittler commented May 9, 2024

FYI I put together a potential fix: #1302

nmittler added a commit to nmittler/ko that referenced this issue May 9, 2024
This restructures the build logic in order to expand the buildArgs to include:

- `Env`: the actual environment variables used to execute the build. This includes platform info (e.g. `GOOS`, `GOARCH`).
- `GoEnv`: the map of variables from `go env`, but overridden with any platform-specific values defined in `Env`.

Fixes ko-build#1301
nmittler added a commit to nmittler/ko that referenced this issue May 10, 2024
This restructures the build logic in order to expand the buildArgs to include:

- `Env`: the actual environment variables used to execute the build. This includes platform info (e.g. `GOOS`, `GOARCH`).
- `GoEnv`: the map of variables from `go env`, but overridden with any platform-specific values defined in `Env`.

Fixes ko-build#1301

Signed-off-by: Nathan Mittler <[email protected]>
nmittler added a commit to nmittler/ko that referenced this issue May 10, 2024
This restructures the build logic in order to expand the buildArgs to include:

- `Env`: the actual environment variables used to execute the build. This includes platform info (e.g. `GOOS`, `GOARCH`).
- `GoEnv`: the map of variables from `go env`, but overridden with any platform-specific values defined in `Env`.

Fixes ko-build#1301

Signed-off-by: Nathan Mittler <[email protected]>
@nmittler nmittler changed the title Expose platform information via template parameters Add platform template parameters May 10, 2024
@nmittler nmittler changed the title Add platform template parameters feat: Add platform template parameters May 10, 2024
nmittler added a commit to nmittler/ko that referenced this issue May 12, 2024
This restructures the build logic in order to expand the buildArgs to include:

- `Env`: the actual environment variables used to execute the build. This includes platform info (e.g. `GOOS`, `GOARCH`).
- `GoEnv`: the map of variables from `go env`, but overridden with any platform-specific values defined in `Env`.

Fixes ko-build#1301

Signed-off-by: Nathan Mittler <[email protected]>
nmittler added a commit to nmittler/ko that referenced this issue May 15, 2024
This restructures the build logic in order to expand the buildArgs to include:

- `Env`: the actual environment variables used to execute the build. This includes platform info (e.g. `GOOS`, `GOARCH`).
- `GoEnv`: the map of variables from `go env`, but overridden with any platform-specific values defined in `Env`.

Fixes ko-build#1301

Signed-off-by: Nathan Mittler <[email protected]>
nmittler added a commit to nmittler/ko that referenced this issue May 15, 2024
This restructures the build logic in order to expand the buildArgs to include:

- `Env`: the actual environment variables used to execute the build. This includes platform info (e.g. `GOOS`, `GOARCH`).
- `GoEnv`: the map of variables from `go env`, but overridden with any platform-specific values defined in `Env`.

Fixes ko-build#1301

Signed-off-by: Nathan Mittler <[email protected]>
nmittler added a commit to nmittler/ko that referenced this issue May 15, 2024
This restructures the build logic in order to expand the buildArgs to include:

- `Env`: the actual environment variables used to execute the build. This includes platform info (e.g. `GOOS`, `GOARCH`).
- `GoEnv`: the map of variables from `go env`, but overridden with any platform-specific values defined in `Env`.

Fixes ko-build#1301

Signed-off-by: Nathan Mittler <[email protected]>
imjasonh pushed a commit that referenced this issue May 15, 2024
This restructures the build logic in order to expand the buildArgs to include:

- `Env`: the actual environment variables used to execute the build. This includes platform info (e.g. `GOOS`, `GOARCH`).
- `GoEnv`: the map of variables from `go env`, but overridden with any platform-specific values defined in `Env`.

Fixes #1301

Signed-off-by: Nathan Mittler <[email protected]>
nmittler added a commit to nmittler/ko that referenced this issue May 15, 2024
This restructures the build logic in order to expand the buildArgs to include:

- `Env`: the actual environment variables used to execute the build. This includes platform info (e.g. `GOOS`, `GOARCH`).
- `GoEnv`: the map of variables from `go env`, but overridden with any platform-specific values defined in `Env`.

Fixes ko-build#1301

Signed-off-by: Nathan Mittler <[email protected]>
nmittler added a commit to nmittler/ko that referenced this issue May 17, 2024
This restructures the build logic in order to expand the buildArgs to include:

- `Env`: the actual environment variables used to execute the build. This includes platform info (e.g. `GOOS`, `GOARCH`).
- `GoEnv`: the map of variables from `go env`, but overridden with any platform-specific values defined in `Env`.

Fixes ko-build#1301

Signed-off-by: Nathan Mittler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant