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

release: support OCI image pullspecs #75

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
Changes:

- Bump minimum supported Go version to 1.22
- Add `Arch.OciImage` field to release metadata containing base OS OCI image
- Add `OciImages` field to release index containing base OS OCI images

## stream-metadata-go 0.4.4 (2023-11-28)

Expand Down
6 changes: 5 additions & 1 deletion release/fixtures/fcos-release.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,11 @@
}
}
},
"commit": "cad80088392fe43bd3cadf0481c3267f199afa7d9f83bc03937ffdbf5ebbc6da"
"commit": "cad80088392fe43bd3cadf0481c3267f199afa7d9f83bc03937ffdbf5ebbc6da",
"oci-image": {
"image": "quay.io/fedora/fedora-coreos:stable",
"digest-ref": "quay.io/fedora/fedora-coreos@sha256:460576931cf4ce59afe432ea266234f9d34fa77f8ca3087282084bc3a7324632"
jlebon marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
}
7 changes: 7 additions & 0 deletions release/fixtures/fcos-releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
"checksum": "113aa27efe1bbcf6324af7423f64ef7deb0acbf21b928faec84bf66a60a5c933"
}
],
"oci-images": [
{
"architecture": "x86_64",
jlebon marked this conversation as resolved.
Show resolved Hide resolved
"image": "quay.io/fedora/fedora-coreos:stable",
"digest-ref": "quay.io/fedora/fedora-coreos@sha256:460576931cf4ce59afe432ea266234f9d34fa77f8ca3087282084bc3a7324632"
}
],
"version": "31.20200108.3.0",
"metadata": "https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/31.20200108.3.0/release.json"
},
Expand Down
14 changes: 11 additions & 3 deletions release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ type Index struct {

// IndexRelease is a "release pointer" from a release index
type IndexRelease struct {
Commits []IndexReleaseCommit `json:"commits"`
Version string `json:"version"`
MetadataURL string `json:"metadata"`
Commits []IndexReleaseCommit `json:"commits"`
OciImages []IndexReleaseOciImage `json:"oci-images,omitempty"`
Version string `json:"version"`
MetadataURL string `json:"metadata"`
}

// IndexReleaseCommit describes an ostree commit plus architecture
Expand All @@ -30,6 +31,12 @@ type IndexReleaseCommit struct {
Checksum string `json:"checksum"`
}

// IndexReleaseOciImages describes a pullspec plus architecture
type IndexReleaseOciImage struct {
ContainerImage
Architecture string `json:"architecture"`
}

// Release contains details from release.json
type Release struct {
Release string `json:"release"`
Expand All @@ -46,6 +53,7 @@ type Metadata struct {
// Arch release details
type Arch struct {
Commit string `json:"commit"`
OciImage *ContainerImage `json:"oci-image,omitempty"`
Media Media `json:"media"`
RHELCoreOSExtensions *relrhcos.Extensions `json:"rhel-coreos-extensions,omitempty"`
}
Expand Down
4 changes: 4 additions & 0 deletions release/release_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ func TestParseFCR(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, release.Stream, "stable")
assert.Equal(t, release.Architectures["x86_64"].Media.Aws.Images["us-east-2"].Image, usEast2Ami)
assert.Equal(t, release.Architectures["x86_64"].OciImage.Image, "quay.io/fedora/fedora-coreos:stable")
assert.Equal(t, release.Architectures["x86_64"].OciImage.DigestRef, "quay.io/fedora/fedora-coreos@sha256:460576931cf4ce59afe432ea266234f9d34fa77f8ca3087282084bc3a7324632")
}

func TestParseFCRIndex(t *testing.T) {
Expand All @@ -35,6 +37,8 @@ func TestParseFCRIndex(t *testing.T) {
assert.Equal(t, release.Version, "31.20200108.3.0")
assert.Equal(t, release.Commits[0].Architecture, "x86_64")
assert.Equal(t, release.Commits[0].Checksum, "113aa27efe1bbcf6324af7423f64ef7deb0acbf21b928faec84bf66a60a5c933")
assert.Equal(t, release.OciImages[0].Image, "quay.io/fedora/fedora-coreos:stable")
assert.Equal(t, release.OciImages[0].DigestRef, "quay.io/fedora/fedora-coreos@sha256:460576931cf4ce59afe432ea266234f9d34fa77f8ca3087282084bc3a7324632")
}

func TestTranslate(t *testing.T) {
Expand Down
Loading