Skip to content

Commit ff4fd72

Browse files
rgee0alexellis
authored andcommitted
Add --parallel, --filter and --regex to CLI build section
Signed-off-by: Richard Gee <richard@technologee.co.uk>
1 parent 1edae61 commit ff4fd72

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

docs/cli/build.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,52 @@ Remeber to add any `ARG` values to the template's Dockerfile:
101101
ARG ARGNAME2
102102
```
103103

104-
For more information about passing build arguments to Docker, please visit the [Docker documentation](https://docs.docker.com/engine/reference/commandline/build/)
104+
For more information about passing build arguments to Docker, please visit the [Docker documentation](https://docs.docker.com/engine/reference/commandline/build/)
105+
106+
## 4.0 Building with large function sets
107+
108+
Performing a `build` action against a `stack.yml` which contains a large suite of serverless function definitions will result in each of the defined functions being built. The CLI makes available facilities that assist in this scenario.
109+
110+
The `--parallel` flag aims to reduce total build time by enabling more than one function build action to take place concurrently. Additionally, there may be situations where building *all* the defined functions is undesirable - for example where only one of the functions has had its code updated. In this instance the `--filter` and `--regex` flags can be used.
111+
112+
Consider a project with `fn1`, `fn2`, `fn3`, `fn22`, `fn33` functions all defined within a single YAML file.
113+
114+
### 4.1 Using the `--parallel` flag
115+
116+
Parallel enables the user to specify how many concurrent function build actions should be performed. The default is that functions will be built serially, one after the other.
117+
118+
The following will see all the project functions' build actions performed concurrently:
119+
120+
```bash
121+
faas-cli build --parallel 5
122+
```
123+
124+
!!! note
125+
Remember to add -f if using a non-default yaml file: `faas-cli build --parallel 5 -f projectfile.yml`
126+
127+
Parallel can be combined with either of the `--filter` and `--regex` flags to parallel build a subset of the functions.
128+
129+
### 4.2 Using the `--filter` flag
130+
131+
Filter performs wildcard matching against function names in YAML file so that the build action will only be performed against those that match.
132+
133+
The following filter would build only `fn2` from `stack.yml`:
134+
135+
```bash
136+
faas-cli build --filter "fn2"
137+
```
138+
Wildcards can be added using `*`. The following will result in both `fn2` and `fn22` being built:
139+
140+
```bash
141+
faas-cli build --filter "fn2*"
142+
```
143+
144+
### 4.3 Using the `--regex` flag
145+
146+
Regex performs a similar action to `--filter` but allows for more complex patterns to be defined through regular expressions.
147+
148+
The following regex would result in `fn1`, `fn2` & `fn3` being built from the earlier project's `stack.yml`:
149+
150+
```bash
151+
faas-cli build --regex "fn[0-9]$"
152+
```

0 commit comments

Comments
 (0)