Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Save and reuse repo credentials for private repos #800

Closed
henriquemoraeszup opened this issue Dec 15, 2020 · 12 comments · Fixed by #986
Closed

Save and reuse repo credentials for private repos #800

henriquemoraeszup opened this issue Dec 15, 2020 · 12 comments · Fixed by #986
Assignees
Labels
🔨 improvement Improvement in features ✔️ refined ISSUE refined by the Ritchie Team stale

Comments

@henriquemoraeszup
Copy link
Contributor

henriquemoraeszup commented Dec 15, 2020

What would you like to be added:
When adding a private repo, the token is asked for every time. Ritchie could try to fetch the credential from the saved file. If there is no credential, prompt and save it

IMPORTANT: We should have a specific dedicated credential value for this token and In case a 401 is found (i.e.: user has more than 1 private repo requiring more than 1 different tokens), we should instruct the user about the fail and how he/she can proceed by either overwriting the current token or by switching to a new env

Why is this needed:
For better DevEx and so people do not need to regenerate private tokens every time they add a repo

@henriquemoraeszup henriquemoraeszup added the 🔨 improvement Improvement in features label Dec 15, 2020
@matheussn
Copy link
Contributor

hello @henriquemoraeszup, can i work on this? 😄

@GuillaumeFalourd
Copy link
Contributor

I've assigned you the issue @matheussn 👍🏼
Thanks for helping once again 🚀

@henriquemoraeszup
Copy link
Contributor Author

Sorry for the delay, please go ahead! You have been an active contributor and we appreciate it! @matheussn would you be willing to have a chat with the team next week so we get your feedback on ritchie?

@matheussn
Copy link
Contributor

Hello @henriquemoraeszup! These are my first contributions to Open Source projects. I am very happy to contribute to the project, and happier for the recognition!
And I would love to participate in this chat!

@henriquemoraeszup henriquemoraeszup added the ✔️ refined ISSUE refined by the Ritchie Team label Dec 21, 2020
@henriquemoraeszup
Copy link
Contributor Author

Wassup @matheussn! I will schedule 30min shortly. Also we have updated the user flow on the description on how this command should behave

@lucasdittrichzup
Copy link
Contributor

hello @matheussn, how are you? if you need any help i am on hand to assist in whatever is necessary.

@matheussn
Copy link
Contributor

Hi! I did an implementation, but I didn't like some details hehehe 😄
Even so, I will open the PR for you to help me

@matheussn
Copy link
Contributor

@lucasdittrichzup Currently, I'm getting the token like this:
token, err = ad.Resolve (" CREDENTIAL_ "+ provider +" -add-repo_token ")
"github-add-repo" and "gitlab-add-repo", would be the new credentials, as agreed.
As I understand it, this Resolve method is used to get information from credentials that are not necessarily listed as Ritchie" default credentials ".
Since the credentials listed above will be listed in Ritchie's "default credentials", I believe that using this method is not ideal.

I was thinking of creating a method to abstract the part of asking the user for the fields of standard credentials. Where I say "Create credential X" And regardless of the number of fields and types, he creates the structure for that credential.

Some questions:

  1. Is there already a method that does something similar?
  2. Is going this way unnecessarily excessive work, or does it make sense?

@GuillaumeFalourd
Copy link
Contributor

GuillaumeFalourd commented Jan 20, 2021

I was thinking of creating a method to abstract the part of asking the user for the fields of standard credentials. Where I say "Create credential X" And regardless of the number of fields and types, he creates the structure for that credential.

Would the set credential class help with this part @matheussn ?

@matheussn
Copy link
Contributor

Would the set credential class help with this part @matheussn ?

Yes, the idea would be to abstract the user input part of that class, so that I could use it in the add repo command. And don't use the Resolve method, since in the set credential class I would also be able to create the "github-add-repo" and "gitlab-add-repo" credentials.

@GuillaumeFalourd
Copy link
Contributor

GuillaumeFalourd commented Jan 20, 2021

There is the runStdin() method in that class that could work informing the input parameters directly. But the stdin method is deprecated as everything will migrate to the input flag method, as used for formulas.

@brunasilvazup brunasilvazup linked a pull request Jan 27, 2021 that will close this issue
@stale
Copy link

stale bot commented Mar 21, 2021

This issue has been automatically marked as stale because it hasn't had any activity in 60 days. It will be closed in 7 days if no further activity occurs (e.g. changing labels, comments, commits, etc.). Please feel free to tag a maintainer and ask them to remove the label if you think it doesn't apply. Thank you for submitting this issue and helping make Ritchie a better product!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 improvement Improvement in features ✔️ refined ISSUE refined by the Ritchie Team stale
Projects
None yet
4 participants