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

Support automatic GitHub Packages permissions with platform token #17705

Closed
rarkins opened this issue Sep 8, 2022 · 10 comments · Fixed by #18926 or #25214
Closed

Support automatic GitHub Packages permissions with platform token #17705

rarkins opened this issue Sep 8, 2022 · 10 comments · Fixed by #18926 or #25214
Assignees
Labels
platform:github GitHub Platform priority-2-high Bugs impacting wide number of users or very important features status:in-progress Someone is working on implementation type:feature Feature (new functionality)

Comments

@rarkins
Copy link
Collaborator

rarkins commented Sep 8, 2022

What would you like Renovate to be able to do?

The Renovate App currently doesn't ask for Packages permissions:
image

Before we ask for that permission (which will trigger a lot of permission notification emails) I want to make sure it works, ideally for both github.com and self-hosted GHES at the same time.

For github.com, it seems like *.pkg.github.com and ghcr.io are the relevant hosts which users would like to work. Do github tokens typically work for both? e.g. can we assume that if we have a github.com token it also might be valid for ghcr.io too?

If you have any ideas on how this should be implemented, please tell us here.

Might need addition of new hostRules as part of initPlatform()

Is this a feature you are interested in implementing yourself?

Maybe

@rarkins rarkins added type:feature Feature (new functionality) priority-2-high Bugs impacting wide number of users or very important features status:requirements Full requirements are not yet known, so implementation should not be started labels Sep 8, 2022
@mbrevda
Copy link

mbrevda commented Sep 8, 2022

can we assume that if we have a github.com token it also might be valid for ghcr.io too?

The docs would seem to indicate that yes (unless they are referring to Actions only?)

@mbrevda
Copy link

mbrevda commented Dec 20, 2022

Should this be reopened in the meantime?

@viceice viceice reopened this Dec 20, 2022
@fhaertig
Copy link

fhaertig commented May 12, 2023

Hi, I'm wondering what the actual status of this is right now, since the relevant feature apparently was merged, reverted and merged again. Should this work now for the Github hosted renovate app (mend)? Because I'm unable to find a valid configuration for checking images hosted on ghcr.io, pushed from a private repository. I tried with/without username, with/without explicitly added PAT (encrypted) and with packageRules only.

Thanks in advance!

@PhilipAbed
Copy link
Collaborator

we rolled back the changes after some flows failed because of this feature.
it's hard to support automatic authentication with current design, it has big impact.

if you set the right packageRules configurations manually it should work fine, but this is not the place to ask such a question try in discussions and we may help you.

@rarkins rarkins removed the status:requirements Full requirements are not yet known, so implementation should not be started label Oct 1, 2023
@rarkins
Copy link
Collaborator Author

rarkins commented Oct 4, 2023

The app now requests read-only access to Packages:

image

However Renovate still doesn't apply a package rule automatically for this.

Looking at GHCR docs:

image

I think this implies:

  • Username is kind of ignored
  • Token is used as password

I wonder in that case if we can automatically create a hostRule which reuses the same token passed to initToken and set matchHost=ghcr.io, hostType=docker, username=USERNAME, password=

@rarkins rarkins added the status:requirements Full requirements are not yet known, so implementation should not be started label Oct 4, 2023
@rarkins
Copy link
Collaborator Author

rarkins commented Oct 4, 2023

Working on #25016 for ghcr.io first

@rarkins rarkins self-assigned this Oct 12, 2023
@rarkins
Copy link
Collaborator Author

rarkins commented Oct 12, 2023

Rubygems

From https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-rubygems-registry

image

So it looks like we'd need to configure a username/password hostRules entry.

npm

From https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry

image

So this looks like Basic auth with a token hostRules entry

Maven

From https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry

image

So this looks like Rubygems - username/password

NuGet

From https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry

image

So this also appears to be username/password

@rarkins
Copy link
Collaborator Author

rarkins commented Oct 12, 2023

To keep this simple, we can perhaps configure a username/password hostRules entry for pkg.github.com and then a Basic token hostRules entry for npm.pkg.github.com and check if that works.

@rarkins rarkins added platform:github GitHub Platform and removed status:requirements Full requirements are not yet known, so implementation should not be started labels Oct 12, 2023
@rarkins rarkins added the status:in-progress Someone is working on implementation label Oct 15, 2023
@rarkins
Copy link
Collaborator Author

rarkins commented Oct 15, 2023

PR: #25214

@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 37.25.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2023
@viceice viceice reopened this Apr 10, 2024
@renovatebot renovatebot unlocked this conversation Apr 10, 2024
@viceice viceice closed this as completed Apr 10, 2024
@renovatebot renovatebot locked and limited conversation to collaborators Apr 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform:github GitHub Platform priority-2-high Bugs impacting wide number of users or very important features status:in-progress Someone is working on implementation type:feature Feature (new functionality)
Projects
None yet
7 participants