Skip to main content

libcnb/
target.rs

1#[derive(Clone, Debug)]
2pub struct Target {
3    /// The name of the target operating system.
4    ///
5    /// The value should conform to [Go's `$GOOS`](https://golang.org/doc/install/source#environment), for example
6    /// `linux` or `windows`.
7    ///
8    /// CNB `lifecycle` sources this value from the run OCI image's [`os` property](https://github.com/opencontainers/image-spec/blob/main/config.md#properties).
9    pub os: String,
10    /// The name of the target CPU architecture.
11    ///
12    /// The value should conform to [Go's $GOARCH](https://golang.org/doc/install/source#environment), for example
13    /// `amd64` or `arm64`.
14    ///
15    /// CNB `lifecycle` sources this value from the run OCI image's [`architecture` property](https://github.com/opencontainers/image-spec/blob/main/config.md#properties).
16    pub arch: String,
17    /// The variant of the specified CPU architecture.
18    ///
19    /// 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
20    /// `v7` or `v8`.
21    ///
22    /// CNB `lifecycle` sources this value from the run OCI image's [`variant` property](https://github.com/opencontainers/image-spec/blob/main/config.md#properties).
23    pub arch_variant: Option<String>,
24    /// The name of the operating system distribution. Should be empty for Windows.
25    ///
26    /// For example: `ubuntu` or `alpine`.
27    ///
28    /// CNB `lifecycle` sources this value from either:
29    /// 1. The `io.buildpacks.base.distro.name` OCI image label, if set on the run image.
30    /// 2. Or else, the `ID` field of the `/etc/os-release` file in the build image.
31    pub distro_name: String,
32    /// The version of the operating system distribution.
33    ///
34    /// For example: `22.04` or `3.19`.
35    ///
36    /// CNB `lifecycle` sources this value from either:
37    /// 1. The `io.buildpacks.base.distro.version` OCI image label, if set on the run image.
38    /// 2. Or else, the `VERSION_ID` field of the `/etc/os-release` file in the build image.
39    pub distro_version: String,
40}