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 repository to the credentials prompt #2596

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

gauron99
Copy link
Contributor

@gauron99 gauron99 commented Nov 25, 2024

Added repository value (now it is registry/repository) to prompt for credentials where its used for printing out tto terminal "during the prompt" to make it easier for the user to see what he is trying to provide credentials for.

Additionally I have created a new issue that is a followup to this and its' purpose is to further optimize this "credentials" process

fix #2562

Copy link

knative-prow bot commented Nov 25, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@knative-prow knative-prow bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 25, 2024
Copy link

knative-prow bot commented Nov 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gauron99

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

@knative-prow knative-prow bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 25, 2024
Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.

Project coverage is 65.41%. Comparing base (1dd2e43) to head (8c14882).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
cmd/prompt/prompt.go 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2596      +/-   ##
==========================================
+ Coverage   64.14%   65.41%   +1.26%     
==========================================
  Files         130      130              
  Lines       15513    15515       +2     
==========================================
+ Hits         9951    10149     +198     
+ Misses       4623     4389     -234     
- Partials      939      977      +38     
Flag Coverage Δ
e2e-test 35.81% <11.11%> (-0.02%) ⬇️
e2e-test-oncluster 32.88% <11.11%> (+0.06%) ⬆️
e2e-test-oncluster-runtime 28.64% <11.11%> (?)
e2e-test-runtime-go 26.44% <11.11%> (?)
e2e-test-runtime-node 25.85% <11.11%> (?)
e2e-test-runtime-python 25.85% <11.11%> (?)
e2e-test-runtime-quarkus 26.00% <11.11%> (?)
e2e-test-runtime-rust 24.93% <11.11%> (?)
e2e-test-runtime-springboot 24.96% <11.11%> (?)
e2e-test-runtime-typescript 25.96% <11.11%> (?)
integration-tests 51.92% <33.33%> (+2.24%) ⬆️
unit-tests 50.92% <88.88%> (?)
unit-tests-macos-latest ?
unit-tests-ubuntu-latest ?
unit-tests-windows-latest ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

)

type CredentialsCallback func(registry string) (docker.Credentials, error)
type CredentialsCallback func(f fn.Function, registry string) (docker.Credentials, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

@gauron99 I do not see any reason for adding fn.Function here. The registry parameter is completely sufficient.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

fmt.Fprintf(out, "Incorrect credentials for registry '%s'. Please make sure the registry is correct and try again.\n", registry)

Copy link
Contributor Author

@gauron99 gauron99 Nov 25, 2024

Choose a reason for hiding this comment

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

it is so that I can provide the image name and print it out, making it more obvious what are the credentials "used for". the registry is just the docker.io part

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I thought that registry also included project/namespace something like docker.io/johndoe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will clean it up a bit, wait. I will ping you when its ready

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 26, 2024
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 26, 2024
Signed-off-by: David Fridrich <[email protected]>
Signed-off-by: David Fridrich <[email protected]>
Signed-off-by: David Fridrich <[email protected]>
@gauron99
Copy link
Contributor Author

@matejvasek what about this. I have changed the sole argument that needed it. Added a repository to it so now it is displayed when the prompt asks you for your credentials when trying to 'push' WITH the actual 'registry/repository'
Althought I had to change the prompt tests to reflect this as well

@gauron99 gauron99 changed the title add full image name to the credentials prompt output add repository to the credentials prompt Nov 27, 2024
@matejvasek
Copy link
Contributor

@gauron99

what about this. I have changed the sole argument that needed it.

This seems reasonable. Just call it repository instead of overly verbose registryWithRepo.

IMO that how our flag should have been called: instead of --registry we should have had --repository or --img-reposotry.

@knative-prow-robot
Copy link

PR needs rebase.

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.

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 28, 2024
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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong error message when login to OCI registry interactively.
3 participants