|
1 | 1 | # CFEngine Build JSON file format |
2 | 2 |
|
3 | | -The CFEngine Build website and tooling relies on JSON files for different purposes; |
| 3 | +The `cfbs` command line tool uses `cfbs.json` configuration files. |
| 4 | +We call the folder / git repo which has a `cfbs.json` file (and optionally other files and folders) a _project_, and the end result after combining modules in a project into policy a _policy set_. |
| 5 | +The _policy set_ is what you deploy to your CFEngine hub / policy server, in `/var/cfengine/masterfiles`. |
4 | 6 |
|
5 | | -* The project file (`cfbs.json`) generated by running `cfbs init` when you start a new project |
6 | | -* The index of all available modules which is available on GitHub |
7 | | -* A `cfbs.json` file with necessary metadata for adding a module using URL (not from index) |
| 7 | +See the [README](https://github.com/cfengine/cfbs/blob/master/README.md) for general documentation on the `cfbs` tool and its commands. |
| 8 | +This file is specifically about the `cfbs.json` file format, it should serve as detailed and useful information for more advanced users who are making their own modules or contributing to CFEngine Build. |
8 | 9 |
|
9 | | -All these 3 share 1 standard format, commonly called `cfbs.json`. |
| 10 | +The type of a project is specified in a top-level `type` key in `cfbs.json`. |
| 11 | +There are 3 types of projects: |
10 | 12 |
|
11 | | -(There is also [`versions.json`](https://github.com/cfengine/cfbs-index/blob/master/versions.json), but this specification is not about that file). |
| 13 | +* For building a policy set you create a project with type `policy-set`. |
| 14 | + This is the default when running `cfbs init`, and what most users encounter when first using the tool and CFEngine. |
| 15 | + You then need to use the top-level `build` key to specify which modules to use in `cfbs build`. |
| 16 | +* The index of all available modules for `cfbs add <module-name>` has type `index`. |
| 17 | + The available modules must be in a dictionary in the `index` field. |
| 18 | + By default, [this index available GitHub](https://github.com/cfengine/build-index/blob/master/cfbs.json) is used. |
| 19 | +* When developing your own reusable modules to use in other projects, `module` type is used. |
| 20 | + |
| 21 | +When `cfbs` is using the default index and when we build the [build.cfengine.com](https://build.cfengine.com) website, we use a separate [`versions.json`](https://github.com/cfengine/build-index/blob/master/versions.json) file to keep track of all the versions of modules, their tarballs and checksums. |
| 22 | +When contributors edit the index ([like this](https://github.com/cfengine/build-index/pull/465/files)), an automated PR is generated to make the appropriate edit to `versions.json` ([like this](https://github.com/cfengine/build-index/pull/466/files)), (after downloading and uploading the module), so users don't have to update `versions.json` manually. |
| 23 | + |
| 24 | +Note that while the 3 types above add some requirements to which fields you must use, the file format and `cfbs` tool is quite flexible. |
| 25 | +It is for example entirely possible, and encouraged, to use the `build` field and `cfbs build` command to build and test a policy set, while you are working on a module in a project with type `module`. |
12 | 26 |
|
13 | 27 | ## The process of building modules from a project into a policy set |
14 | 28 |
|
|
0 commit comments