Skip to content

Commit

Permalink
Add all config options as CLI args (+new opt for repo_update) (#64)
Browse files Browse the repository at this point in the history
* Add new no_updates flag
* autofix lint

* moar moar lint

* Nearly all the lint

* Actually all of the lint

* Thats what I get for using git add --all

* I am king of introducing MD lint

* Move repo.update gate to one line suggestion

Co-authored-by: Phil Dibowitz <[email protected]>

Co-authored-by: Phil Dibowitz <[email protected]>
  • Loading branch information
ChefAustin and jaymzh authored Feb 14, 2022
1 parent d682c40 commit 76b15e1
Show file tree
Hide file tree
Showing 4 changed files with 364 additions and 60 deletions.
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ possible.
## Our Development Process
All changes to Grocery Delivery are developed on this GitHub repo. Changes
committed are then rolled out internally before a formal release is done on
RubyGems.
RubyGems. Do not bump the Gem version in `grocery_delivery.gemspec`;
maintainers will bump when the new release is ready.

## Pull Requests
We actively welcome your pull requests.
Expand Down
295 changes: 262 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,41 +48,270 @@ another. The config file works the same as client.rb does for Chef - there
are a series of keywords that take an argument and anything else is just
standard Ruby.

All command-line options are available in the config file:
* dry_run (bool, default: false)
* debug (bool, default: false)
* config_file (string, default: `/etc/gd-config.rb`)
* lockfile (string, default: `/var/lock/subsys/grocery_delivery`)
* pidfile (string, default: `/var/run/grocery_delivery.pid`)

In addition the following are also available:
* `master_path` - The top-level path for Grocery Delivery's work. Most other
paths are relative to this. Default: `/var/chef/grocery_delivery_work`
* `repo_url` - The URL to clone/checkout if it doesn't exist. Default: `nil`
* `reponame` - The relative directory to check the repo out to, inside of
`master_path`. Default: `ops`
* `cookbook_paths` - An array of directories that contain cookbooks relative to
`reponame`. Default: `['chef/cookbooks']`
* `role_path` - A directory to find roles in relative to `reponame`. Default:
`'chef/roles'`
* `role_type` - RB or JSON roles? Default: `rb`
* `databag_path` - A directory to find databags in relative to `reponame`.
The following configuration options are available:
* **`berks`**

Description: Determines if we should use Berkshelf to resolve deps, upload cookbooks

CLI Argument(s): `'-b'`, `'--berks'`

Value data type: `Boolean`

Default: `false`

Notes: Existence of CLI argument equates to `true`

* **`berks_bin`**

Description: Path to Berkshelf binary.

CLI Argument(s): `'-B', '--berks-bin FILE'`

Value data type: `String`

Default: `/opt/chefdk/bin/berks`

* **`berks_config`**

Description: Path to Berkshelf config.

CLI Argument(s): `'--berks-config FILE'`

Value data type: `String`

Default: `nil`

* **`config_file`**

Description: Path to Grocery Delivery config

CLI Argument(s): `-c`, `--config-file FILE`

Value data type: `String`

Default: `/etc/gd-config.rb`

* **`cookbook_paths`**

Description: Space-delimited array of dirs that contain cookbooks relative
to `reponame`

CLI Argument(s): `'--cookbook-paths DIRECTORY1 DIRECTORY2 DIRECTORY3 ...'`

Value data type: `String`

Default: `['chef/cookbooks']`

* **`databag_path`**

Description: A directory to find databags in relative to `reponame`.

CLI Argument(s): `'-d', '--databag-path FILE'`

Value data type: `String`

Default: `'chef/databags'`
* `rev_checkpoint` - Name of the file to store the last-uploaded revision,
relative to `reponame`. Default: `gd_revision`
* `knife_config` - Knife config to use for uploads. Default:
`/root/.chef/knife.rb`
Note: `knife.rb` will need to set `cookbook_path` pointing to the cookbook
path in the work directory,
e.g. `/var/chef/grocery_delivery_work/ops/chef/cookbooks`
* `knife_bin` - Path to knife. Default: `/opt/chef/bin/knife`
* `vcs_type` - Git or SVN? Default: `svn`
* `vcs_path` - Path to git or svn binary. If not given, just uses 'git' or 'svn'.

* **`dry_run`**

Description: Enable dry-run mode.

CLI Argument(s): `'-n', '--dry-run'`

Value data type: `Boolean`

Default: `false`

Notes: Existence of CLI argument equates to `true`

* **`knife_bin`**

Description: Path to `knife` binary.

CLI Argument(s): `'-k', '--knife-bin FILE'`

Value data type: `String`

Default: `/opt/chef/bin/knife`

Notes: e.g. `/var/chef/grocery_delivery_work/ops/chef/cookbooks`

* **`knife_config`**

Description: Knife config to use for uploads.

CLI Argument(s): `'-K', '--knife-config FILE'`

Value data type: `String`

Default: `/root/.chef/knife.rb`

Notes: `knife.rb` will need to set `cookbook_path` pointing to the cookbook
path in the work directory

* **`lockfile`**

Description: Path to lockfile.

CLI Argument(s): `'-l', '--lockfile FILE'`

Value data type: `String`

Default: `/var/lock/subsys/grocery_delivery`

* **`master_path`**

Description: The top-level path for Grocery Delivery's work (most other paths
are relative to this).

CLI Argument(s): `'-m', '--master-path FILE'`

Value data type: `String`

Default: `/var/chef/grocery_delivery_work`

* **`pidfile`**

Description: Path to pidfile.

CLI Argument(s): `-p, --pidfile FILE`

Value data type: `String`

Default: `/var/run/grocery_delivery.pid`

* **`plugin_path`**

Description: Path to plugin file.

CLI Argument(s): `'-P', '--plugin-path FILE'`

Value data type: `String`

Default: `/etc/gd-plugin.rb`

* **`repo_update`**

Description: Enables/disables cookbook repo update before run.

CLI Argument(s): `'-U', '--no-repo-update'`

Value data type: `Boolean`

Default: `true`

Note: Existence of CLI argument equates to `false`. This might be beneficial
for those wanting to run Grocery Delivery in CI, within a container, or some
other non-standard environment where there is no need to update the cookbook
repository before running Grocery Delivery.

* **`repo_url`**

Description: The URL to clone/checkout if it doesn't exist.

CLI Argument(s): `'-u', '--repo-url URL'`

Value data type: `String`

Default: `nil`
* `plugin_path` - Path to plugin file. Default: `/etc/gd-plugin.rb`
* `berks` - Boolean to determine if we should use berkshelf to resolve
dependencies and upload cookbooks. Default: `false`
* `berks_bin` - Path to berkshelf. Default: `/opt/chefdk/bin/berks`

* **`reponame`**

Description: The relative directory to check the repo out to, inside of `master_path`.

CLI Argument(s): `'-N', '--repo-name'`

Value data type: `String`

Default: `ops`

* **`rev_checkpoint`**

Description: File with last-uploaded revision, relative to reponame.

CLI Argument(s): `'-C', '--revision-checkpoint FILE'`

Value data type: `String`

Default: `gd_revision`

* **`role_path`**

Description: A directory to find roles in relative to `reponame`.

CLI Argument(s): `'-r', '--role-path FILE'`

Value data type: `String`

Default: `'chef/roles'`

* **`role_type`**

Description: RB or JSON roles?

CLI Argument(s): `'-R', '--role-type TYPE'`

Value data type: `String`

Default: `rb`

* **`stdout`**

Description: Log to stdout as well.

CLI Argument(s): `'--stdout'`

Value data type: `Boolean`

Default: `false`

Notes: Existence of CLI argument equates to `true`

* **`track_symlinks`**

Description: Whether or not to track symlinks.

CLI Argument(s): `'--track-symlinks'`

Value data type: `Boolean`

Default: `false`

Notes: Existence of CLI argument equates to `true`

* **`vcs_path`**

Description: Path to git or svn binary.

CLI Argument(s): `'--vcs-path FILE'`

Value data type: `String`

Default: `nil`

Notes: If not given, just uses 'git' or 'svn'

* **`vcs_type`**

Description: Git or SVN?

CLI Argument(s): `'--vcs-type TYPE'`

Value data type: `String`

Default: `svn`

* **`verbosity`**

Description: Verbosity level.

CLI Argument(s): `'-v'`, `'--verbosity'`

Value data type: N/A

Default: `WARN`

Notes: Specify twice via CLI for debug.

## Plugin

Expand Down
Loading

0 comments on commit 76b15e1

Please sign in to comment.