-
Notifications
You must be signed in to change notification settings - Fork 47
docs: Document registry create password stdin and interactive prompt #813
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
base: main
Are you sure you want to change the base?
Changes from all commits
82d65c0
5c5e3d4
fb40d73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| --- | ||
|
Check warning on line 1 in runpodctl/reference/runpodctl-registry.mdx
|
||
| title: "registry" | ||
| sidebarTitle: "registry" | ||
| --- | ||
|
|
@@ -39,12 +39,46 @@ | |
|
|
||
| ### Create a registry authentication | ||
|
|
||
| Create credentials for a private container registry: | ||
| Create credentials for a private container registry. Supply the password in one of three ways: | ||
|
|
||
| - Pass it directly with the `--password` flag. | ||
| - Pipe or redirect it into `--password-stdin`. | ||
| - Omit both flags to enter it at an interactive prompt. | ||
|
|
||
| Pass the password directly with `--password`: | ||
|
|
||
| ```bash | ||
| runpodctl registry create --name "docker-hub" --username "myuser" --password "mypassword" | ||
| ``` | ||
|
|
||
| Omit the password flag to have the command prompt for the password without echoing it: | ||
|
|
||
| ```bash | ||
| runpodctl registry create --name "docker-hub" --username "myuser" | ||
| ``` | ||
|
|
||
| Pipe a token held in an environment variable into `--password-stdin`: | ||
|
|
||
| ```bash | ||
| printenv REGISTRY_TOKEN | runpodctl registry create --name "docker-hub" --username "myuser" --password-stdin | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cobra Example field for |
||
| ``` | ||
|
|
||
| Redirect a token from a file into `--password-stdin`: | ||
|
|
||
| ```bash | ||
| runpodctl registry create --name "docker-hub" --username "myuser" --password-stdin < token.txt | ||
| ``` | ||
|
|
||
| For Google Artifact Registry or gcr.io, set `--username` to the literal `_json_key` and feed the multi-line service-account JSON key file through `--password-stdin`. The command supports multi-line passwords and strips only a single trailing newline added by the pipe or redirection. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TrimSuffix(TrimSuffix(data, "\n"), "\r") strips only a single trailing newline (\n or \r\n) added by a pipe/redirection, preserving multi-line content such as a gcr.io _json_key service-account JSON key. |
||
|
|
||
| ```bash | ||
| runpodctl registry create --name "gcr" --username "_json_key" --password-stdin < service-account.json | ||
| ``` | ||
|
|
||
| <Tip> | ||
| Prefer `--password-stdin` or the interactive prompt over `--password`. A value passed to `--password` is visible in the process table and your shell history. | ||
| </Tip> | ||
|
|
||
| #### Create flags | ||
|
|
||
| <ResponseField name="--name" type="string" required> | ||
|
|
@@ -55,8 +89,12 @@ | |
| Registry username. | ||
| </ResponseField> | ||
|
|
||
| <ResponseField name="--password" type="string" required> | ||
| Registry password or access token. | ||
| <ResponseField name="--password" type="string"> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. init() marks only --name and --username required via MarkFlagRequired; --password-stdin is a BoolVar (no value); MarkFlagsMutuallyExclusive("password", "password-stdin") makes the two password flags mutually exclusive. |
||
| Registry password or access token. Cannot be used with `--password-stdin`. If neither `--password` nor `--password-stdin` is given, the command prompts for the password when run in an interactive terminal, or exits with an error otherwise. | ||
| </ResponseField> | ||
|
|
||
| <ResponseField name="--password-stdin" type="bool"> | ||
| Read the registry password from standard input (pipe, heredoc, or file redirection). Supports multi-line values. Cannot be used with `--password`. | ||
| </ResponseField> | ||
|
|
||
| ### Delete a registry authentication | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
promptPassword uses term.ReadPassword, which disables terminal echo, confirming the interactive prompt does not echo input; triggered only when stdinIsTerminal() (line 141).
Source: https://github.com/runpod/runpodctl/blob/0592468b1f1f02d8ca10485af56192ebf9a84d05/cmd/registry/create.go#L92-L100