From d75b47b86e976c85b14772c8a56c1c162cd7c56a Mon Sep 17 00:00:00 2001 From: Jesse Somerville Date: Sun, 9 May 2021 23:24:04 -0400 Subject: [PATCH] Adding plugin install auth documentation --- cmd/eiam/plugins.go | 6 +++++- docs/plugins/README.md | 35 +++++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/cmd/eiam/plugins.go b/cmd/eiam/plugins.go index 589cf11..25b253c 100644 --- a/cmd/eiam/plugins.go +++ b/cmd/eiam/plugins.go @@ -86,6 +86,10 @@ func newCmdPluginsInstall() *cobra.Command { The latest release in the provided repository is downloaded, extracted, and the binary files are moved to the "plugins" directory. + + If the plugin is hosted in a private repository, you need to provide + ephemeral-iam with a Github personal access token to authenticate + with. See 'eiam plugins auth --help' for more details. `), Args: func(cmd *cobra.Command, args []string) error { urlRegex := regexp.MustCompile(`github\.com/(?P[[:alnum:]\-]+)/(?P[[:alnum:]\.\-_]+)`) @@ -111,7 +115,7 @@ func newCmdPluginsInstall() *cobra.Command { if err := cmd.MarkFlagRequired("url"); err != nil { util.Logger.Fatal(err.Error()) } - cmd.Flags().StringVarP(&tokenName, "name", "n", "", "The name of the Github access token to use for private repos") + cmd.Flags().StringVarP(&tokenName, "token", "t", "", "The name of the Github access token to use for private repos") return cmd } diff --git a/docs/plugins/README.md b/docs/plugins/README.md index 8783eed..83493ee 100644 --- a/docs/plugins/README.md +++ b/docs/plugins/README.md @@ -10,10 +10,41 @@ To install a plugin, you just place the plugin's binary in that directory and If the plugin you want to install is hosted in a Github repo and the binary is published as a release in the repository, you can install the plugin using the -`eiam plugin install` command: +`eiam plugins install` command: ``` -$ eiam plugin install --url github.com/user/repo-name +$ eiam plugins install --url github.com/user/repo-name +``` + +### Plugin stored in a private repository +If the plugin is hosted in a private repository, you need to provide `ephemeral-iam` +with a Github personal access token to authenticate with. You can use the +`eiam plugins auth` commands to add, list, and remove these access tokens. + +**Add tokens:** +``` +$ eiam plugins auth add --name "personal-token" +INFO Adding token with the name personal-token +✔ Enter your Github Personal Access Token: : ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● + +$ eiam plugins auth add --name "organization-token" +INFO Adding token with the name organization-token +✔ Enter your Github Personal Access Token: : ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● +``` + +**List tokens:** +``` +$ eiam plugins auth list + + GITHUB ACCESS TOKENS +---------------------- +personal-token +organization-token +``` + +**Install with authentication:** +``` +$ eiam plugins install --url github.com/user/repo-name --token personal-token ``` ## Developing a new plugin