You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- --tag was added to the CLI for build/push/deploy, this change
takes inspiration from #50 via @MrTinD and closes#49.
Signed-off-by: Alex Ellis (VMware) <[email protected]>
All OpenFaaS functions are built into immutable Docker images before deployment. You can take advantage of Docker "tags" to organise your versions the CLI can also generate tags based upon Git metadata.
4
+
5
+
## Option 1 - YAML file
6
+
7
+
You can define your tag in the stack YAML file. By default this tag is ":latest"
8
+
9
+
```
10
+
image: my-fn
11
+
```
12
+
13
+
or
14
+
15
+
16
+
```
17
+
image: my-fn:latest
18
+
```
19
+
20
+
## Option 2 - `--tag` option
21
+
22
+
The `--tag` option works with the `faas-cli` sub-commands: `build`, `push` and `deploy`.
23
+
24
+
When using a --tag feature which relies on metadata from a Git commit then the build, push and deploy commands must be run pointing at the same Git commit.
25
+
26
+
Example usage:
27
+
28
+
```
29
+
faas-cli build --tag=sha|branch
30
+
faas-cli push --tag=sha|branch
31
+
faas-cli deploy --tag=sha|branch
32
+
```
33
+
34
+
There are currently two formats for "automatic tags".
35
+
36
+
### 2.1 Use the SHA (`--tag=sha`)
37
+
38
+
In this example whatever tag is defined in your YAML file (or latest, if not is given) will be suffixed with "-" plus the short Git SHA. A Git repository will be required to use this feature.
39
+
40
+
Example:
41
+
42
+
```
43
+
image: my-fn:0.2
44
+
45
+
image: my-other-fn
46
+
```
47
+
48
+
Gives the equivalent:
49
+
50
+
51
+
```
52
+
image: my-fn:0.2-cf59cfc
53
+
54
+
image: my-other-fn:latest-cf59cfc
55
+
```
56
+
57
+
### 2.2 Use the SHA plus the branch (`--tag=branch`)
58
+
59
+
In this example you will get an output which includes the SHA and the branch name. This is useful for promotion code through enviroments with a continuous delivery tool. If you use one branch per environment in Git then the tool can parse the tag and match it to an environment.
0 commit comments