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

Fix panic in manifest annotate --index #24776

Merged
merged 2 commits into from
Dec 9, 2024

Conversation

nalind
Copy link
Member

@nalind nalind commented Dec 5, 2024

When the --index flag is used, manifest annotate shouldn't be expecting a second non-flag argument.
Fixes #24750.

Does this PR introduce a user-facing change?

`podman manifest annotate` no longer panics when the `--index` flag is used.

Comment on lines 388 to 389
Expect(session.OutputToString()).To(ContainSubstring(`"hello": "world,withcomma"`))
Expect(session.OutputToString()).To(ContainSubstring(`"left": "right"`))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't both annotation are set on different levels? I feel like such a test must make sure they are set in the correct places not just that they exists anywhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they are. Reworked the comparison logic.

@nalind nalind force-pushed the manifest-annotate-index branch from 03eea16 to 45a4edf Compare December 5, 2024 18:44
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, test looks really good with that but one nit where we should resuse the digest var to avoid duplicating that

{
// from imageListInstance
MediaType: manifest.DockerV2Schema2MediaType,
Digest: digest.Digest("sha256:1385ce282f3a959d0d6baf45636efe686c1e14c3e7240eb31907436f7bc531fa"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to not duplicate this needs to use imageListARM64InstanceDigest

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to parse it from the name that we use when adding it to the index.

@nalind nalind force-pushed the manifest-annotate-index branch from 45a4edf to a28d167 Compare December 5, 2024 19:17
@Luap99
Copy link
Member

Luap99 commented Dec 6, 2024

Looks like --index doesn't work with podman-remote at all. At least tests seem failing and I cannot see any use of opts.IndexAnnotations in the remote client bindings.

@nalind nalind force-pushed the manifest-annotate-index branch from a44a559 to f1204b7 Compare December 6, 2024 18:38
@github-actions github-actions bot added the kind/api-change Change to remote API; merits scrutiny label Dec 6, 2024
When the --index flag is used, `manifest annotate` shouldn't be
expecting a second non-flag argument.

Signed-off-by: Nalin Dahyabhai <[email protected]>
Add the connective logic so that annotating the manifest as a whole will
succeed as intended, and we don't mix up annotations for an entry and
annotations which are meant for the manifest as a whole.  Make
consistent the names which are used when encoding values of certain
fields.

Signed-off-by: Nalin Dahyabhai <[email protected]>
@nalind nalind force-pushed the manifest-annotate-index branch 2 times, most recently from fcbeb1e to 0a48856 Compare December 6, 2024 22:50
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 9, 2024
@rhatdan
Copy link
Member

rhatdan commented Dec 9, 2024

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 9, 2024
Copy link
Contributor

openshift-ci bot commented Dec 9, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99, nalind, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 7ad3358 into containers:main Dec 9, 2024
81 checks passed
@nalind nalind deleted the manifest-annotate-index branch December 9, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/api-change Change to remote API; merits scrutiny lgtm Indicates that a PR is ready to be merged. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman manifest annotate --index panics with panic: runtime error: index out of range [1] with length 1
3 participants