Skip to content

Commit

Permalink
Adding plugin install auth documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Somerville committed May 10, 2021
1 parent 8d7c195 commit d75b47b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
6 changes: 5 additions & 1 deletion cmd/eiam/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -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<user>[[:alnum:]\-]+)/(?P<repo>[[:alnum:]\.\-_]+)`)
Expand All @@ -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
}

Expand Down
35 changes: 33 additions & 2 deletions docs/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d75b47b

Please sign in to comment.