-
Notifications
You must be signed in to change notification settings - Fork 24
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: build and push image index #81
Conversation
Hi @codingben it is a good start, feel free to tell me if I can provide any help, I will review and verify the PR once the draft have done. |
Thanks a lot, it's really appreciated and helpful. I'll keep you updated once we have something to review here. |
806f88e
to
fcad9d7
Compare
@0xFelix What do you think about just implementing image index functionality here, to push it via existing pipelines, and then open another PR to add arm64 image manifests? |
IMO you can do it in a single PR, until then let's stick to our simple manifest without indexes. |
a4f4ac8
to
2ffb72a
Compare
Hi @0xFelix, it's ready to be reviewed. I'll run local tests now. After it, I'll work on adding arm64 images (in another commit in this PR). |
@@ -100,7 +104,7 @@ func gatherArtifacts(registry *[]Entry, gatherers []api.ArtifactsGatherer) { | |||
} else { | |||
for i := range artifacts { | |||
*registry = append(*registry, Entry{ | |||
Artifact: artifacts[i], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That still looks wrong. The gatherer needs to return artifacts with multiple architectures and this loop needs to append them to the registry. (Artifacts: artifacts[i]
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you reviewed old revision. This is how it looks like today:
func gatherArtifacts(registry *[]Entry, gatherers []api.ArtifactsGatherer) {
for _, gatherer := range gatherers {
artifacts, err := gatherer.Gather()
if err != nil {
logrus.Warn("Failed to gather artifacts", err)
} else {
for i := range artifacts {
*registry = append(*registry, Entry{
Artifacts: []api.Artifact{artifacts[0][i]},
UseForDocs: i == 0,
UseForLatest: i == 0,
})
}
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed the "left" side. The new is still wrong, since like this it probably run out of range. i
is a range over the outer slice and you use it to access the inner slice. The artifacts
returned by the gatherer should be [][]api.Artifact, then you can set each outer slice item as []api.Artifact in the loop below with artifacts[i]
. IMO the gatherer should construct the multi-arch Artifact already. Like this you end up with a separate artifact for each architecture and version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah got it, thanks Felix! :)
It seems like it's producing and pushing OCI image index, but the container registry locally shows it as Docker schema and not OCI. I'm trying to push the image index to Quay directly, but there is an error of unauthorized access to Quay during running Medius (either Seems like |
@0xFelix Can you please check if you tried to push an image index, or just single image manifest? Because I'm getting an unauthorized error when trying to push a new image index to Quay. |
@0xFelix I can confirm that I was able to push image index, the issue was that it required to run Medius with |
IMO this is very specific to Mac OS on which you are running medius on. Mac OS is known to deny access to files in the home directory if not explicitly allowed. |
This PR is affected by this issue: containers/podman#22196 - We're not able to pull OCI image index via Podman, only Docker works correctly. |
c39ddf6
to
62c2f39
Compare
@0xFelix I've tested push to local registry and promote it from there to Quay container registry - It works without issues:
Also
|
/unhold It works now - I've tested changes locally by pushing and promoting it to Quay container registry. Thanks @0xFelix :) |
Unit tests should work now. Forgot to update |
Push an image index to have multiple image manifests, instead of single image manifest when needed. Jira-Url: https://issues.redhat.com/browse/CNV-38597 Signed-off-by: Ben Oukhanov <boukhanov@redhat.com>
Empty image sets Docker manifest schema and not OCI. Image manifests included in OCI image index, and to keep consistency all of them should have Docker media types. Signed-off-by: Ben Oukhanov <boukhanov@redhat.com>
Thanks @codingben, to me it looks good! @ksimon1 can you give this a final review please? |
/test pull-containerdisks-test |
@zhlhahaha Hi, can you please review? we're missing |
/lgtm |
/lgtm |
What this PR does / why we need it:
Push an image index to have multiple image manifests, instead of single image manifest when needed.
Jira-Url: https://issues.redhat.com/browse/CNV-38597
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #80
Release note: