-
Notifications
You must be signed in to change notification settings - Fork 393
Description
Overview
I am looking for some initial implementation feedback on supporting private GitHub repository releases as well as a few other potential artifact repositories.
The intent here is to support some way of running custom commands, which return an artifact file via stdout. This could solve #684 by running something like gh api -H Accept:application/octet-stream /repos/kubernetes-sigs/krew/releases/assets/55894121 to download artifacts from a private GitHub repo's release assets. It could also allow people to have their on private krew indexes which rely upon local machine tooling to get the artifacts. I'm thinking example commands like aws s3 cp s3://my-fancy-private-bucket/my-cool-krew-plugin.tgz -. This type of support could separate the concerns of auth to the local machine running the installation.
I initially wanted to implement this as an S3 SDK scheme but decided it would be better to enable more options via running commands on the local machine. Happy to discuss alternative approaches here too.
Early feedback request on the design
Keep in mind my testing and work is pretty rough and just an initial concept.
-
Should this implementation bloat the
urispec key to support other "schemes" (such asfile://andcmd://) or should it really be a separate key in the plugin manifest spec? (Providing string likecmd://run-my-super-sweet-script -i thing -o otherthingjust feels kinda not ideal.) -
Should this leverage temp files on the file system to "buffer" the stdout from the "artifact download command"? I initially attempted to use
exec.Command()andexec.Command().Stdout()but hit issues with the pipe closing before the stream could be read (appears to be howexec.Command()is intended to function). -
Is this introducing too much of a security risk, allowing manifests to effectively execute arbitrary code via krew when installing plugins?
Below is an example plugin manifest using this PR to give an example of how this is written right now.
apiVersion: krew.googlecontainertools.github.com/v1alpha2
kind: Plugin
metadata:
name: testfile
spec:
version: "v0.0.1"
homepage: https://somedomain.com/
shortDescription: Throwin testfiles
caveats: |
Something something testfile
platforms:
- uri: cmd://gh api -H Accept:application/octet-stream /repos/kubernetes-sigs/krew/releases/assets/55894121
sha256: 5df32eaa0e888a2566439c4ccb2ef3a3e6e89522f2f2126030171e2585585e4f
bin: testfile
files:
- from: ./krew-linux_amd64
to: testfile
selector:
matchExpressions:
- key: "os"
operator: "In"
values:
- linux
- darwin