Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

kam should use Github push API instead of git push command #128

Open
iam-veeramalla opened this issue Dec 28, 2020 · 7 comments
Open

kam should use Github push API instead of git push command #128

iam-veeramalla opened this issue Dec 28, 2020 · 7 comments
Labels
kind/enhancement New feature or request

Comments

@iam-veeramalla
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
kam can make use of the github push api to push the files/folders it creates when --push-to-git=true flag is enabled. Right now, User has to add his public key to github account.

if out, err := e.execute(o.OutputPath, "git", "push", "-u", "origin", "main"); err != nil {

Describe the solution you'd like
Use the Github Push API.
https://docs.github.com/en/free-pro-team@latest/graphql/reference/objects#push

Describe alternatives you've considered
Its not a blocker as user can still get the things done by adding his public key to github account.

Additional context
Issue:

if out, err := e.execute(o.OutputPath, "git", "push", "-u", "origin", "main"); err != nil {

Solution towards the Issue:
https://docs.github.com/en/free-pro-team@latest/graphql/reference/objects#push

@amitkrout amitkrout added the kind/enhancement New feature or request label Dec 29, 2020
@bigkevmcd
Copy link
Contributor

The biggest problem with this, is that we'd need to implement more functionality from git into the kam binary (probably using go-git).

We'd need the equivalent of git push and the various options that uses, and probably functionality around getting to the git hosting service (proxy configuration).

@iam-veeramalla
Copy link
Collaborator Author

The motive behind raising this issue is to understand , if we can make kam more API friendly. For example, instead of using git push can we use the equivalent API from git Providers(Github, BitBucket and more).

Something like this:

curl -i -X PUT -H ‘Authorization: token xxxx’ -d
‘{“message”: “push gitops files”,
“content”:”application/json”
}’ https://api.github.com/repos/gitops/test-appliation

However, the obvious downside is to deal with the different APIs from git providers.

@bigkevmcd
Copy link
Contributor

bigkevmcd commented Jan 18, 2021

The biggest problem tho', is that users would need to replace their use of git with kam for most git operations?

We'd need to implement functionality for at least the following git actions.

  • git push
  • git pull
  • git diff with an upstream branch
  • git fetch

I'm not sure there's any benefit in using the API, over using something like go-git, but authenticating with a token.

But, replacing git with kam doesn't really feel like something we should be doing?

@iam-veeramalla
Copy link
Collaborator Author

The biggest problem tho', is that users would need to replace their use of git with kam for most git operations?

We'd need to implement functionality for at least the following git actions.

  • git push
  • git pull
  • git diff with an upstream branch
  • git fetch

I'm not sure there's any benefit in using the API, over using something like go-git, but authenticating with a token.

But, replacing git with kam doesn't really feel like something we should be doing?

@bigkevmcd I was only talking about replacing git push , I agree that we should not replace git with kam for any other use cases.

@bigkevmcd
Copy link
Contributor

But if we only replace git push, what about the other use-cases?

Can you maybe explain the benefits of only replacing git push?

@iam-veeramalla
Copy link
Collaborator Author

But if we only replace git push, what about the other use-cases?

Can you maybe explain the benefits of only replacing git push?

I haven't explored the code completely kevin, I will take some time on this today and comment.

@bigkevmcd
Copy link
Contributor

@iam-veeramalla can you maybe update with the results of your explorations?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants