runsheets 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Archspec.rb +137 -0
- data/CHANGELOG.md +35 -1
- data/README.md +7 -3
- data/archspec_todo.yml +32 -0
- data/lib/runsheets/cli.rb +98 -164
- data/lib/runsheets/config/defaults.yml +0 -2
- data/lib/runsheets/config.rb +55 -16
- data/lib/runsheets/prompt.rb +62 -0
- data/lib/runsheets/runbook.rb +12 -0
- data/lib/runsheets/single_file.rb +34 -1
- data/lib/runsheets/slug.rb +19 -0
- data/lib/runsheets/step.rb +1 -1
- data/lib/runsheets/step_runner.rb +261 -0
- data/lib/runsheets/template.rb +94 -0
- data/lib/runsheets/version.rb +1 -1
- data/lib/runsheets/wizard.rb +260 -0
- data/lib/runsheets.rb +9 -4
- data/templates/asgard/.loki.erb +9 -0
- data/templates/asgard/runbook.md.erb +23 -0
- data/templates/asgard/steps/010-preflight.md.erb +13 -0
- data/templates/asgard/steps/020-do-the-work.md.erb +16 -0
- data/templates/asgard/steps/030-tell-people.md.erb +7 -0
- data/templates/asgard/tasks.loki +28 -0
- data/templates/asgard/template.yml +2 -0
- data/templates/asgard/verify.md.erb +12 -0
- data/templates/checks/runbook.md.erb +15 -0
- data/templates/checks/steps/010-tools.md.erb +17 -0
- data/templates/checks/steps/020-disk-space.md.erb +14 -0
- data/templates/checks/steps/030-writable.md.erb +13 -0
- data/templates/checks/template.yml +2 -0
- data/templates/inputs/runbook.md.erb +40 -0
- data/templates/inputs/steps/010-preflight.md.erb +15 -0
- data/templates/inputs/steps/020-use-the-inputs.md.erb +13 -0
- data/templates/inputs/steps/030-another-language.md.erb +13 -0
- data/templates/inputs/template.yml +2 -0
- data/templates/inputs/verify.md.erb +12 -0
- data/templates/rollback/rollback.md.erb +10 -0
- data/templates/rollback/runbook.md.erb +29 -0
- data/templates/rollback/steps/010-preflight.md.erb +16 -0
- data/templates/rollback/steps/020-keep-a-copy.md.erb +18 -0
- data/templates/rollback/steps/030-replace.md.erb +14 -0
- data/templates/rollback/steps/040-tell-people.md.erb +7 -0
- data/templates/rollback/template.yml +2 -0
- data/templates/rollback/verify.md.erb +15 -0
- data/templates/tasks/runbook.md.erb +29 -0
- data/templates/tasks/steps/010-preflight.md.erb +16 -0
- data/templates/tasks/steps/020-do-the-work.md.erb +18 -0
- data/templates/tasks/steps/030-tell-people.md.erb +7 -0
- data/templates/tasks/template.yml +2 -0
- data/templates/tasks/verify.md.erb +15 -0
- data/templates/timeouts/runbook.md.erb +30 -0
- data/templates/timeouts/steps/010-preflight.md.erb +16 -0
- data/templates/timeouts/steps/020-watch-progress.md.erb +13 -0
- data/templates/timeouts/steps/030-the-long-step.md.erb +20 -0
- data/templates/timeouts/steps/040-look-it-over.md.erb +14 -0
- data/templates/timeouts/template.yml +2 -0
- data/templates/timeouts/verify.md.erb +13 -0
- metadata +48 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Verify
|
|
3
|
+
kind: verify
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Whole-procedure checks. They should pass after every run, and they run on
|
|
7
|
+
their own from the Checks page.
|
|
8
|
+
|
|
9
|
+
```bash run
|
|
10
|
+
test -s "$WORK_DIR/last-run" && echo "last run: $(cat "$WORK_DIR/last-run")"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```text expect
|
|
14
|
+
last run: {{any}}
|
|
15
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: <%= yaml title %>
|
|
3
|
+
when_to_use: <%= yaml when_to_use %>
|
|
4
|
+
prerequisites:
|
|
5
|
+
- What must be true or installed before starting
|
|
6
|
+
tags: []
|
|
7
|
+
inputs:
|
|
8
|
+
- name: WORK_DIR
|
|
9
|
+
prompt: Where this runbook writes its files
|
|
10
|
+
default: /tmp/<%= name %>
|
|
11
|
+
escalation: <%= yaml escalation %>
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# <%= title %>
|
|
15
|
+
|
|
16
|
+
Checks, then the work, then proof that it worked. The preflight and
|
|
17
|
+
verify checks read; the steps between them change things. `WORK_DIR` is
|
|
18
|
+
an input: the start-run form asks for it and every block gets it as an
|
|
19
|
+
environment variable.
|
|
20
|
+
|
|
21
|
+
<% if single_file -%>
|
|
22
|
+
Everything above the first `##` heading is the preamble. Each `##` heading
|
|
23
|
+
below is a step, and its attributes (`kind`, `timeout`, ...) go in the HTML
|
|
24
|
+
comment right after the heading.
|
|
25
|
+
<% else -%>
|
|
26
|
+
Everything above the first step is the preamble. The steps are the files in
|
|
27
|
+
`steps/`, run in the order of their numbers, and each one's attributes
|
|
28
|
+
(`kind`, `timeout`, ...) are in its front matter.
|
|
29
|
+
<% end -%>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Preflight
|
|
3
|
+
kind: verify
|
|
4
|
+
timeout: 30
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Check what the later steps rely on before anything changes. A `verify`
|
|
8
|
+
step also runs on its own from the Checks page.
|
|
9
|
+
|
|
10
|
+
```bash run
|
|
11
|
+
test -n "$WORK_DIR" && echo "WORK_DIR is $WORK_DIR"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```text expect
|
|
15
|
+
WORK_DIR is {{any}}
|
|
16
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Do the work
|
|
3
|
+
kind: automated
|
|
4
|
+
timeout: 300
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
The change this runbook exists for. Replace the block with the real
|
|
8
|
+
command; keep the expected output so the operator can see it worked.
|
|
9
|
+
|
|
10
|
+
```bash run
|
|
11
|
+
mkdir -p "$WORK_DIR"
|
|
12
|
+
date -u > "$WORK_DIR/last-run"
|
|
13
|
+
echo "wrote $WORK_DIR/last-run"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```text expect
|
|
17
|
+
wrote {{any}}/last-run
|
|
18
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Verify
|
|
3
|
+
kind: verify
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Whole-procedure checks. They should pass after every run, and they run on
|
|
7
|
+
their own from the Checks page.
|
|
8
|
+
|
|
9
|
+
```bash run
|
|
10
|
+
test -s "$WORK_DIR/last-run" && echo "last run: $(cat "$WORK_DIR/last-run")"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```text expect
|
|
14
|
+
last run: {{any}}
|
|
15
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: <%= yaml title %>
|
|
3
|
+
when_to_use: <%= yaml when_to_use %>
|
|
4
|
+
prerequisites:
|
|
5
|
+
- What must be true or installed before starting
|
|
6
|
+
tags: []
|
|
7
|
+
inputs:
|
|
8
|
+
- name: WORK_DIR
|
|
9
|
+
prompt: Where this runbook writes its files
|
|
10
|
+
default: /tmp/<%= name %>
|
|
11
|
+
escalation: <%= yaml escalation %>
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# <%= title %>
|
|
15
|
+
|
|
16
|
+
Checks and tasks that take time. Each step's `timeout` is how many
|
|
17
|
+
seconds its blocks may run before they are stopped (600 when it is not
|
|
18
|
+
set). A `background` block has no timeout: it runs until it is stopped,
|
|
19
|
+
while later steps run. A `terminal` block is one the operator runs in
|
|
20
|
+
their own shell.
|
|
21
|
+
|
|
22
|
+
<% if single_file -%>
|
|
23
|
+
Everything above the first `##` heading is the preamble. Each `##` heading
|
|
24
|
+
below is a step, and its attributes (`kind`, `timeout`, ...) go in the HTML
|
|
25
|
+
comment right after the heading.
|
|
26
|
+
<% else -%>
|
|
27
|
+
Everything above the first step is the preamble. The steps are the files in
|
|
28
|
+
`steps/`, run in the order of their numbers, and each one's attributes
|
|
29
|
+
(`kind`, `timeout`, ...) are in its front matter.
|
|
30
|
+
<% end -%>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Preflight
|
|
3
|
+
kind: verify
|
|
4
|
+
timeout: 15
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Check what the later steps rely on before anything changes. A `verify`
|
|
8
|
+
step also runs on its own from the Checks page.
|
|
9
|
+
|
|
10
|
+
```bash run
|
|
11
|
+
test -n "$WORK_DIR" && echo "WORK_DIR is $WORK_DIR"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```text expect
|
|
15
|
+
WORK_DIR is {{any}}
|
|
16
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Watch the progress
|
|
3
|
+
kind: automated
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Start this before the long step. It keeps running, listed in the Running
|
|
7
|
+
panel on every page, until you stop it or the session ends.
|
|
8
|
+
|
|
9
|
+
```bash background
|
|
10
|
+
mkdir -p "$WORK_DIR"
|
|
11
|
+
touch "$WORK_DIR/progress.log"
|
|
12
|
+
tail -n 0 -F "$WORK_DIR/progress.log"
|
|
13
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: The long step
|
|
3
|
+
kind: automated
|
|
4
|
+
timeout: 120
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Give a slow step a timeout that fits it. If the block runs past 120
|
|
8
|
+
seconds, its whole process group is stopped and the step fails.
|
|
9
|
+
|
|
10
|
+
```bash run
|
|
11
|
+
for chunk in 1 2 3 4 5 6 7 8 9 10; do
|
|
12
|
+
echo "chunk $chunk" >> "$WORK_DIR/progress.log"
|
|
13
|
+
sleep 1
|
|
14
|
+
done
|
|
15
|
+
echo "done"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```text expect
|
|
19
|
+
done
|
|
20
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Look it over
|
|
3
|
+
kind: manual
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Some commands need a real terminal: a pager, a prompt, a login. A
|
|
7
|
+
`terminal` block has no Run button; run it yourself, then press
|
|
8
|
+
**I ran this**, with a note if anything stood out.
|
|
9
|
+
|
|
10
|
+
```bash terminal
|
|
11
|
+
less "$WORK_DIR/progress.log"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Stop the background tail from the Running panel when you are done.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runsheets
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dewayne VanHoozer
|
|
@@ -135,9 +135,11 @@ executables:
|
|
|
135
135
|
extensions: []
|
|
136
136
|
extra_rdoc_files: []
|
|
137
137
|
files:
|
|
138
|
+
- Archspec.rb
|
|
138
139
|
- CHANGELOG.md
|
|
139
140
|
- LICENSE.txt
|
|
140
141
|
- README.md
|
|
142
|
+
- archspec_todo.yml
|
|
141
143
|
- bin/runsheets
|
|
142
144
|
- examples/about-the-examples.md
|
|
143
145
|
- examples/directory_based_runbooks/hello/rollback.md
|
|
@@ -184,6 +186,7 @@ files:
|
|
|
184
186
|
- lib/runsheets/pages/chooser.rb
|
|
185
187
|
- lib/runsheets/pages/search.rb
|
|
186
188
|
- lib/runsheets/pages/tree.rb
|
|
189
|
+
- lib/runsheets/prompt.rb
|
|
187
190
|
- lib/runsheets/redactor.rb
|
|
188
191
|
- lib/runsheets/renderer.rb
|
|
189
192
|
- lib/runsheets/run.rb
|
|
@@ -193,10 +196,54 @@ files:
|
|
|
193
196
|
- lib/runsheets/session.rb
|
|
194
197
|
- lib/runsheets/session_log.rb
|
|
195
198
|
- lib/runsheets/single_file.rb
|
|
199
|
+
- lib/runsheets/slug.rb
|
|
196
200
|
- lib/runsheets/step.rb
|
|
201
|
+
- lib/runsheets/step_runner.rb
|
|
202
|
+
- lib/runsheets/template.rb
|
|
197
203
|
- lib/runsheets/version.rb
|
|
198
204
|
- lib/runsheets/web.rb
|
|
205
|
+
- lib/runsheets/wizard.rb
|
|
199
206
|
- sig/runsheets.rbs
|
|
207
|
+
- templates/asgard/.loki.erb
|
|
208
|
+
- templates/asgard/runbook.md.erb
|
|
209
|
+
- templates/asgard/steps/010-preflight.md.erb
|
|
210
|
+
- templates/asgard/steps/020-do-the-work.md.erb
|
|
211
|
+
- templates/asgard/steps/030-tell-people.md.erb
|
|
212
|
+
- templates/asgard/tasks.loki
|
|
213
|
+
- templates/asgard/template.yml
|
|
214
|
+
- templates/asgard/verify.md.erb
|
|
215
|
+
- templates/checks/runbook.md.erb
|
|
216
|
+
- templates/checks/steps/010-tools.md.erb
|
|
217
|
+
- templates/checks/steps/020-disk-space.md.erb
|
|
218
|
+
- templates/checks/steps/030-writable.md.erb
|
|
219
|
+
- templates/checks/template.yml
|
|
220
|
+
- templates/inputs/runbook.md.erb
|
|
221
|
+
- templates/inputs/steps/010-preflight.md.erb
|
|
222
|
+
- templates/inputs/steps/020-use-the-inputs.md.erb
|
|
223
|
+
- templates/inputs/steps/030-another-language.md.erb
|
|
224
|
+
- templates/inputs/template.yml
|
|
225
|
+
- templates/inputs/verify.md.erb
|
|
226
|
+
- templates/rollback/rollback.md.erb
|
|
227
|
+
- templates/rollback/runbook.md.erb
|
|
228
|
+
- templates/rollback/steps/010-preflight.md.erb
|
|
229
|
+
- templates/rollback/steps/020-keep-a-copy.md.erb
|
|
230
|
+
- templates/rollback/steps/030-replace.md.erb
|
|
231
|
+
- templates/rollback/steps/040-tell-people.md.erb
|
|
232
|
+
- templates/rollback/template.yml
|
|
233
|
+
- templates/rollback/verify.md.erb
|
|
234
|
+
- templates/tasks/runbook.md.erb
|
|
235
|
+
- templates/tasks/steps/010-preflight.md.erb
|
|
236
|
+
- templates/tasks/steps/020-do-the-work.md.erb
|
|
237
|
+
- templates/tasks/steps/030-tell-people.md.erb
|
|
238
|
+
- templates/tasks/template.yml
|
|
239
|
+
- templates/tasks/verify.md.erb
|
|
240
|
+
- templates/timeouts/runbook.md.erb
|
|
241
|
+
- templates/timeouts/steps/010-preflight.md.erb
|
|
242
|
+
- templates/timeouts/steps/020-watch-progress.md.erb
|
|
243
|
+
- templates/timeouts/steps/030-the-long-step.md.erb
|
|
244
|
+
- templates/timeouts/steps/040-look-it-over.md.erb
|
|
245
|
+
- templates/timeouts/template.yml
|
|
246
|
+
- templates/timeouts/verify.md.erb
|
|
200
247
|
homepage: https://github.com/madbomber/runsheets
|
|
201
248
|
licenses:
|
|
202
249
|
- MIT
|