|
| 1 | +--- |
| 2 | +sidebar_position: 3 |
| 3 | +--- |
| 4 | + |
| 5 | +# Configuration |
| 6 | + |
| 7 | +Gilt uses [Viper][] to load configuation through multiple methods. |
| 8 | + |
| 9 | +## Config File |
| 10 | + |
| 11 | +Create the giltfile (`Giltfile.yaml`). |
| 12 | + |
| 13 | +Clone the specified `url`@`version` to the configurable path `--gilt-dir`. |
| 14 | +Extract the repo the `dstDir` when `dstDir` is provided. Otherwise, copy files |
| 15 | +and/or directories to the desired destinations. |
| 16 | + |
| 17 | +```yaml |
| 18 | +--- |
| 19 | +giltDir: ~/.gilt/clone |
| 20 | +debug: false |
| 21 | +parallel: true |
| 22 | +repositories: |
| 23 | + - git: https://github.com/retr0h/ansible-etcd.git |
| 24 | + version: 77a95b7 |
| 25 | + dstDir: roles/retr0h.ansible-etcd |
| 26 | + - git: https://github.com/retr0h/ansible-etcd.git |
| 27 | + version: 1.1 |
| 28 | + dstDir: roles/retr0h.ansible-etcd-tag |
| 29 | + - git: https://github.com/lorin/openstack-ansible-modules.git |
| 30 | + version: 2677cc3 |
| 31 | + sources: |
| 32 | + - src: '*_manage' |
| 33 | + dstDir: library |
| 34 | + - src: nova_quota |
| 35 | + dstDir: library |
| 36 | + - src: neutron_router |
| 37 | + dstFile: library/neutron_router.py |
| 38 | + - src: tests |
| 39 | + dstDir: tests |
| 40 | + commands: |
| 41 | + - cmd: ansible-playbook |
| 42 | + args: |
| 43 | + - -i, |
| 44 | + - playbook.yml |
| 45 | + - cmd: bash |
| 46 | + args: |
| 47 | + - -c |
| 48 | + - who | grep tty |
| 49 | +``` |
| 50 | +
|
| 51 | +### Configuration Options |
| 52 | +
|
| 53 | +#### `debug` |
| 54 | + |
| 55 | +- Type: boolean |
| 56 | +- Default: `false` |
| 57 | +- Required: no |
| 58 | + |
| 59 | +Enable / disable debug output |
| 60 | + |
| 61 | +#### `parallel` |
| 62 | + |
| 63 | +- Type: boolean |
| 64 | +- Default: `true` |
| 65 | +- Required: no |
| 66 | + |
| 67 | +Enable / disable fetching clones concurrently. The default is to fetch clones in |
| 68 | +parallel, with one fetch per CPU, and a maximum of 8 concurrent processes. |
| 69 | +Setting `parallel: false` will cause Gilt to fetch each clone one-at-a-time. |
| 70 | + |
| 71 | +#### `giltDir` |
| 72 | + |
| 73 | +- Type: string |
| 74 | +- Default: `~/.gilt/clone` |
| 75 | +- Required: no |
| 76 | + |
| 77 | +Specifies the directory to use for storing cached clones for use by Gilt. The |
| 78 | +directory will be created if it does not exist. |
| 79 | + |
| 80 | +#### `repositories` |
| 81 | + |
| 82 | +- Type: list |
| 83 | +- Default: `[]` |
| 84 | +- Required: no |
| 85 | + |
| 86 | +The list of repositories for Gilt to vendor in. They will be processed in the |
| 87 | +order they are defined. |
| 88 | + |
| 89 | +##### `repositories[].git` |
| 90 | + |
| 91 | +- Type: string |
| 92 | +- Default: None |
| 93 | +- Required: yes |
| 94 | + |
| 95 | +The Git URL of the repository to clone. Any URL format supported by Git may be |
| 96 | +used. |
| 97 | + |
| 98 | +##### `repositories[].version` |
| 99 | + |
| 100 | +- Type: string |
| 101 | +- Default: None |
| 102 | +- Required: yes |
| 103 | + |
| 104 | +The Git commit-ish to use as the source. Any valid branch name, tag name, or |
| 105 | +commit hash may be used. |
| 106 | + |
| 107 | +##### `repositories[].dstDir` |
| 108 | + |
| 109 | +- Type: string |
| 110 | +- Default: None |
| 111 | +- Required: no |
| 112 | + |
| 113 | +The local directory to copy files into. All files in the repository will be |
| 114 | +copied. Relative paths will be installed into the directory where `gilt` was |
| 115 | +invoked. If `dstDir` already exists, it will be destroyed and overwritten; as |
| 116 | +such, `.` and `..` are not allowed. |
| 117 | + |
| 118 | +To copy only a subset of files, use the `repositories.sources` option instead. |
| 119 | + |
| 120 | +This option cannot be used with `repositories.sources`. |
| 121 | + |
| 122 | +##### `repositories[].sources` |
| 123 | + |
| 124 | +- Type: list |
| 125 | +- Default: `[]` |
| 126 | +- Required: no |
| 127 | + |
| 128 | +A list of subtrees and their targets for Gilt to copy. Relative paths will |
| 129 | +read/write into the directory where `gilt` was invoked. |
| 130 | + |
| 131 | +This option cannot be used with `repositories.dstDir`. |
| 132 | + |
| 133 | +###### `repositories[].sources[].src` |
| 134 | + |
| 135 | +- Type: string |
| 136 | +- Default: None |
| 137 | +- Required: yes |
| 138 | + |
| 139 | +The pathname of the source file/directory to copy. |
| 140 | + |
| 141 | +###### `repositories[].sources[].dstDir` |
| 142 | + |
| 143 | +- Type: string |
| 144 | +- Default: None |
| 145 | +- Required: no |
| 146 | + |
| 147 | +The pathname of the destination directory. If `src` is a file, it will be placed |
| 148 | +inside the named directory. If `src` is a directory, its contents will be copied |
| 149 | +into the named directory. All parent directories will be created if they do not |
| 150 | +exist. If `dstDir` already exists, it will be destroyed and overwritten; as |
| 151 | +such, `.` and `..` are not allowed. |
| 152 | + |
| 153 | +This option cannot be used with `repositories[].sources[].dstFile`. |
| 154 | + |
| 155 | +###### `repositories[].sources[].dstFile` |
| 156 | + |
| 157 | +- Type: string |
| 158 | +- Default: None |
| 159 | +- Required: no |
| 160 | + |
| 161 | +The pathname of the destination file. If `src` is a directory, an error is |
| 162 | +thrown. All parent directories will be created if they do not exist, with an |
| 163 | +equivalent set of permissions, i.e., a `src` file with mode `0640` will create |
| 164 | +all nonexistant intermediate directories with mode `0750`. |
| 165 | + |
| 166 | +This option cannot be used with `repositories[].sources[].dstDir`. |
| 167 | + |
| 168 | +##### `repositories[].commands` |
| 169 | + |
| 170 | +- Type: list |
| 171 | +- Default: `[]` |
| 172 | +- Required: no |
| 173 | + |
| 174 | +A list of commands to run after overlaying files. These commands are run in the |
| 175 | +same directory used to invoke `gilt`. They will be executed in the order they |
| 176 | +are defined, and a non-zero exit status will cause Gilt to abort. |
| 177 | + |
| 178 | +###### `repositories[].commands[].cmd` |
| 179 | + |
| 180 | +- Type: string |
| 181 | +- Default: None |
| 182 | +- Required: yes |
| 183 | + |
| 184 | +The name of the command to run. The current value of `$PATH` will be used to |
| 185 | +find it. This does **NOT** invoke a shell, so variable interpolation, output |
| 186 | +redirection, etc., is not supported. |
| 187 | + |
| 188 | +###### `repositories[].commands[].args` |
| 189 | + |
| 190 | +- Type: list of strings |
| 191 | +- Default: `[]` |
| 192 | +- Required: no |
| 193 | + |
| 194 | +Any and all arguments to the given command. This does **NOT** invoke a shell, so |
| 195 | +variable interpolation, output redirection, etc. is not supported. Similarly, |
| 196 | +arguments are not split on spaces, so each argument must be a separate list |
| 197 | +entry. |
| 198 | + |
| 199 | +## Env Vars |
| 200 | + |
| 201 | +The config file can be overriden/defined through env vars. |
| 202 | + |
| 203 | +```bash |
| 204 | +GILT_GILTFILE=Giltfile.yaml \ |
| 205 | +GILT_GILTDIR=~/.gilt/clone \ |
| 206 | +GILT_DEBUG=false \ |
| 207 | +GILT_PARALLEL=false \ |
| 208 | +gilt overlay |
| 209 | +``` |
| 210 | + |
| 211 | +### `GILT_DEBUG` |
| 212 | + |
| 213 | +- Default: `false` |
| 214 | + |
| 215 | +Enable/disable debug output. |
| 216 | + |
| 217 | +### `GILT_PARALLEL` |
| 218 | + |
| 219 | +- Default: `true` |
| 220 | + |
| 221 | +Enable / disable fetching clones concurrently. The default is to fetch clones in |
| 222 | +parallel, with one fetch per CPU, and a maximum of 8 concurrent processes. |
| 223 | +Setting `GIT_PARALLEL=false` will cause Gilt to fetch each clone one-at-a-time. |
| 224 | + |
| 225 | +### `GILT_GILTFILE` |
| 226 | + |
| 227 | +- Default: `./Giltfile.yaml` |
| 228 | + |
| 229 | +Configuration file to use. |
| 230 | + |
| 231 | +### `GILT_GILTDIR` |
| 232 | + |
| 233 | +- Default: `~/.gilt/clone` |
| 234 | + |
| 235 | +Specifies the directory to use for storing cached clones for use by Gilt. The |
| 236 | +directory will be created if it does not exist. |
| 237 | + |
| 238 | +### `GILT_SKIPCOMMANDS` |
| 239 | + |
| 240 | +- Default: `false` |
| 241 | + |
| 242 | +If set, Gilt will skip running any post-commands when overlaying files. This can |
| 243 | +be useful when debugging. |
| 244 | + |
| 245 | +## Command Flags |
| 246 | + |
| 247 | +The config file and/or env vars can be overriden/defined through cli flags. |
| 248 | + |
| 249 | +```bash |
| 250 | +gilt \ |
| 251 | + --gilt-file=Giltfile.yaml \ |
| 252 | + --gilt-dir=~/.gilt/clone \ |
| 253 | + --debug \ |
| 254 | + --parallel=false \ |
| 255 | + overlay |
| 256 | +``` |
| 257 | + |
| 258 | +### `-d`, `--debug` |
| 259 | + |
| 260 | +Enable debug output. |
| 261 | + |
| 262 | +### `-c`, `--gilt-dir` |
| 263 | + |
| 264 | +Path to Gilt's clone dir. (default `~/.gilt/clone`) |
| 265 | + |
| 266 | +### `-f`, `--gilt-file` |
| 267 | + |
| 268 | +Path to config file. (default `./Giltfile.yaml`) |
| 269 | + |
| 270 | +### `--no-commands` |
| 271 | + |
| 272 | +If set, Gilt will skip running any post-commands when overlaying files. This can |
| 273 | +be useful when debugging. |
| 274 | + |
| 275 | +### `-p`, `--parallel` |
| 276 | + |
| 277 | +Enable / disable fetching clones concurrently. The default is to fetch clones in |
| 278 | +parallel, with one fetch per CPU, and a maximum of 8 concurrent processes. |
| 279 | +Setting `--parallel=false` will cause Gilt to fetch each clone one-at-a-time. |
| 280 | + |
| 281 | +<!-- prettier-ignore-start --> |
| 282 | +[Viper]: https://github.com/spf13/viper |
| 283 | +<!-- prettier-ignore-end --> |
0 commit comments