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

Add --no-trunc to artifact ls #25182

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

baude
Copy link
Member

@baude baude commented Jan 31, 2025

added a --no-trunc flag to artifact ls, which follows what images has done. by default now, the ls output will have the shortened 12 character digest. the --no-trunc will output the full digest.

Does this PR introduce a user-facing change?

Added `no-trunc` option to artifact ls and shortened digests in default ls output to 12 characters.

@openshift-ci openshift-ci bot added release-note approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 31, 2025
@baude baude added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. release-note labels Jan 31, 2025
@baude
Copy link
Member Author

baude commented Jan 31, 2025

im going to add some tests here still

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 31, 2025
@baude
Copy link
Member Author

baude commented Jan 31, 2025

ok, tests added

@baude baude removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 31, 2025

artifactHash := artifactDigest.Encoded()
// If the user does not want truncated hashes
formatHash := func() string {
Copy link
Member

Choose a reason for hiding this comment

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

Not sure why we would need to define a extra function here.

if !listFlag.noTrunc {
	artifactHash = artifactHash[0:12]
}

This would do the same thing without an extra function call.

Copy link
Member Author

Choose a reason for hiding this comment

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

i meant to delete line 101.

Copy link
Member Author

Choose a reason for hiding this comment

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

reverted ... i felt funny about the fact that having a conditional check on something that was by default ... but i inverted the logic a tad, see how you like it.

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

Copy link
Contributor

openshift-ci bot commented Jan 31, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: baude, Luap99

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

@mheon
Copy link
Member

mheon commented Jan 31, 2025

I want to cherry-pick this into 5.4 if nobody minds. Technically a feature but small enough that I think it makes sense to make the change as early as possible and not have people live with a slightly different format until 5.5 comes out

@mheon
Copy link
Member

mheon commented Jan 31, 2025

LGTM but needs a rebase

added a --no-trunc flag to artifact ls, which follows what images has
done.  by default now, the ls output will have the shortened 12
character digest.  the --no-trunc will output the full digest.

Signed-off-by: Brent Baude <[email protected]>
@mheon
Copy link
Member

mheon commented Jan 31, 2025

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 31, 2025
@mheon
Copy link
Member

mheon commented Jan 31, 2025

/cherry-pick v5.4
We can discuss if we want this in the cherry-pick PR

@openshift-cherrypick-robot
Copy link
Collaborator

@mheon: once the present PR merges, I will cherry-pick it on top of v5.4 in a new PR and assign it to you.

In response to this:

/cherry-pick v5.4
We can discuss if we want this in the cherry-pick PR

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-merge-bot openshift-merge-bot bot merged commit b06d786 into containers:main Jan 31, 2025
80 checks passed
@openshift-cherrypick-robot
Copy link
Collaborator

@mheon: #25182 failed to apply on top of branch "v5.4":

Applying: Add --no-trunc to artifact ls
Using index info to reconstruct a base tree...
M	docs/source/markdown/.gitignore
M	test/e2e/artifact_test.go
Falling back to patching base and 3-way merge...
Auto-merging test/e2e/artifact_test.go
Auto-merging docs/source/markdown/.gitignore
CONFLICT (content): Merge conflict in docs/source/markdown/.gitignore
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Add --no-trunc to artifact ls

In response to this:

/cherry-pick v5.4
We can discuss if we want this in the cherry-pick PR

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants