Skip to content

Commit e99c8f0

Browse files
committed
chore(release): 0.193.9
1 parent 301825a commit e99c8f0

103 files changed

Lines changed: 4376 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ All notable changes to Terrabuild are documented in this file.
44

55
## [Unreleased]
66

7+
## [0.193.9]
8+
9+
- Refine the desktop website header so the local-search bar is larger and centered, while the docs version selector stays on the right before the GitHub link.
10+
- Treat the newest stable docs version as the maintained stable line so the outdated-version warning is shown only for older stable releases, not for the latest stable tag.
11+
- Remove the Terrabuild blog from the Docusaurus site now that release/blog content has moved to the Magnus Opera corporate website.
12+
- Switch website tooling and release workflows from npm to pnpm, including lockfile generation and Pages/release workflow updates.
13+
- Fix the stable docs website build and Docusaurus release dependencies so tagged release builds can snapshot docs and publish successfully in GitHub Actions.
14+
- Adjust website publishing rules so GA and `-next` releases both build/deploy Pages as intended, and expose the docs version selector on the published site with `Next` plus all published stable versions.
15+
16+
**Full Changelog**: https://github.com/magnusopera/terrabuild/compare/0.193.6...0.193.9
17+
718
## [0.193.9-next]
819

920

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
title: Functions
3+
4+
---
5+
6+
Functions can be applied on values. Functions take a tuple as argument `(param1, param2)` which can be built from aforementioned primitives.
7+
8+
## Boolean
9+
10+
| Function | Description | Usage | Result |
11+
|----------|-------------|-------|--------|
12+
| \|\| | or operation. | `true \|\| false` | `true` |
13+
| && | and operation. | `false && true` | `false` |
14+
15+
## String
16+
17+
| Function | Description | Usage | Result |
18+
|----------|-------------|-------|--------|
19+
| + | concatenate two strings | `"Hello" + "world"` | `"Hello world"` |
20+
| trim | remove leading and trailing spaces | `trim(" Hello world ")` | `"Hello world"` |
21+
| upper | convert string to upper case | `upper("Hello world")` | `"HELLO WORLD"` |
22+
| lower | convert string to lower case | `lower("Hello WORLD")` | `"hello world"` |
23+
| replace | replace in string. | `replace("Hello world", "world", "Terrabuild")` | `Hello Terrabuild` |
24+
| regex match | match string against a regex. | `"prodfr" ~= "^prod"` | `true` |
25+
26+
## Number
27+
28+
| Function | Description | Usage | Result |
29+
|----------|-------------|-------|--------|
30+
| + | add two numbers | `5 + 2` | `7` |
31+
| - | substract two numbers | `5 - 2` | `3` |
32+
| * | multiply two numbers | `5 * 2` | `10` |
33+
| / | divide two numbers | `6 / 2` | `3` |
34+
35+
## List
36+
37+
| Function | Description | Usage | Result |
38+
|----------|-------------|-------|--------|
39+
| Static Item | Get item at position: error if index is not valid | `[1, 2, 3].1` | `2` |
40+
| Dynamic Item | Get item using expression: error if index is not valid | `[1, 2, 3].[1]` | `2` |
41+
| Count | Get number of element of list | `count([1, 2, 3])` | `3` |
42+
| + | Concatenate two lists | `[1, 2, 3] + [4, 5, 6]` | `[1, 2, 3, 4, 5, 6]`
43+
44+
## Map
45+
46+
| Function | Description | Usage | Result |
47+
|----------|-------------|-------|--------|
48+
| Static Item | Get named item (using identifier): error if index is not valid | `{ a: 1, b: 2 }.b` | `2` |
49+
| Dynamic Item | Get item using expression: error if index is not valid | `{ a: 1, b: 2 }.["b"]` | `2` |
50+
| Count | Get number of element of map | `count({ a: 1, b: 2 })` | `2` |
51+
| + | Merge two maps | `{ a: 1, b: 1} + { b: 2, c: 2}` | `{ a: 1, b: 2, c: 2}` |
52+
53+
## Generic
54+
55+
| Function | Description | Usage | Result |
56+
|----------|-------------|-------|--------|
57+
| Not | `true` if falsy (`nothing` or `false`) | `!false` | `true` |
58+
| Equal | compares two values for equality | `"env" = "prod"` | `false` |
59+
| Not Equal | compares two values for inequality | `"env" != "prod"` | `true` |
60+
| Null-Coalesce | return value or alternate value if falsy (`nothing` or `false`) | `nothing ?? 42` | `42` |
61+
| Ternary Conditional | checks boolean value and returns truthy or falsy value | `nothing ? 42 : 666` | `666` |
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Expression
3+
4+
---
5+
6+
Expressions are used to configure actions and provide dynamic values in Terrabuild configuration files. They are lazily evaluated - computed right before invoking an action - and are strongly typed: the type is inferred automatically based on the expression's result.
7+
8+
Expressions support [variables](/docs/expression/variables) and [functions](/docs/expression/functions), allowing you to create dynamic configurations that adapt based on context, environment, or other variables.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: Predefined Variables
3+
4+
---
5+
Terrabuild provides several predefined variables that can be used in expressions. These variables provide information about the build context, system environment, and current project/target being built.
6+
7+
| Name | Description | Scope |
8+
|----------|---------|-------|
9+
| `terrabuild.configuration` | Name of current configuration | Global |
10+
| `terrabuild.environment` | Name of current environment | Global |
11+
| `terrabuild.branch_or_tag` | Name of current branch or tag | Global |
12+
| `terrabuild.head_commit` | Head commit hash | Global |
13+
| `terrabuild.retry` | `true` if build is retried. | Global |
14+
| `terrabuild.force` | `true` if build is forced. | Global |
15+
| `terrabuild.ci` | `true` if build is running in known CI. | Global |
16+
| `terrabuild.engine` | Container engine used. | Global |
17+
| `terrabuild.debug` | `true` if debug is enabled. | Global |
18+
| `terrabuild.tag` | Tag provided by user or `nothing`. | Global |
19+
| `terrabuild.note` | Note provided by user or `nothing`. | Global |
20+
| `terrabuild.os` | `darwin`, `windows`, `linux` or `nothing` if unknown. | Global |
21+
| `terrabuild.arch` | `arm64`, `amd64` or `nothing` if unknown. | Global |
22+
| `terrabuild.project_slug` | Slug of current [project](/docs/project) (relative path from workspace) | Target |
23+
| `terrabuild.project` | Id of current [project](/docs/project) if defined | Target |
24+
| `terrabuild.target` | Name of current [target](/docs/project/target) | Target |
25+
| `terrabuild.version` | Version (hash) of current [project](/docs/project) | Target |
26+
| `project.<id>.version` | Version (hash) of given project `<id>` | Target |
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
---
2+
title: Types and Literals
3+
4+
---
5+
6+
## Nothing
7+
8+
Value for no value (pun intended). Similar to `void` or `None` in other languages.
9+
10+
Literal is `nothing`.
11+
12+
## String
13+
14+
A string is a sequence of characters. A string starts with `"` and ends with `"`:
15+
* `"this is a string"`
16+
* `""`
17+
18+
Following characters must be escaped (double the character): `"`:
19+
* `"Hello ""!"" "` is string `Hello "!"`
20+
21+
Strings support interpolation too ! Use `${ <expr> }` syntax:
22+
* `"Hello ${ local.name } !"`
23+
24+
Note gollowing characters must be escaped (double the character): `{`, `}`, `"`:
25+
* `"{{ Hello ""!"" }}"` is string `{ Hello "!" }`
26+
27+
## Boolean
28+
29+
Either literal `true` or `false`.
30+
31+
## Number
32+
33+
A number is a 32 bits signed integer:
34+
* `42`
35+
* `-123456`
36+
37+
## Enum
38+
39+
An enum is a specific identifier used in few places (see `cache` and `build`). For example:
40+
* `~workspace`
41+
* `~partition`
42+
43+
## List
44+
45+
A list is an ordered sequence of values. Values can be of different types, and lists can be nested.
46+
47+
Commas are optional. You can separate list items with whitespace or commas. For single-line lists, commas improve readability.
48+
49+
### Simple Lists
50+
51+
```
52+
[ 1, 2, 3 ]
53+
[ "a", "b", "c" ]
54+
[ true, false, true ]
55+
```
56+
57+
You can also use whitespace without commas:
58+
59+
```
60+
[ 1 2 3 ]
61+
[ "a" "b" "c" ]
62+
```
63+
64+
### Mixed Type Lists
65+
66+
```
67+
[ 1, "value", 42, true ]
68+
[ "string", 123, false ]
69+
```
70+
71+
### Nested Lists
72+
73+
Lists can contain other lists:
74+
75+
```
76+
[ [ 1, 2 ], [ 3, 4 ] ]
77+
[ "outer", [ "inner1", "inner2" ], "outer2" ]
78+
```
79+
80+
### Recommended Formatting
81+
82+
For single-line lists, use commas for better readability:
83+
84+
```
85+
[ 1, 2, 3 ]
86+
[ "a", "b", "c" ]
87+
[ 1, "value", 42, true ]
88+
```
89+
90+
For multi-line lists, format with one item per line (commas optional):
91+
92+
```
93+
[ 1
94+
2
95+
3 ]
96+
97+
[ 1
98+
"value"
99+
42
100+
true ]
101+
102+
[ [ 1, 2 ]
103+
[ 3, 4 ]
104+
[ 5, 6 ] ]
105+
```
106+
107+
### Empty List
108+
109+
```
110+
[ ]
111+
```
112+
113+
## Map
114+
115+
A map is a collection of named values (key-value pairs). The key is always an identifier. Values can be of different types, and maps can be nested.
116+
117+
Commas are optional. You can separate map entries with whitespace or commas.
118+
119+
### Simple Maps
120+
121+
```
122+
{ configuration: "Release" }
123+
{ a: 1, b: 2 }
124+
{ name: "app", version: 42, enabled: true }
125+
```
126+
127+
### Mixed Type Values
128+
129+
```
130+
{
131+
name: "myapp"
132+
version: 1
133+
enabled: true
134+
tags: [ "web", "api" ]
135+
}
136+
```
137+
138+
### Nested Maps
139+
140+
Maps can contain other maps and lists:
141+
142+
```
143+
{
144+
app: { name: "myapp", version: 1 }
145+
config: { debug: true }
146+
}
147+
148+
{
149+
servers: [ "server1", "server2" ]
150+
settings: { timeout: 30, retries: 3 }
151+
}
152+
```
153+
154+
### Complex Nested Structures
155+
156+
```
157+
{
158+
projects: [
159+
{ name: "api", path: "src/api" }
160+
{ name: "web", path: "src/web" }
161+
]
162+
defaults: {
163+
config: "Release"
164+
platforms: [ "linux", "windows" ]
165+
}
166+
}
167+
```
168+
169+
### Recommended Formatting
170+
171+
For readability, format maps with one entry per line (multi-line format is recommended):
172+
173+
```
174+
{ configuration: "Release"
175+
max: 42 }
176+
177+
{ a: 1
178+
b: 2
179+
c: 3 }
180+
181+
{
182+
app: { name: "myapp", version: 1 }
183+
config: { debug: true }
184+
}
185+
```
186+
187+
### Empty Map
188+
189+
```
190+
{ }
191+
```
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: Variables
3+
4+
---
5+
6+
Variables used in expressions have a scope and an identifier. The scope defines the source of the variable, and the identifier is the name of the variable within that scope.
7+
8+
Terrabuild supports the following variable scopes:
9+
* **`terrabuild`** - [Predefined variables](/docs/expression/predefined-variables) provided by Terrabuild (build context, system info, etc.)
10+
* **`variable`** - [Workspace variables](/docs/workspace/variable) defined in the WORKSPACE file
11+
* **`local`** - [Local values](/docs/workspace/locals) defined in WORKSPACE or [PROJECT](/docs/project/locals) files
12+
* **`project`** - [Project properties](/docs/project/project) from the project block
13+
14+
Here are some variable reference examples:
15+
* `terrabuild.branch_or_tag` - Access the current Git branch or tag
16+
* `var.config` - Access a workspace variable named `config`
17+
* `local.config` - Access a local value named `config`
18+
* `project.api` - Access a project with identifier `api`
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: Container
3+
4+
---
5+
6+
Extension can run actions in a Docker container when `image` is specified on an extension block:
7+
8+
```
9+
extension @terraform {
10+
image = "hashicorp/terraform:1.8.4"
11+
platform = "linux/arm64"
12+
variables = [ "ARM_*"
13+
"MYSECRET" ]
14+
}
15+
```
16+
## Argument Reference
17+
The following arguments are supported:
18+
* `image` - (Optional) The Docker image to use. Default is `nothing`.
19+
* `platform` - (Optional) The platform for the Docker image. Default is `nothing` (i.e.: current host architecture).
20+
* `variables` - (Optional) List of variables to pass to Docker instance. Supports wildcards. Default is `[]`.
21+
22+
All actions for this extension will run in the configured image - hence providing both isolation and avoiding toolchains discrepancies.
23+
24+
:::warning
25+
On macOS, it's recommended to use [OrbStack](https://orbstack.dev/) as it's much faster than Docker implementation.
26+
:::
27+
28+
## Technical implementation
29+
30+
All actions are run using following docker configuration:
31+
* Entrypoint and arguments are overriden by action (`--entrypoint`)
32+
* Command runs as PID 1 (`--init`)
33+
* Container is configured for 1Gb of shared memory (`--shm-size=1gb`)
34+
* Container is removed after execution (`--rm`)
35+
* Container uses provided platform - use default if none
36+
* Docker host socket is exposed to container to allow Docker in Docker (`-v /var/run/docker.sock`)
37+
* Container `USER` account is identified and used to map host homedir to USER homedir (`-v`)
38+
* Container `/tmp` is redirected and shared across instances (`v`)
39+
* Container workdir is the current project rootdir (`-w`)
40+
* Network is set to `host` (`--net=host`)
41+
* IPC is set to `host` (`--ipc=host`)
42+
* PID is set to `host` (`--pid=host`)
43+
* Environment variables can be passed from host to container (`-e`) - see variables property of extensions.

0 commit comments

Comments
 (0)