-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Makes the distro name/version fields non-optional (`String` instead of `Option<String>`), since (a) they will never be `None` in practice (see #820), and (b) it otherwise causes a lot of unnecessary friction for languages that have distro-version-specific binaries and need to use the metadata in multiple places in the buildpack. * Implements `Clone` and `Debug` on `Target`, which unblocks a number of use-cases, such as including the target as part of a buildpack Error enum variant. Fixes #820. GUS-W-15639138.
- Loading branch information
Showing
5 changed files
with
34 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,40 @@ | ||
#[derive(Clone, Debug)] | ||
pub struct Target { | ||
/// The name of the target operating system. | ||
/// | ||
/// The value should conform to [Go's `$GOOS`](https://golang.org/doc/install/source#environment), for example | ||
/// `linux` or `windows`. | ||
/// | ||
/// CNB `lifecycle` sources this value from the build OCI image's [`os` property](https://github.com/opencontainers/image-spec/blob/main/config.md#properties). | ||
/// CNB `lifecycle` sources this value from the run OCI image's [`os` property](https://github.com/opencontainers/image-spec/blob/main/config.md#properties). | ||
pub os: String, | ||
/// The name of the target CPU architecture. | ||
/// | ||
/// The value should conform to [Go's $GOARCH](https://golang.org/doc/install/source#environment), for example | ||
/// `amd64` or `arm64`. | ||
/// | ||
/// CNB `lifecycle` sources this value from the build OCI image's [`architecture` property](https://github.com/opencontainers/image-spec/blob/main/config.md#properties). | ||
/// CNB `lifecycle` sources this value from the run OCI image's [`architecture` property](https://github.com/opencontainers/image-spec/blob/main/config.md#properties). | ||
pub arch: String, | ||
/// The variant of the specified CPU architecture. | ||
/// | ||
/// The value should conform to [OCI image spec platform variants](https://github.com/opencontainers/image-spec/blob/main/image-index.md#platform-variants), for example | ||
/// `v7` or `v8`. | ||
/// | ||
/// CNB `lifecycle` sources this value from the build OCI image's [`variant` property](https://github.com/opencontainers/image-spec/blob/main/config.md#properties). | ||
/// CNB `lifecycle` sources this value from the run OCI image's [`variant` property](https://github.com/opencontainers/image-spec/blob/main/config.md#properties). | ||
pub arch_variant: Option<String>, | ||
/// The name of the operating system distribution. Should be empty for Windows. | ||
/// | ||
/// For example: `ubuntu` or `alpine`. | ||
/// | ||
/// CNB `lifecycle` sources this value from the build OCI image's `io.buildpacks.base.distro.name` label. | ||
pub distro_name: Option<String>, | ||
/// CNB `lifecycle` sources this value from either: | ||
/// 1. The `io.buildpacks.base.distro.name` OCI image label, if set on the run image. | ||
/// 2. Or else, the `ID` field of the `/etc/os-release` file in the build image. | ||
pub distro_name: String, | ||
/// The version of the operating system distribution. | ||
/// | ||
/// For example: `22.04` or `3.19`. | ||
/// | ||
/// CNB `lifecycle` sources this value from the build OCI image's `io.buildpacks.base.distro.version` label. | ||
pub distro_version: Option<String>, | ||
/// CNB `lifecycle` sources this value from either: | ||
/// 1. The `io.buildpacks.base.distro.version` OCI image label, if set on the run image. | ||
/// 2. Or else, the `VERSION_ID` field of the `/etc/os-release` file in the build image. | ||
pub distro_version: String, | ||
} |