-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat(releaser): add support for custom krew index repo #76
base: main
Are you sure you want to change the base?
Conversation
pkg/krew/repos.go
Outdated
@@ -9,7 +9,7 @@ const ( | |||
|
|||
//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
@@ -19,7 +19,7 @@ func GetKrewIndexRepoName() string { | |||
|
|||
//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 <robert.casale@fmr.com>
8658a41
to
92c9833
Compare
Summary
This PR is to allow users to provide a custom
krew-index
repository, in case they do not wish to upload to the publickrew-index
repository.The goal is to allow users to provide the custom
krew-index
repository information through two new parameters:upstream_krew_index_repo_owner
upstream_krew_index_repo_name
The GitHub Action will then determine the
default
branch that is configured for the customkrew-index
repository, and create a PR against thatdefault
branch. Just in case the customkrew-index
repository does not use themaster
branch.This is very helpful for organizations that are hosting their own internal
krew-index
repositories, and allows them to automate their release cycles.Fixes
#47
Please let me know if there is anything else I might be missing. 😄