Skip to content

Commit 04c82e1

Browse files
committed
Final slides for 20260512
1 parent e912a47 commit 04c82e1

15 files changed

Lines changed: 23276 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!-- .slide: id="bio" -->
2+
3+
## Nicholas Dille
4+
5+
<img src="images/NicholasDille.jpg" style="width: 25%; float: right; border-radius: 8px;" />
6+
7+
**Husband, father, geek, trumpeteer**
8+
9+
`#k8s` `#o11y` `#cicd` `#go`
10+
11+
- <span class="fa-li"><i class="fa-duotone fa-globe"></i></span> [Blogger][1] since 2003
12+
- <span class="fa-li"><i class="fa-duotone fa-microphone"></i></span> [Speaker][2] since 2009
13+
- <span class="fa-li"><i class="fa-duotone fa-briefcase"></i></span> [Haufe Group][3] since 2016
14+
- <span class="fa-li"><i class="fa-duotone fa-person-chalkboard"></i></span> Self-employed [trainer][1] since 2020
15+
- <span class="fa-li"><i class="fa-duotone fa-user-helmet-safety"></i></span> Maintainer of [uniget][4] since 2021
16+
17+
*Reach out via* [<i class="fa-brands fa-linkedin"></i>][5] [<i class="fa-brands fa-mastodon"></i>][6] [<i class="fa-brands fa-bluesky"></i>][7] [<i class="fa-brands fa-github"></i>][8] [<i class="fa-brands fa-gitlab"></i>][9]
18+
19+
[1]: https://dille.name
20+
[2]: https://dille.name/blog/tags/#Slides
21+
[3]: https://haufegroup.com
22+
[4]: https://uniget.dev
23+
[5]: https://www.linkedin.com/in/nicholasdille/
24+
[6]: https://freiburg.social/@nicholasdille
25+
[7]: https://bsky.app/profile/nicholasdille.bsky.social
26+
[8]: https://github.com/nicholasdille
27+
[9]: https://gitlab.com/nicholasdille
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<i class="fa fa-solid fa-shuffle fa-8x"></i> <!-- .element: style="float: right;" -->
2+
3+
## Alternatives
4+
5+
---
6+
7+
<i class="fa fa-solid fa-shuffle fa-4x"></i> <!-- .element: style="float: right;" -->
8+
9+
## Alternatives
10+
11+
### High-level programming language
12+
13+
For example: Go, Rust, Java, C#
14+
15+
### When to switch
16+
17+
- Parsing of structured files
18+
- Length
19+
- Readability
20+
- Portability
21+
- Performance
22+
23+
Think about a custom CLI <i class="fa fa-solid fa-wand-magic-sparkles"></i>
24+
25+
---
26+
27+
<i class="fa fa-solid fa-shuffle fa-4x"></i> <!-- .element: style="float: right;" -->
28+
29+
## Alternatives
30+
31+
### Script languages
32+
33+
For example: Python, Ruby, Perl, PowerShell
34+
35+
The runtime becomes a hard dependency
36+
37+
### When to switch
38+
39+
- Parsing of structured files
40+
- Length
41+
- Readability
42+
- Portability
43+
- Performance
44+
45+
---
46+
47+
<i class="fa fa-solid fa-shuffle fa-4x"></i> <!-- .element: style="float: right;" -->
48+
49+
## Alternatives
50+
51+
### Wrap in `Dockerfile`
52+
53+
Manages the runtime environment
54+
55+
Creates shippable unit
56+
57+
Intermediate step before switching to another language
58+
59+
### When to switch
60+
61+
- Portability
62+
63+
---
64+
65+
<i class="fa fa-solid fa-shuffle fa-4x"></i> <!-- .element: style="float: right;" -->
66+
67+
## Alternatives
68+
69+
### Abstraction
70+
71+
Consume logic from existing tools
72+
73+
### For example
74+
75+
Terraform / OpenTofu
76+
77+
Docker Compose
78+
79+
Ansible
80+
81+
---
82+
83+
<i class="fa fa-solid fa-shuffle fa-4x"></i> <!-- .element: style="float: right;" -->
84+
85+
## Alternatives
86+
87+
### Simplify
88+
89+
Complexity caused by design decisions
90+
91+
### For example
92+
93+
`xmlstarlet` is great for processing XML/XHTML
94+
95+
Excessive use sacrifices readability and performance
96+
97+
Templating can be an alternative, e.g. `gomplate`
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
<i class="fa fa-solid fa-poo-storm fa-8x"></i> <!-- .element: style="float: right;" -->
2+
3+
## Error Handling
4+
5+
---
6+
7+
<i class="fa fa-solid fa-poo-storm fa-4x"></i> <!-- .element: style="float: right;" -->
8+
9+
## Error Handling
10+
11+
### `errexit` is not enough
12+
13+
Break when a command fails:
14+
15+
```bash
16+
# Enable errexit (short version)
17+
set -e
18+
19+
# Enable errexit (long version)
20+
set -o errexit
21+
```
22+
23+
Often you want to handle the error gracefully
24+
25+
Use `errexit` in addition to error handling
26+
27+
---
28+
29+
<i class="fa fa-solid fa-poo-storm fa-4x"></i> <!-- .element: style="float: right;" -->
30+
31+
## Error Handling
32+
33+
### Errors must be handled
34+
35+
Do not suppress errors:
36+
37+
```bash
38+
test -f missing_file_name || true
39+
```
40+
41+
This rarely makes sense!
42+
43+
---
44+
45+
<i class="fa fa-solid fa-poo-storm fa-4x"></i> <!-- .element: style="float: right;" -->
46+
47+
## Error Handling
48+
49+
### Use `if` for error handling
50+
51+
Maps to `true` except when return code > 0:
52+
53+
```bash
54+
# Check if file exists
55+
if test -f missing_file_name; then
56+
echo "File exists"
57+
else
58+
echo "File is missing"
59+
fi
60+
```
61+
62+
...works for any tool:
63+
64+
```bash
65+
# Check for pattern in file
66+
if grep --quiet pattern file; then
67+
echo "Pattern exists in file"
68+
else
69+
echo "Pattern does not exist in file"
70+
fi
71+
```
72+
73+
---
74+
75+
<i class="fa fa-solid fa-poo-storm fa-4x"></i> <!-- .element: style="float: right;" -->
76+
77+
## Error Handling
78+
79+
### Know your tools
80+
81+
`curl` signals success if it completed:
82+
83+
```bash
84+
if curl http://example.com; then
85+
echo "Succeeded for any HTTP response"
86+
fi
87+
```
88+
89+
Tell `curl` to `--fail` on HTTP errors (>= 400):
90+
91+
```bash
92+
if curl --fail http://example.com; then
93+
echo "Succeeded only for HTTP 2xx"
94+
fi
95+
```
96+
97+
---
98+
99+
<i class="fa fa-solid fa-poo-storm fa-4x"></i> <!-- .element: style="float: right;" -->
100+
101+
## Error Handling
102+
103+
### Handle missing variables
104+
105+
Break on unset variables:
106+
107+
```bash
108+
set -o nounset
109+
110+
# This fails
111+
echo $foo
112+
```
113+
114+
Exposes typos in variable names
115+
116+
---
117+
118+
<i class="fa fa-solid fa-poo-storm fa-4x"></i> <!-- .element: style="float: right;" -->
119+
120+
## Error Handling
121+
122+
### Pipes mask errors
123+
124+
`errexit` only catches the exit code of the last command:
125+
126+
```bash
127+
set -o errexit
128+
129+
false | cat
130+
echo "This is executed"
131+
```
132+
133+
Enable `pipefail` to catch errors in pipelines:
134+
135+
```bash
136+
set -o errexit
137+
set -o pipefail
138+
139+
false | cat
140+
echo "This is NOT executed"
141+
```

0 commit comments

Comments
 (0)