Skip to content

Commit 185d080

Browse files
authored
feat: unhide username/password/token flags for all builders (#3420)
Since PR #3298 fixed these credentials to work with all builders (host, pack, s2i), there's no reason to keep them hidden anymore. Also added environment variable hints to flag descriptions.
1 parent 502d4a8 commit 185d080

File tree

4 files changed

+12
-20
lines changed

4 files changed

+12
-20
lines changed

cmd/build.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,20 +123,13 @@ EXAMPLES
123123
cmd.Flags().StringP("platform", "", "",
124124
"Optionally specify a target platform, for example \"linux/amd64\" when using the s2i build strategy")
125125
cmd.Flags().StringP("username", "", "",
126-
"Username to use when pushing to the registry.")
126+
"Username to use when pushing to the registry. ($FUNC_USERNAME)")
127127
cmd.Flags().StringP("password", "", "",
128-
"Password to use when pushing to the registry.")
128+
"Password to use when pushing to the registry. ($FUNC_PASSWORD)")
129129
cmd.Flags().StringP("token", "", "",
130-
"Token to use when pushing to the registry.")
130+
"Token to use when pushing to the registry. ($FUNC_TOKEN)")
131131
cmd.Flags().BoolP("build-timestamp", "", false, "Use the actual time as the created time for the docker image. This is only useful for buildpacks builder.")
132132

133-
// Temporarily Hidden Basic Auth Flags
134-
// Username, Password and Token flags, which plumb through basic auth, are
135-
// currently only available on the "host" builder.
136-
_ = cmd.Flags().MarkHidden("username")
137-
_ = cmd.Flags().MarkHidden("password")
138-
_ = cmd.Flags().MarkHidden("token")
139-
140133
// Oft-shared flags:
141134
addConfirmFlag(cmd, cfg.Confirm)
142135
addPathFlag(cmd)

cmd/deploy.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,22 +208,15 @@ EXAMPLES
208208
cmd.Flags().String("platform", "",
209209
"Optionally specify a specific platform to build for (e.g. linux/amd64). ($FUNC_PLATFORM)")
210210
cmd.Flags().StringP("username", "", "",
211-
"Username to use when pushing to the registry.")
211+
"Username to use when pushing to the registry. ($FUNC_USERNAME)")
212212
cmd.Flags().StringP("password", "", "",
213-
"Password to use when pushing to the registry.")
213+
"Password to use when pushing to the registry. ($FUNC_PASSWORD)")
214214
cmd.Flags().StringP("token", "", "",
215-
"Token to use when pushing to the registry.")
215+
"Token to use when pushing to the registry. ($FUNC_TOKEN)")
216216
cmd.Flags().BoolP("build-timestamp", "", false, "Use the actual time as the created time for the docker image. This is only useful for buildpacks builder.")
217217
cmd.Flags().StringP("namespace", "n", defaultNamespace(f, false),
218218
"Deploy into a specific namespace. Will use the function's current namespace by default if already deployed, and the currently active context if it can be determined. ($FUNC_NAMESPACE)")
219219

220-
// Temporarily Hidden Basic Auth Flags
221-
// Username, Password and Token flags, which plumb through basic auth, are
222-
// currently only available on "host" builder.
223-
_ = cmd.Flags().MarkHidden("username")
224-
_ = cmd.Flags().MarkHidden("password")
225-
_ = cmd.Flags().MarkHidden("token")
226-
227220
// Oft-shared flags:
228221
addConfirmFlag(cmd, cfg.Confirm)
229222
addPathFlag(cmd)

docs/reference/func_build.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,15 @@ func build
6464
-c, --confirm Prompt to confirm options interactively ($FUNC_CONFIRM)
6565
-h, --help help for build
6666
-i, --image string Full image name in the form [registry]/[namespace]/[name]:[tag] (optional). This option takes precedence over --registry ($FUNC_IMAGE)
67+
--password string Password to use when pushing to the registry. ($FUNC_PASSWORD)
6768
-p, --path string Path to the function. Default is current directory ($FUNC_PATH)
6869
--platform string Optionally specify a target platform, for example "linux/amd64" when using the s2i build strategy
6970
-u, --push Attempt to push the function image to the configured registry after being successfully built
7071
-r, --registry string Container registry + registry namespace. (ex 'ghcr.io/myuser'). The full image name is automatically determined using this along with function name. ($FUNC_REGISTRY)
7172
--registry-authfile string Path to a authentication file containing registry credentials ($FUNC_REGISTRY_AUTHFILE)
7273
--registry-insecure Skip TLS certificate verification when communicating in HTTPS with the registry ($FUNC_REGISTRY_INSECURE)
74+
--token string Token to use when pushing to the registry. ($FUNC_TOKEN)
75+
--username string Username to use when pushing to the registry. ($FUNC_USERNAME)
7376
-v, --verbose Print verbose logs ($FUNC_VERBOSE)
7477
```
7578

docs/reference/func_deploy.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ func deploy
128128
-h, --help help for deploy
129129
-i, --image string Full image name in the form [registry]/[namespace]/[name]:[tag]@[digest]. This option takes precedence over --registry. Specifying digest is optional, but if it is given, 'build' and 'push' phases are disabled. ($FUNC_IMAGE)
130130
-n, --namespace string Deploy into a specific namespace. Will use the function's current namespace by default if already deployed, and the currently active context if it can be determined. ($FUNC_NAMESPACE) (default "default")
131+
--password string Password to use when pushing to the registry. ($FUNC_PASSWORD)
131132
-p, --path string Path to the function. Default is current directory ($FUNC_PATH)
132133
--platform string Optionally specify a specific platform to build for (e.g. linux/amd64). ($FUNC_PLATFORM)
133134
-u, --push Push the function image to registry before deploying. ($FUNC_PUSH) (default true)
@@ -138,6 +139,8 @@ func deploy
138139
-R, --remote Trigger a remote deployment. Default is to deploy and build from the local system ($FUNC_REMOTE)
139140
--remote-storage-class string Specify a storage class to use for the volume on-cluster during remote builds
140141
--service-account string Service account to be used in the deployed function ($FUNC_SERVICE_ACCOUNT)
142+
--token string Token to use when pushing to the registry. ($FUNC_TOKEN)
143+
--username string Username to use when pushing to the registry. ($FUNC_USERNAME)
141144
-v, --verbose Print verbose logs ($FUNC_VERBOSE)
142145
```
143146

0 commit comments

Comments
 (0)