Add repository config option for private repositories #1017
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #922
What we are trying to do
Usage of private Helm repositories right now requires the credentials to be stored in the
chartfile.yaml
. This leads to issues described in the linked issue where different users usually have different credentials, and those credentials you probably don't want to commit to version control. Helm has arepositories.yaml
file that is updated when you runhelm repo add
where it stores your user-supplied credentials to any private repository. This file has a similar layout to the repositories section in thechartfile.yaml
It would be good to provide users an option to use this existing helm config file with their tanka commands to manage helm charts.
Testing
Currently you can add the chart but it has errors vendoring:
After these changes I can specify my helm config file and it works:
Questions for Discussion
2 questions I have for these changes
Is there a better way to share
repository-config
flag between theAdd
andVendor
commands? I see the log-level option uses theaddCommandsWithLogLevelOption
function, but I don't believe I can run the function through a helper function like that twice? And having a helper function that adds the repo config option and then calls that seemed weird to me.Should we try and merge the
repositories.yaml
repositories with thechartfile.yaml
repositories instead of overwriting them? I went for the simple option of just replacing the existing config with the helm config, but this does mean that if you had a mix of public and private repositories you would need to ensure thathelm repo add ...
was run on your local machine for each of the public repos. I don't think that is a huge ask for the simplicity it brings the code, but I am open to opinions if we should try to merge-with-overwrite the helm config file to our chartfile.yaml.