-
Notifications
You must be signed in to change notification settings - Fork 3
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
plugin: add gh cli to vela-git #975
Comments
I'm okay with the baby steps approach. Add in the CLI pkg and let the user figure out how to get the token in there for now. Maybe someone will come along and add netrc support in cli/cli#288 or Vela or this plugin can provision an envvar secret or build the gh-compatible config at runtime. |
This is baby steps toward go-vela/community#975. Getting credentials in place remains an exercise left to the consumer.
I think it might be possible to write a simple netrc -> gh hosts.yaml converter.
git.mycompany.com:
user: myusername
oauth_token: gho_0000000000000000000
git_protocol: https
users:
myusername:
oauth_token: gho_0000000000000000000 https://pkg.go.dev/golang.org/x/tools/cmd/auth/netrcauth provides a netrc impl, could spit out the YAML without much fuss. Could include it as a separate tool or a subcommand of vela-git, invocable like: steps:
- name: Convert netrc to gh yaml
image: target/vela-git:latest
commands:
# subcommand
- vela-git convert-netrc-to-gh-hosts
# helper script
- convert-netrc-to-gh-hosts
- name: Do stuff with gh
image: target/vela-git:latest
commands:
# subcommand
- gh pr list |
A S.O. question on handling the netrc parsing: |
I polished up something for myself: colindean/hejmo@0062264 |
Description
it would be sweet if users could automatically interact with git using
gh
the official cli.we can add it to the plugin, meaning, throw in a
gh
installation into the Dockerfile and call it goodhttps://github.com/go-vela/vela-git/blob/main/Dockerfile#L19
but i dont think
gh
supports using the netrc forgh auth login
so it likely wont work "out of the box" for users unless they provide a PATcli/cli#288
cli/cli#3623
so... if we figure out auth, or move Vela away from netrc then this will be easier.
or we can just install
gh
and let users figure that out on their own, but i dont think thats the best user experience. personally, i would expect it to "just work".The text was updated successfully, but these errors were encountered: