-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Private Hex packages #11028
Comments
The way we prefer is to configure hostRules with token field populated. Then the artifacts updating code can search for all hostRules with matching hostType and pass them to the tool using either env, cli, or configuration file (depending on what the tool supports). npmToken is a legacy approach from when Renovate was npm-only so it's not something we'd like to model after (or we'd end up with many new options rather than a shared hostRules approach). Can you take a look at how hostRules are used in existing managers like bundler and composer and confirm if that would suit you too? It's possible that both PAT and keg tokens could be supported based on the matchHost URL |
@rarkins sounds good, thanks for the clarification on Can I take a whack at it? I've read the contributing guide and the local development guide. Anything else I should be familiar with? |
@kamilkowalski it would be wonderful if you can submit a PR! Feel free to ask back here if you encounter any decisions you need help on. We always have quite a few active PRs you can look at to get a feel of how we work, and we have a Slack developer channel too if you'd like to join. |
@rarkins I think this can be closed now? |
What would you like Renovate to be able to do?
I'd like Renovate to handle private Hex packages. We're using Renovate to maintain our services, but since we're using private Hex packages (not a self-hosted repository though) - all it can do for Elixir is to update the version range but not the lock file.
Did you already have any implementation ideas?
In Hex, private packages are hosted in a separate repository owned by an organization. One needs to sign in to each organization to be able to fetch packages from it. Hex guides on private packages suggest creating per-organization tokens to use in CI, instead of personal tokens. This means that if a project uses packages from multiple organizations's repositories, it would need multiple access tokens to be configured - one per organization. However, it's also possible to create a personal token that has access to multiple organizations.
Proposal 1: One personal Hex token or one organization
hexToken
value, similar tonpmToken
.hex
data source to use the organization name together with thehexToken
when fetching package information.mix
manager to authenticate to Hex using the token before updatingmix.lock
. The list of organizations would be taken from themix.exs
file.Limitations
The main limitation is that if a project uses packages from multiple organizations - users would need to generate a personal Hex token that allows access to repositories of all organizations used in the project. This isn't aligned with Hex guides on private packages, but it's possible to configure a token so that it has only access to those specific repositories and prevent anyone who obtained the token to impersonate the user (the repo permission is separate from API permissions) so I think it's a safe option.
On the other hand - if a project uses packages from one organization, they can simply use an organizational token. My assumption is this is the prevalent use case.
Proposal 2: Multiple organizational Hex tokens
hexTokens
dictionary that maps organization names to tokens.decryptConfig
so that it decrypts values recursively if they're objects instead of strings.hex
data source to use the organization name together with the matching token from thehexTokens
dictionary.mix
manager to authenticate to Hex using organization names and keys fromhexTokens
, before updatingmix.lock
.My suggestion
I think Proposal 1 is good enough. I don't think it's a common use case to have packages from multiple organizations in one project, and there is a safe workaround if that's the case. This avoids the need to change the
decryptConfig
function - I don't know what would be the side effects of modifying it to be recursive.Links
I'm happy to open a PR, but I might need some help testing the change.
The text was updated successfully, but these errors were encountered: