Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Gearheads
Copy link

Summary

This PR is to allow users to provide a custom krew-index repository, in case they do not wish to upload to the public krew-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 custom krew-index repository, and create a PR against that default branch. Just in case the custom krew-index repository does not use the master 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. 😄

@@ -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")
Copy link
Owner

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")
Copy link
Owner

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)
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants