Skip to content

Commit 5ca77d3

Browse files
authored
src: update build command help text (#1425)
* src: build command help text * Regen docs
1 parent 1ca6625 commit 5ca77d3

File tree

3 files changed

+76
-47
lines changed

3 files changed

+76
-47
lines changed

cmd/build.go

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,49 @@ import (
2020
func NewBuildCmd(newClient ClientFactory) *cobra.Command {
2121
cmd := &cobra.Command{
2222
Use: "build",
23-
Short: "Build a function project as a container image",
24-
Long: `Build a function project as a container image
25-
26-
This command builds the function project in the current directory or in the directory
27-
specified by --path. The result will be a container image that is pushed to a registry.
28-
The func.yaml file is read to determine the image name and registry.
29-
If the project has not already been built, either --registry or --image must be provided
30-
and the image name is stored in the configuration file.
31-
`,
32-
Example: `
33-
# Build from the local directory, using the given registry as target.
34-
# The full image name will be determined automatically based on the
35-
# project directory name
36-
{{.Name}} build --registry quay.io/myuser
23+
Short: "Build a Function",
24+
Long: `
25+
NAME
26+
{{.Name}} build - Build a Function
27+
28+
SYNOPSIS
29+
{{.Name}} build [-r|--registry] [--builder] [--builder-image] [--push]
30+
[--palatform] [-p|--path] [-c|--confirm] [-v|--verbose]
31+
32+
DESCRIPTION
33+
34+
Builds a function's container image and optionally pushes it to the
35+
configured container registry.
36+
37+
By default building is handled automatically when deploying (see the deploy
38+
subcommand). However, sometimes it is useful to build a function container
39+
outside of this normal deployment process, for example for testing or during
40+
composition when integrationg with other systems. Additionally, the container
41+
can be pushed to the configured registry using the --push option.
42+
43+
When building a function for the first time, either a registry or explicit
44+
image name is required. Subsequent builds will reuse these option values.
45+
46+
EXAMPLES
47+
48+
o Build a function container using the given registry.
49+
The full image name will be calculated using the registry and function name.
50+
$ {{.Name}} build --registry registry.example.com/alice
51+
52+
o Build a function container using an explicit image name, ignoring registry
53+
and function name.
54+
$ {{.Name}} build --image registry.example.com/alice/f:latest
3755
38-
# Build from the local directory, specifying the full image name
39-
{{.Name}} build --image quay.io/myuser/myfunc
56+
o Rebuild a function using prior values to determine container name.
57+
$ {{.Name}} build
4058
41-
# Re-build, picking up a previously supplied image name from a local func.yml
42-
{{.Name}} build
59+
o Build a function specifying the Source-to-Image (S2I) builder
60+
$ {{.Name}} build --builder=s2i
4361
44-
# Build using s2i instead of Buildpacks
45-
{{.Name}} build --builder=s2i
62+
o Build a function specifying the Pack builder with a custom Buildpack
63+
builder image.
64+
$ {{.Name}} build --builder=pack --builder-image=cnbs/sample-builder:bionic
4665
47-
# Build with a custom buildpack builder
48-
{{.Name}} build --builder=pack --builder-image cnbs/sample-builder:bionic
4966
`,
5067
SuggestFor: []string{"biuld", "buidl", "built"},
5168
PreRunE: bindEnv("image", "path", "builder", "registry", "confirm", "push", "builder-image", "platform"),

docs/reference/func.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ EXAMPLES
3636

3737
### SEE ALSO
3838

39-
* [func build](func_build.md) - Build a function project as a container image
39+
* [func build](func_build.md) - Build a Function
4040
* [func completion](func_completion.md) - Generate completion scripts for bash, fish and zsh
4141
* [func config](func_config.md) - Configure a function
4242
* [func create](func_create.md) - Create a function project

docs/reference/func_build.md

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,55 @@
11
## func build
22

3-
Build a function project as a container image
3+
Build a Function
44

55
### Synopsis
66

7-
Build a function project as a container image
87

9-
This command builds the function project in the current directory or in the directory
10-
specified by --path. The result will be a container image that is pushed to a registry.
11-
The func.yaml file is read to determine the image name and registry.
12-
If the project has not already been built, either --registry or --image must be provided
13-
and the image name is stored in the configuration file.
8+
NAME
9+
func build - Build a Function
1410

11+
SYNOPSIS
12+
func build [-r|--registry] [--builder] [--builder-image] [--push]
13+
[--palatform] [-p|--path] [-c|--confirm] [-v|--verbose]
1514

16-
```
17-
func build
18-
```
15+
DESCRIPTION
1916

20-
### Examples
17+
Builds a function's container image and optionally pushes it to the
18+
configured container registry.
2119

22-
```
20+
By default building is handled automatically when deploying (see the deploy
21+
subcommand). However, sometimes it is useful to build a function container
22+
outside of this normal deployment process, for example for testing or during
23+
composition when integrationg with other systems. Additionally, the container
24+
can be pushed to the configured registry using the --push option.
2325

24-
# Build from the local directory, using the given registry as target.
25-
# The full image name will be determined automatically based on the
26-
# project directory name
27-
func build --registry quay.io/myuser
26+
When building a function for the first time, either a registry or explicit
27+
image name is required. Subsequent builds will reuse these option values.
2828

29-
# Build from the local directory, specifying the full image name
30-
func build --image quay.io/myuser/myfunc
29+
EXAMPLES
3130

32-
# Re-build, picking up a previously supplied image name from a local func.yml
33-
func build
31+
o Build a function container using the given registry.
32+
The full image name will be calculated using the registry and function name.
33+
$ func build --registry registry.example.com/alice
34+
35+
o Build a function container using an explicit image name, ignoring registry
36+
and function name.
37+
$ func build --image registry.example.com/alice/f:latest
3438

35-
# Build using s2i instead of Buildpacks
36-
func build --builder=s2i
39+
o Rebuild a function using prior values to determine container name.
40+
$ func build
3741

38-
# Build with a custom buildpack builder
39-
func build --builder=pack --builder-image cnbs/sample-builder:bionic
42+
o Build a function specifying the Source-to-Image (S2I) builder
43+
$ func build --builder=s2i
4044

45+
o Build a function specifying the Pack builder with a custom Buildpack
46+
builder image.
47+
$ func build --builder=pack --builder-image=cnbs/sample-builder:bionic
48+
49+
50+
51+
```
52+
func build
4153
```
4254

4355
### Options

0 commit comments

Comments
 (0)