Skip to content

Commit 08b7a4f

Browse files
committed
chore: doc updates
1 parent 79a8e36 commit 08b7a4f

File tree

4 files changed

+76
-67
lines changed

4 files changed

+76
-67
lines changed

canary-checker/docs/scripting/gotemplate.md renamed to canary-checker/docs/scripting/gotemplate.mdx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# Go Templates
1+
import GoTemplate from '@site/docs/partials/_gotemplate.md'
22

3-
<!-- // cspell:ignore conv, strconv,Ints -->
3+
# Go Templates
44

55
`template` expressions use the [Go Text Template](https://pkg.go.dev/text/template) library with some additional functions provided by the [gomplate](https://docs.gomplate.ca/) library.
6-
In this example we get the current exchange rate:
6+
7+
In this example we print out the exchange rates returned by an HTTP API Call
78

89
```yaml title="display-with-gotemplate.yaml"
910
apiVersion: canaries.flanksource.com/v1
@@ -18,20 +19,10 @@ spec:
1819
template: '$1 = €{{.json.rates.EUR}}, £{{.json.rates.GBP}}, ₪{{.json.rates.ILS}}'
1920
```
2021
21-
## Escaping
22+
<p/>
2223
23-
In case you might need to pass in a template variable without templating it, then you can put the template inside a string.
24-
Example:
24+
<GoTemplate/>
2525
26-
```
27-
{{ .secret }}
28-
```
29-
30-
To send `{{ .secret }}` as it is do this
31-
32-
```
33-
{{`{{ .secret }}`}}
34-
```
3526
3627
## base64
3728

canary-checker/docs/windows.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ In order to run Canary Checker on windows please ensure the following
1616
2. You must be able to execute the powershell install script as a local administrator
1717
3. Canary Checker uses an embedded Postgress DB which requires [Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.38.33130](https://www.microsoft.com/en-us/Download/confirmation.aspx?id=52685)
1818

19-
4. Canary checker uses port 8080 (can be changed) for the HTTP API and port 6432 for the embedded posgres sql server , ensure these ports are free
19+
4. Canary checker uses port 8080 (can be changed) for the HTTP API and port 6432 for the embedded postgresql server , ensure these ports are free
2020

2121
## 2. Downloading required files
2222

@@ -56,13 +56,12 @@ To test our canary config without installing it, use the below
5656
```
5757

5858
## 4. Install Canary Checker as a service
59-
60-
The powershell install script is able to download all requirements , if the windows machine does not have internet accesss you will need to manually download the [prerequisites](/##-1.-check-prerequisites) and place them in the script folder.
59+
The powershell install script is able to download all requirements , if the windows machine does not have internet access you will need to manually download the [prerequisites](/##-1.-check-prerequisites) and place them in the script folder.
6160

6261
```
6362
.\install-service.ps1 -configfile .\canary-checker.yaml -operation install
6463
```
6564

6665
Note: Add `-httpPort 8081` to change http port (default is 8080)
6766

68-
Note: You can use the `-operation uninstall` to remove the service Or `-operation reinstall` to overwrite an exiting install
67+
Note: You can use the ```-operation uninstall``` to remove the service Or ```-operation reinstall``` to overwrite an exiting install
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<Details summary="Switching scripting language">
2+
3+
Use a shebang (`#!`) line to choose a different shell (`python`, `bash` and `pwsh` are included in the base image)
4+
5+
```yaml
6+
exec:
7+
script: |
8+
//highlight-next-line
9+
#! pwsh
10+
Get-Items | ConvertTo-JSON
11+
```
12+
13+
</Details>
14+
15+
<Details summary="Escaping templates in Helm Charts">
16+
17+
If you need to pass a template through a Helm Chart and prevent Helm from templating you need to escape it:
18+
19+
```
20+
{{`{{ .secret }}`}}
21+
```
22+
23+
Alternatively [change the templating delimiters](#changing-templating-delimiters)
24+
25+
</Details>
26+
27+
<Details summary="Multiline handling with YAML">
28+
29+
If you are using a YAML multiline string use `|` and not `>` which will strip newlines
30+
31+
Instead of:
32+
```yaml
33+
exec:
34+
//highlight-next-line
35+
script: >
36+
#! pwsh
37+
Get-Items | ConvertTo-JSON
38+
```
39+
Do this:
40+
```yaml
41+
exec:
42+
//highlight-next-line
43+
script: |
44+
#! pwsh
45+
Get-Items | ConvertTo-JSON
46+
```
47+
</Details>
48+
49+
50+
<Details summary="Changing templating delimiters">
51+
52+
The template delimiters can be changed from the defaults of `$()` and `{{}}` with `gotemplate` comments
53+
54+
```yaml
55+
exec:
56+
script: |
57+
#! pwsh
58+
//highlight-next-line
59+
# gotemplate: left-delim=$[[ right-delim=]]
60+
$message = "$[[.config.name]]"
61+
Write-Host "{{ $message }}"
62+
Write-Host @{ Number = 1; Shape = "Square"; Color = "Blue"} | ConvertTo-JSON
63+
```
64+
</Details>

mission-control/docs/playbooks/Actions/exec.mdx

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Exec
33
---
44
import Templating from "../../reference/playbooks/context.mdx"
5-
5+
import GoTemplate from '@site/docs/partials/_gotemplate.md'
66

77
# <Icon name="console"/> Exec Action
88

@@ -23,61 +23,16 @@ Exec action allows you to executes a command or a script file on the target host
2323
{field: 'connections', scheme: '[Connections](#connections)', description: 'Connections used by the action'}
2424
]}/>
2525

26-
27-
:::note Powershell
28-
Shebang lines are supported to choose a different shell (`python`, `bash` and `pwsh` are included in the base image)
29-
```yaml
30-
exec:
31-
script: |
32-
#! pwsh
33-
Get-Items | ConvertTo-JSON
34-
```
35-
:::
36-
37-
::: note Multiline
38-
If you are using YAML multiline string use `|` and not `>` which will strip newlines
39-
40-
41-
Instead of:
42-
```
43-
exec:
44-
script: >
45-
//highlight-nextline
46-
#! pwsh
47-
Get-Items | ConvertTo-JSON
48-
```
49-
50-
Do this:
51-
```
52-
exec:
53-
//highlight-nextline
54-
script: |
55-
#! pwsh
56-
Get-Items | ConvertTo-JSON
57-
```
58-
:::
59-
60-
6126
## Templating
6227

63-
Scripts are templatable with [Go Templates](/reference/script/gotemplate)
28+
Scripts are templatable with [Go Templates](/reference/scripting/gotemplate)
6429

6530
```yaml
6631
exec:
6732
script: kubectl rollout release deployment -n $(.config.tags.namespace) $(.conf
6833
```
6934
70-
The template delimiters can be changed from the defaults of `$()` and `{{}}` with `gotemplate` comments
71-
72-
```yaml
73-
exec:
74-
script: |
75-
#! pwsh
76-
# gotemplate: left-delim=$[[ right-delim=]]
77-
$message = "$[[.config.name]]"
78-
Write-Host "{{ $message }}"
79-
Write-Host @{ Number = 1; Shape = "Square"; Color = "Blue"} | ConvertTo-JSON
80-
```
35+
<GoTemplate/>
8136
8237
8338
### Connections

0 commit comments

Comments
 (0)