Skip to content

Commit 451885f

Browse files
committed
docs: updates
1 parent 67db4cf commit 451885f

11 files changed

Lines changed: 156 additions & 15 deletions

File tree

docs/hack/functions/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,8 @@ var Functions = []Function{
367367
Name: "exec_container",
368368
Description: `Executes the command provided as argument inside a container`,
369369
Args: `[command]`,
370-
Handler: basiccommands.Cat,
370+
Flags: commands.ExecContainerOptions{},
371+
Handler: commands.ExecContainer,
371372
Group: groupOther,
372373
},
373374
{
Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11

2-
3-
<details className="config-field -function" data-expandable="false">
2+
import PartialImageselector from "./exec_container/image-selector.mdx"
3+
import PartialLabelselector from "./exec_container/label-selector.mdx"
4+
import PartialContainer from "./exec_container/container.mdx"
5+
import PartialNamespace from "./exec_container/namespace.mdx"
6+
import PartialDisablewait from "./exec_container/disable-wait.mdx"
7+
import PartialTimeout from "./exec_container/timeout.mdx"
8+
9+
<details className="config-field -function" data-expandable="true">
410
<summary>
511

612
### `exec_container` <span className="config-field-type">[command]</span> <span className="config-field-enum"></span> <span className="config-field-default -return"></span> <span className="config-field-required" data-required="true">pipeline only</span> {#exec_container}
@@ -9,6 +15,12 @@ Executes the command provided as argument inside a container
915

1016
</summary>
1117

18+
<PartialImageselector />
19+
<PartialLabelselector />
20+
<PartialContainer />
21+
<PartialNamespace />
22+
<PartialDisablewait />
23+
<PartialTimeout />
1224

1325

1426
</details>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
<details className="config-field -function" data-expandable="false">
3+
<summary>
4+
5+
#### `--container` <span className="config-field-type">string</span> <span className="config-field-enum"></span> <span className="config-field-default -return"></span> <span className="config-field-required" data-required="false">pipeline only</span> {#exec_container-container}
6+
7+
The container to use
8+
9+
</summary>
10+
11+
12+
13+
</details>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
<details className="config-field -function" data-expandable="false">
3+
<summary>
4+
5+
#### `--disable-wait` <span className="config-field-type">bool</span> <span className="config-field-enum"></span> <span className="config-field-default -return"></span> <span className="config-field-required" data-required="false">pipeline only</span> {#exec_container-disable-wait}
6+
7+
If true, will not wait for the container to become ready
8+
9+
</summary>
10+
11+
12+
13+
</details>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
<details className="config-field -function" data-expandable="false">
3+
<summary>
4+
5+
#### `--image-selector` <span className="config-field-type">string</span> <span className="config-field-enum"></span> <span className="config-field-default -return"></span> <span className="config-field-required" data-required="false">pipeline only</span> {#exec_container-image-selector}
6+
7+
The image selector to use to select the container
8+
9+
</summary>
10+
11+
12+
13+
</details>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
<details className="config-field -function" data-expandable="false">
3+
<summary>
4+
5+
#### `--label-selector` <span className="config-field-type">string</span> <span className="config-field-enum"></span> <span className="config-field-default -return"></span> <span className="config-field-required" data-required="false">pipeline only</span> {#exec_container-label-selector}
6+
7+
The label selector to use to select the container
8+
9+
</summary>
10+
11+
12+
13+
</details>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
<details className="config-field -function" data-expandable="false">
3+
<summary>
4+
5+
#### `--namespace / -n` <span className="config-field-type">string</span> <span className="config-field-enum"></span> <span className="config-field-default -return"></span> <span className="config-field-required" data-required="false">pipeline only</span> {#exec_container-namespace}
6+
7+
The namespace to use
8+
9+
</summary>
10+
11+
12+
13+
</details>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
<details className="config-field -function" data-expandable="false">
3+
<summary>
4+
5+
#### `--timeout` <span className="config-field-type">int64</span> <span className="config-field-enum"></span> <span className="config-field-default -return"></span> <span className="config-field-required" data-required="false">pipeline only</span> {#exec_container-timeout}
6+
7+
The timeout to wait. Defaults to 5 minutes
8+
9+
</summary>
10+
11+
12+
13+
</details>

docs/pages/configuration/functions/basics.mdx

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,36 @@ import GlobalFunctionRef from '../_partials/functions/reference_global.mdx'
1111
Functions are bash functions that can be called inside the remainder of `devspace.yaml`. A common use case is to define reusable functionality that is called from within the scripts you specify within the `pipelines` section.
1212

1313
There are two types of functions:
14-
1. [Custom Functions](#built-in-functions) defined in `devspace.yaml` (often added via [`imports`](../imports/basics.mdx))
15-
2. [Built-In Functions](#built-in-functions)
14+
1. [Custom Functions](#custom-functions) defined in `devspace.yaml` (often added via [`imports`](../imports/basics.mdx))
15+
2. [Built-In Functions](#built-in-functions) such as `build_images` or `create_deployments`
1616

17-
## Workflow
1817

19-
### 1. Define Functions
20-
<ConfigPartial/>
18+
## Custom Functions
19+
DevSpace provides support for custom functions. To use them, you need to:
20+
1. Declare your custom functions within the `functions` section of `devspace.yaml`
21+
2. Call custom functions from any scripted field in `devspace.yaml` such as in `pipelines` or in any value defined using an inline script such as `$(command)`
22+
23+
### 1. Declare Functions
24+
Declaring a function means adding a key with the function name to the `functions` section in `devspace.yaml` as shown in the example below:
25+
```yaml
26+
functions:
27+
hello_world: |-
28+
echo "Hello World"
29+
get_tag: |-
30+
echo $(git rev-parse --short HEAD)
31+
```
2132
2233
### 2. Call Functions
34+
To call a custom function
35+
```yaml
36+
pipelines:
37+
deploy: |-
38+
build_images --tag $(get_git_commit)
39+
create_deployments --all
40+
dev: |-
41+
hello_world
42+
run_default_pipeline
43+
```
2344
2445
2546
## Built-In Functions
@@ -37,3 +58,8 @@ Pipeline-only functions can only be used inside the scripts within the `pipeline
3758
Global functions can be used anywhere in `devspace.yaml`, either in config fields that expect a bash script such as within `functions` or using [`$(command)` vars](../variables/command.mdx) in any other config field.
3859

3960
<GlobalFunctionRef/>
61+
62+
63+
## Config Reference
64+
65+
<ConfigPartial/>

docs/src/css/content/code.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,22 @@
6767
padding-right: 2em;
6868
}
6969

70+
.prism-code {
71+
.token {
72+
&.key {
73+
color: rgb(45, 178, 255);
74+
75+
~ .punctuation {
76+
color: rgb(150, 150, 150) !important;
77+
}
78+
}
79+
80+
&.punctuation,
81+
&.plain {
82+
color: #fff !important;
83+
}
84+
}
85+
}
7086

7187
.markdown *:not(pre) > code,
7288
.contents code {

0 commit comments

Comments
 (0)