careacademy-runbook 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.dockerignore +17 -0
- data/.github/workflows/ruby.yml +43 -0
- data/.gitignore +16 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Appraisals +8 -0
- data/CHANGELOG.md +143 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +1272 -0
- data/Rakefile +12 -0
- data/TODO.md +316 -0
- data/bin/console +16 -0
- data/bin/setup +8 -0
- data/dockerfiles/Dockerfile-runbook +18 -0
- data/dockerfiles/Dockerfile-sshd +4 -0
- data/examples/hooks_runbook.rb +72 -0
- data/examples/layout_runbook.rb +26 -0
- data/examples/restart_nginx.rb +26 -0
- data/examples/simple_runbook.rb +41 -0
- data/examples/suppress_capture_output.rb +47 -0
- data/exe/runbook +5 -0
- data/gemfiles/.bundle/config +2 -0
- data/gemfiles/activesupport_5.gemfile +7 -0
- data/gemfiles/activesupport_6.gemfile +7 -0
- data/images/runbook_anatomy_diagram.png +0 -0
- data/images/runbook_example.gif +0 -0
- data/images/runbook_execution_modes.png +0 -0
- data/lib/hacks/ssh_kit.rb +58 -0
- data/lib/runbook/airbrussh_context.rb +25 -0
- data/lib/runbook/cli.rb +115 -0
- data/lib/runbook/cli_base.rb +38 -0
- data/lib/runbook/configuration.rb +120 -0
- data/lib/runbook/dsl.rb +21 -0
- data/lib/runbook/entities/book.rb +17 -0
- data/lib/runbook/entities/section.rb +7 -0
- data/lib/runbook/entities/setup.rb +7 -0
- data/lib/runbook/entities/step.rb +7 -0
- data/lib/runbook/entity.rb +129 -0
- data/lib/runbook/errors.rb +7 -0
- data/lib/runbook/extensions/add.rb +14 -0
- data/lib/runbook/extensions/description.rb +14 -0
- data/lib/runbook/extensions/sections.rb +19 -0
- data/lib/runbook/extensions/setup.rb +17 -0
- data/lib/runbook/extensions/shared_variables.rb +51 -0
- data/lib/runbook/extensions/ssh_config.rb +78 -0
- data/lib/runbook/extensions/statements.rb +31 -0
- data/lib/runbook/extensions/steps.rb +24 -0
- data/lib/runbook/extensions/tmux.rb +13 -0
- data/lib/runbook/generator.rb +38 -0
- data/lib/runbook/generators/base.rb +45 -0
- data/lib/runbook/generators/dsl_extension/dsl_extension.rb +29 -0
- data/lib/runbook/generators/dsl_extension/templates/dsl_extension.tt +25 -0
- data/lib/runbook/generators/generator/generator.rb +43 -0
- data/lib/runbook/generators/generator/templates/generator.tt +53 -0
- data/lib/runbook/generators/project/project.rb +301 -0
- data/lib/runbook/generators/project/templates/Gemfile.tt +6 -0
- data/lib/runbook/generators/project/templates/README.md.tt +29 -0
- data/lib/runbook/generators/project/templates/Runbookfile.tt +11 -0
- data/lib/runbook/generators/project/templates/base_file.rb.tt +8 -0
- data/lib/runbook/generators/runbook/runbook.rb +22 -0
- data/lib/runbook/generators/runbook/templates/runbook.tt +20 -0
- data/lib/runbook/generators/statement/statement.rb +18 -0
- data/lib/runbook/generators/statement/templates/statement.tt +34 -0
- data/lib/runbook/helpers/format_helper.rb +11 -0
- data/lib/runbook/helpers/ssh_kit_helper.rb +143 -0
- data/lib/runbook/helpers/tmux_helper.rb +176 -0
- data/lib/runbook/hooks.rb +88 -0
- data/lib/runbook/initializer.rb +85 -0
- data/lib/runbook/node.rb +33 -0
- data/lib/runbook/run.rb +290 -0
- data/lib/runbook/runner.rb +66 -0
- data/lib/runbook/runs/ssh_kit.rb +193 -0
- data/lib/runbook/statement.rb +20 -0
- data/lib/runbook/statements/ask.rb +12 -0
- data/lib/runbook/statements/assert.rb +34 -0
- data/lib/runbook/statements/capture.rb +14 -0
- data/lib/runbook/statements/capture_all.rb +14 -0
- data/lib/runbook/statements/command.rb +11 -0
- data/lib/runbook/statements/confirm.rb +10 -0
- data/lib/runbook/statements/description.rb +9 -0
- data/lib/runbook/statements/download.rb +12 -0
- data/lib/runbook/statements/layout.rb +10 -0
- data/lib/runbook/statements/note.rb +10 -0
- data/lib/runbook/statements/notice.rb +10 -0
- data/lib/runbook/statements/ruby_command.rb +9 -0
- data/lib/runbook/statements/tmux_command.rb +11 -0
- data/lib/runbook/statements/upload.rb +12 -0
- data/lib/runbook/statements/wait.rb +10 -0
- data/lib/runbook/toolbox.rb +37 -0
- data/lib/runbook/util/repo.rb +57 -0
- data/lib/runbook/util/runbook.rb +43 -0
- data/lib/runbook/util/sticky_hash.rb +26 -0
- data/lib/runbook/util/stored_pose.rb +55 -0
- data/lib/runbook/version.rb +3 -0
- data/lib/runbook/view.rb +24 -0
- data/lib/runbook/viewer.rb +24 -0
- data/lib/runbook/views/markdown.rb +117 -0
- data/lib/runbook.rb +140 -0
- data/runbook.gemspec +53 -0
- metadata +419 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9db1dc37a0939d3c24a9d2358ce5855e17d366ab915817267cad5610d4c4739b
|
4
|
+
data.tar.gz: 5b04e702b59b86941804e1cf900f4292dc251aa94a2bd193ef8e50429824d4da
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 91312ee5181c72f8ee8c81bd9819be5c2bbad1a3b27f942129c31a542fe6a7b34e1ea742cbf817616011c69a91ec07855073173e8e8ce37d3c8e6ca3ae74d8fd
|
7
|
+
data.tar.gz: e8b3001e04229148dc45c08983f2e4dbdcf6eed98569882fdaaec1b3c10f97cccb806dcd0a90d402d36543fd60203aec945eb59be666c6fc2902062cf3c4d4c3
|
data/.dockerignore
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
**/.git
|
2
|
+
/.bundle/
|
3
|
+
/.yardoc
|
4
|
+
/Gemfile.lock
|
5
|
+
/_yardoc/
|
6
|
+
/coverage/
|
7
|
+
/doc/
|
8
|
+
/pkg/
|
9
|
+
/spec/reports/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
# rspec failure tracking
|
13
|
+
.rspec_status
|
14
|
+
|
15
|
+
# recommended:
|
16
|
+
# https://github.com/thoughtbot/appraisal#version-control
|
17
|
+
gemfiles/*.gemfile.lock
|
@@ -0,0 +1,43 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
|
12
|
+
runs-on: ubuntu-20.04
|
13
|
+
|
14
|
+
strategy:
|
15
|
+
fail-fast: false
|
16
|
+
matrix:
|
17
|
+
exclude:
|
18
|
+
- ruby-version: 2.3.8
|
19
|
+
gemfile: gemfiles/activesupport_6.gemfile
|
20
|
+
- ruby-version: 2.4.10
|
21
|
+
gemfile: gemfiles/activesupport_6.gemfile
|
22
|
+
gemfile:
|
23
|
+
- gemfiles/activesupport_5.gemfile
|
24
|
+
- gemfiles/activesupport_6.gemfile
|
25
|
+
ruby-version:
|
26
|
+
- 2.3.8
|
27
|
+
- 2.4.10
|
28
|
+
- 2.5
|
29
|
+
- 2.6
|
30
|
+
- 2.7
|
31
|
+
- '3.0' # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
|
32
|
+
env:
|
33
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
34
|
+
steps:
|
35
|
+
- uses: actions/checkout@v2
|
36
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
37
|
+
uses: ruby/setup-ruby@v1
|
38
|
+
with:
|
39
|
+
ruby-version: ${{ matrix.ruby-version }}
|
40
|
+
- name: Install dependencies
|
41
|
+
run: bundle install
|
42
|
+
- name: Run tests
|
43
|
+
run: bundle exec rake spec_all
|
data/.gitignore
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
|
11
|
+
# rspec failure tracking
|
12
|
+
.rspec_status
|
13
|
+
|
14
|
+
# recommended:
|
15
|
+
# https://github.com/thoughtbot/appraisal#version-control
|
16
|
+
gemfiles/*.gemfile.lock
|
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
runbook
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-3.0.6
|
data/Appraisals
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
# Runbook Changelog
|
2
|
+
|
3
|
+
This log maintains a list of all substantive changes to Runbook. The log includes changes in reverse chronological order.
|
4
|
+
|
5
|
+
## master
|
6
|
+
|
7
|
+
## `v1.1.0` (2021-05-21)
|
8
|
+
|
9
|
+
### Breaking Changes:
|
10
|
+
|
11
|
+
* Removes `runbook install` (should have happened in v1.0.0)
|
12
|
+
* Drops support for Ruby 2.2 and bundler < 2.2
|
13
|
+
|
14
|
+
### Features:
|
15
|
+
|
16
|
+
* Add support for Ruby 3.0.0 (thanks @pblesi!)
|
17
|
+
* Add metadata argument that saves TMUX panes: keep_panes (thanks @ClashTheBunny)
|
18
|
+
|
19
|
+
### Documentation:
|
20
|
+
|
21
|
+
* Update assert parameters description
|
22
|
+
* Update example for module class method (thanks @voodoologic!)
|
23
|
+
|
24
|
+
## `v1.0.0` (2020-07-24)
|
25
|
+
|
26
|
+
### Breaking Changes:
|
27
|
+
|
28
|
+
* Commands and tmux commands that previously escaped single quotes will now require un-escaped single quotes
|
29
|
+
|
30
|
+
### Features:
|
31
|
+
|
32
|
+
* Add Node#parent_entity to find the containinng entity for a node
|
33
|
+
|
34
|
+
### Fixes:
|
35
|
+
|
36
|
+
* Fix bugs requiring escaping single quotes in commands and tmux_commands (BACKWARDS INCOMPATIBLE CHANGE)
|
37
|
+
* Fix `File.exists?` deprecation warning (Thanks onk!)
|
38
|
+
|
39
|
+
### Documentation:
|
40
|
+
|
41
|
+
* Add suppress_capture_output.rb runbook example
|
42
|
+
|
43
|
+
## `v0.16.1` (2019-11-25)
|
44
|
+
|
45
|
+
### Fixes:
|
46
|
+
|
47
|
+
* Fix bug preventing skipping of steps not nested in sections (Thanks celeen!)
|
48
|
+
|
49
|
+
## `v0.16.0` (2019-11-22)
|
50
|
+
|
51
|
+
### Fixes:
|
52
|
+
|
53
|
+
* Add better error messages for runtime values accessed at compile time
|
54
|
+
|
55
|
+
### New Features
|
56
|
+
|
57
|
+
* Add entity tags and labels
|
58
|
+
* Add `setup` entity for initial runbook setup code
|
59
|
+
* Add `Runbook.views` method for accessing an array of all defined views
|
60
|
+
* Add airbrussh context for better ssh_kit output
|
61
|
+
* Backtick "into" targets in markdown view output (Thanks fwolfst!)
|
62
|
+
|
63
|
+
## `v0.15.0` (2019-09-29)
|
64
|
+
|
65
|
+
### Fixes:
|
66
|
+
|
67
|
+
* Halt the project generator if gem generation fails
|
68
|
+
* Replace timeout_statement with abort_statement for assert statements
|
69
|
+
* Make runbook state files only readable by the current user
|
70
|
+
* Allow / characters in the title of a runbook (Thanks brafales!)
|
71
|
+
|
72
|
+
### New Features
|
73
|
+
|
74
|
+
* Allow books to have steps as children
|
75
|
+
* Allow "echo: false" for ask statements
|
76
|
+
* Expose "run" as an argument to ruby_commands
|
77
|
+
|
78
|
+
## `v0.14.0` (2019-08-15)
|
79
|
+
|
80
|
+
### Fixes:
|
81
|
+
|
82
|
+
* Relax gem dependencies to be compatible with gems up to the next major version
|
83
|
+
|
84
|
+
### New Features
|
85
|
+
|
86
|
+
* Alias `install` cli command to `init`
|
87
|
+
* Add `Runbook.config` alias for `Runbook.configuration`
|
88
|
+
|
89
|
+
## `v0.13.0` (2019-07-10)
|
90
|
+
|
91
|
+
### Potentially Breaking Changes:
|
92
|
+
|
93
|
+
* Uses of Runbook that expect the CLI to return a zero exit code may exhibit different behavior if their runbook encounters an error.
|
94
|
+
|
95
|
+
### Fixes:
|
96
|
+
|
97
|
+
* Return non-zero exit code on CLI error
|
98
|
+
|
99
|
+
### New Features
|
100
|
+
|
101
|
+
* Add runbook "generate" command, including generator, runbook, statement, dsl_extension, and project generators
|
102
|
+
* Add "install" CLI command
|
103
|
+
|
104
|
+
## `v0.12.1` (2019-06-12)
|
105
|
+
|
106
|
+
### Fixes:
|
107
|
+
|
108
|
+
* Fix FormatHelper#deindent bug
|
109
|
+
|
110
|
+
## `v0.12.0` (2019-05-16)
|
111
|
+
|
112
|
+
### Fixes:
|
113
|
+
|
114
|
+
* Fix jump backwards dynamic statement bug
|
115
|
+
|
116
|
+
### New Features
|
117
|
+
|
118
|
+
* Add attempts counter to assert statement
|
119
|
+
* Add capture_all statement
|
120
|
+
|
121
|
+
## `v0.11.0` (2019-03-26)
|
122
|
+
|
123
|
+
### Breaking Changes:
|
124
|
+
|
125
|
+
* Runbooks no longer require explicit registration using `Runbook.books[:book] = book`. This declaration will fail and is no longer necessary. It should be removed. Additionally if you are retrieving runbooks using `Runbook.books`, it's implementation has changed from a hash to an array. You should access elements using an index, not with a key.
|
126
|
+
|
127
|
+
### Potentially Breaking Changes:
|
128
|
+
|
129
|
+
* Steps without titles no longer prompt in paranoid mode. Consequently users may be taken off guard by no receiving a prompt to execute these steps. A workaround is to pass an empty string as a title if you still want these steps to prompt.
|
130
|
+
|
131
|
+
### Fixes:
|
132
|
+
|
133
|
+
* Fix bug in Thor usage
|
134
|
+
* Fix config file load ordering to support extending configuration
|
135
|
+
* Fix bug preventing assert statement from checking multiple times
|
136
|
+
|
137
|
+
### New Features
|
138
|
+
|
139
|
+
* Retry confirm statement when bad input is received
|
140
|
+
* Add additional output when running capture statement
|
141
|
+
* Automatically clear panes when cd'ing to new directory during layout statement
|
142
|
+
* Allow metadata[:toolbox] to be set dynamically
|
143
|
+
* Do not prompt for steps without titles in paranoid mode
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at code@getbraintree.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018- pblesi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|