-
-
Notifications
You must be signed in to change notification settings - Fork 18
feat(releaser): add support for custom krew index repo #76
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
base: main
Are you sure you want to change the base?
Conversation
pkg/krew/repos.go
Outdated
| //GetKrewIndexRepoName returns the krew-index repo name | ||
| func GetKrewIndexRepoName() string { | ||
| override := os.Getenv("UPSTREAM_KREW_INDEX_REPO_NAME") | ||
| override := os.Getenv("INPUT_UPSTREAM_KREW_INDEX_REPO_NAME") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code actually runs on server side (IIRC), and do not have access to the GitHub inputs. what we will have to do is to accept this input, and then pass along this info to the backend as part of request.
the backend then needs to consider 3 scenarios:
- The override configured on server side. this should take preference over GitHub action input and defaults, as this helps with testing the server.
- The override configured as part of GitHub action (if no override provided on server side)
- The default values. (if no override provided at all)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @rajatjindal, thank you so much for the feedback! I have implemented the changes, and the PR should now be updated.
Please let me know if anything else needs to be changed, or if I am missing anything. 😄
pkg/krew/repos.go
Outdated
| //GetKrewIndexRepoOwner returns the krew-index repo owner | ||
| func GetKrewIndexRepoOwner() string { | ||
| override := os.Getenv("UPSTREAM_KREW_INDEX_REPO_OWNER") | ||
| override := os.Getenv("INPUT_UPSTREAM_KREW_INDEX_REPO_OWNER") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
pkg/releaser/git.go
Outdated
| ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: r.Token}) | ||
| tc := oauth2.NewClient(context.TODO(), ts) | ||
| client := github.NewClient(tc) | ||
| client := getGitHubClient(r.Token) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe have a client on Releaser object and just reuse that instead of creating here and in clonerepo function.
also it seems like could needs indentation.
Thank you @rajatjindal for the feeback. I have made a few changes based on that feeback. Some of the updates are listed below: - updated Releaser object to have a client - add logic to accept custom krew-index input through GitHub Action - add logic to pass input to the backend server as part of the request - add precedence for krew-index values with server side override having highest priority - ran "go fmt ./..." - ran "go vet ./..." Signed-off-by: Casale, Robert <[email protected]>
8658a41 to
92c9833
Compare
|
Hi @rajatjindal, apologies to bother you, just checking in to see if you have some time to review the updates I made based on your feedback? Thank you again for your time, and effort. 😄 |
Hi @Gearheads this is still on my mind. Apologies for the delay. I will get this tested/reviewed tomorrow. |
|
|
||
| // GetKrewIndexRepoName gets upstream_krew_index_repo_name | ||
| func (p *Provider) GetKrewIndexRepoName() string { | ||
| nameInput := getInputForAction("UPSTREAM_KREW_INDEX_REPO_NAME") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be consistent with other places, we should keep it same as the input as defined in action.yml, so kindly change it to upstream_krew_index_repo_name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no problem. I will update the fields to be lowercase.
|
Hi @Gearheads Thank you for your patience while we review this through. tl;dr; For custom index to work, you need following changes:
AND
Detailed description: To clarify a few things, I want to write down my thoughts on how this should work and I would love to hear your thoughts if you think some (or all) of it does not make sense. krew-release-bot has two components:
For custom index scenario, thinking out loud. Lets say we have plugin at As a next step, the actions would now submit this request to the server side code. Now there are a couple of things to consider here:
so I think we need following changes for this to work:
|
|
I am also happy to pair on this and get this working for you. (and in the process we can fix any issues that we might encounter). also happy to chat on CNCF (or Kubernetes) slack regarding this. Please feel free to DM me there. |
hi @rajatjindal, apologies for the delayed response. Does this mean we need to run our own I believe our custom plugin repo is currently public: https://github.com/fidelity/krew-index I was hoping that changing the Krew index repo would be enough. What you mentioned here is what I was originally thinking of doing within our GitHub Action YAML definition:
|
Summary
This PR is to allow users to provide a custom
krew-indexrepository, in case they do not wish to upload to the publickrew-indexrepository.The goal is to allow users to provide the custom
krew-indexrepository information through two new parameters:upstream_krew_index_repo_ownerupstream_krew_index_repo_nameThe GitHub Action will then determine the
defaultbranch that is configured for the customkrew-indexrepository, and create a PR against thatdefaultbranch. Just in case the customkrew-indexrepository does not use themasterbranch.This is very helpful for organizations that are hosting their own internal
krew-indexrepositories, and allows them to automate their release cycles.Fixes
#47
Please let me know if there is anything else I might be missing. 😄