Skip to content

Commit

Permalink
Add masOS compatibility for 'sed' usage in scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Schmid <[email protected]>
  • Loading branch information
PhilipSchmid committed Dec 5, 2023
1 parent 6ab6d21 commit cca66f7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
18 changes: 11 additions & 7 deletions api/export-doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@ cp v1/README.md $TMP_FILE

# cleanup the generated documentation for the website
# remove the link to the top of the page
sed -i '/<p align="right"><a href="#top">Top<\/a><\/p>/d' $TMP_FILE
sed -i '/<a name="top"><\/a>/d' $TMP_FILE
sed -i'' -e '/<p align="right"><a href="#top">Top<\/a><\/p>/d' $TMP_FILE
sed -i'' -e '/<a name="top"><\/a>/d' $TMP_FILE
# remove title
sed -i '/^# Protocol Documentation/d' $TMP_FILE
sed -i'' -e '/^# Protocol Documentation/d' $TMP_FILE
# remove table of content
sed -i -e '/## Table of Contents/,/##/{//!d}' $TMP_FILE
sed -i '/^## Table of Contents/d' $TMP_FILE
sed -i'' -e '/## Table of Contents/,/##/{//!d;}' $TMP_FILE
sed -i'' -e '/^## Table of Contents/d' $TMP_FILE
# cleanup unecessary consecutive whitelines
sed -i '/^[[:space:]]*$/N;/^[[:space:]]*\n[[:space:]]*$/D' $TMP_FILE
sed -i'' -e '/^[[:space:]]*$/N;/^[[:space:]]*\n[[:space:]]*$/D' $TMP_FILE
# remove empty line at the end of the file (required for macOS, doesn't harm on Linux)
sed -i'' -e '${/^$/d;}' $TMP_FILE

# Cleanup backup file that might be created by macOS sed:
rm ${TMP_FILE}-e 2>/dev/null || true

# add a frontmatter and a small introduction
echo '---
Expand All @@ -42,4 +47,3 @@ The Tetragon API is an independant Go module that can be found in the Tetragon
repository under [api](https://github.com/cilium/tetragon/tree/main/api). The
version 1 of this API is defined in
[github.com/cilium/tetragon/api/v1/tetragon](https://github.com/cilium/tetragon/tree/main/api/v1/tetragon).' | cat - $TMP_FILE > $1

1 change: 0 additions & 1 deletion docs/content/en/docs/reference/grpc-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -975,4 +975,3 @@ Determins the behaviour of a field filter
| <a name="bool" /> bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass |
| <a name="string" /> string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) |
| <a name="bytes" /> bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) |

3 changes: 1 addition & 2 deletions docs/content/en/docs/reference/helm-chart.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This page was generated with github.io/cilium/tetragon/install/kubernetes/export
please do not edit directly.
{{< /comment >}}

The Tetragon Helm chart source is available under
The Tetragon Helm chart source is available under
[github.io/cilium/tetragon/install/kubernetes](https://github.com/cilium/tetragon/tree/main/install/kubernetes)
and is distributed from the Cilium helm charts repository [helm.cilium.io](https://helm.cilium.io).

Expand Down Expand Up @@ -107,4 +107,3 @@ To use [the values available](#values), with `helm install` or `helm upgrade`, u
| tetragonOperator.skipCRDCreation | bool | `false` | |
| tolerations[0].operator | string | `"Exists"` | |
| updateStrategy | object | `{}` | |

19 changes: 11 additions & 8 deletions install/kubernetes/export-doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,22 @@ cp README.md $TMP_FILE

# cleanup the generated documentation for the website
# remove the title
sed -i '/^# tetragon$/d' $TMP_FILE
sed -i'' -e '/^# tetragon$/d' $TMP_FILE
# remove the badges
sed -i '/^\!\[Version:/d' $TMP_FILE
sed -i'' -e '/^\!\[Version:/d' $TMP_FILE
# remove the "Helm chart for Tetragon mention"
sed -i '/^Helm chart for Tetragon$/d' $TMP_FILE
sed -i'' -e '/^Helm chart for Tetragon$/d' $TMP_FILE
# remove unnecessary line
sed -i '/^----------------------------------------------$/d' $TMP_FILE
sed -i'' -e '/^----------------------------------------------$/d' $TMP_FILE
# remove autogenerated copyright
sed -i '/^Autogenerated from chart metadata using \[helm-docs /d' $TMP_FILE
sed -i'' -e '/^Autogenerated from chart metadata using \[helm-docs /d' $TMP_FILE
# cleanup unecessary consecutive whitelines
sed -i '/^[[:space:]]*$/N;/^[[:space:]]*\n[[:space:]]*$/D' $TMP_FILE
sed -i'' -e '/^[[:space:]]*$/N;/^[[:space:]]*\n[[:space:]]*$/D' $TMP_FILE
# remove empty line at the end of the file (required for macOS, doesn't harm on Linux)
sed -i'' -e '${/^$/d;}' $TMP_FILE

# Cleanup backup file that might be created by macOS sed:
rm ${TMP_FILE}-e 2>/dev/null || true

# add a frontmatter and a small introduction
echo '---
Expand All @@ -39,7 +43,7 @@ This page was generated with github.io/cilium/tetragon/install/kubernetes/export
please do not edit directly.
{{< /comment >}}
The Tetragon Helm chart source is available under
The Tetragon Helm chart source is available under
[github.io/cilium/tetragon/install/kubernetes](https://github.com/cilium/tetragon/tree/main/install/kubernetes)
and is distributed from the Cilium helm charts repository [helm.cilium.io](https://helm.cilium.io).
Expand All @@ -51,4 +55,3 @@ helm install tetragon cilium/tetragon -n kube-system
```
To use [the values available](#values), with `helm install` or `helm upgrade`, use `--set key=value`.' | cat - $TMP_FILE > $1

0 comments on commit cca66f7

Please sign in to comment.