Skip to content

Commit e9b1b37

Browse files
author
Kevin Paulisse
committed
Add script override documentation
1 parent 0a19eab commit e9b1b37

2 files changed

Lines changed: 56 additions & 0 deletions

File tree

doc/advanced-script-override.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Overriding external scripts
2+
3+
## Background
4+
5+
During normal operation, `octocatalog-diff` runs certain scripts or commands from the underlying operating system. For example, it may run `git` to check out a certain code branch, and run `puppet` to build a catalog.
6+
7+
Each external script is found within the [`scripts`](/scripts) directory.
8+
9+
## How to override scripts
10+
11+
### Command line option
12+
13+
It is possible to override these scripts with customized versions. To do this, specify a directory that contains replacement scripts via the command line:
14+
15+
```
16+
octocatalog-diff [other options] --override-script-path /path/to/scripts ...
17+
```
18+
19+
### Configuration file
20+
21+
You can also specify this option via a [configuration file](/doc/configuration.md) setting:
22+
23+
```
24+
settings[:override_script_path] = '/path/to/scripts'
25+
```
26+
27+
### Writing replacement scripts
28+
29+
Within the override script path you've configured, place a file with the same name as the built-in script. For example, if you wish to override the `git-extract.sh` script with a custom version, also name your script `git-extract.sh`. (Do NOT create subdirectories within the override directory.)
30+
31+
If you specify an override script path but a particular script is not present there, octocatalog-diff will default to the built-in script. This means that you do not need to create unmodified copies of the built-in scripts. Only override the scripts you need to change.
32+
33+
### Notes
34+
35+
Please note that these scripts are considered part of octocatalog-diff, and not part of your Puppet codebase. Therefore, the path to your scripts must be an absolute path, and we do not support (or intend to support) using multiple script directories during the same run of octocatalog-diff.
36+
37+
## Explanation of scripts
38+
39+
This is an explanation of the [existing scripts supplied by octocatalog-diff](/scripts):
40+
41+
- [`env.sh`](/scripts/env)
42+
43+
Prints out the environment. This is currently only used for spec tests.
44+
45+
- [`git-extract.sh`](/scripts/git-extract)
46+
47+
Extracts a specified branch from the git repository into a specified target directory.
48+
49+
- [`puppet.sh`](/scripts/puppet)
50+
51+
Runs puppet (with additional command line arguments), generally used to compile a catalog.
52+
53+
- [`puppet-version.sh`](/scripts/puppet-version)
54+
55+
Runs `puppet --version` to determine the version of Puppet being used.

doc/advanced.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ See also:
2424
- [Using `octocatalog-diff` without git](/doc/advanced-using-without-git.md)
2525
- [Catalog validation](/doc/advanced-catalog-validation.md)
2626
- [Environment setup](/doc/advanced-environments.md)
27+
- [Overriding built-in octocatalog-diff scripts](/doc/advanced-script-override.md)
2728

2829
### Controlling output
2930

0 commit comments

Comments
 (0)