-
-
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
Signed-off-by: Casale, Robert <[email protected]>
@@ -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)
@@ -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
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.
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. 😄