Keep component boilerplate in sync

The creation of a new Commodore component yield several boilerplate files. Some of those files are meant to be altered by a component author. Others should be equal throughout all components managed by Project Syn. As with all code, things will change. As a result, components will drift apart over time. To battle this issue, we make use of ModuleSync to keep that boilerplate in sync. The template repository for Project Syn is located at modulesync-control.

ModuleSync allows to have a set of templates in a control repository. Those templates then can be applied to several other repositories. Originally, ModuleSync was written for Puppet Modules. We’ve found, that this tool also fits our needs for Commodore components.

The templates are located in the folder moduleroot. Each templates takes a set of variables as input which are defined in a file. In the control repository the variables are defined in config_defaults.yml. In the component they’re located in .sync.yml.

The managed components are listed in managed_modules.yml. Each entry refers to a Git repository hosted on GitHub and has the form <namespaces>/<name>. If no namespace is given, the default namespace in modulesync.yml will be used.

Applying changes

Changes in the control repository pushed to master will trigger the execution of ModuleSync. A pull request will be created for each managed component. That’s, if there are changes in the component.

Overriding variables

Variables defined in config_defaults.yml in the control repository can be overwritten in .sync.yml within a component.

The merge behaviour is different to the one used within the Project Syn configuration hierarchy.

Content of config_defaults
File:
  variables:
    feature1: bar
    feature2: baz

If a key is overwritten in the module, it will overwrite the whole variables key!

Content of .sync.yml
File:
  variables:
    feature1: customized

The feature2 key would be removed in the final config.

Keep your component up to date

A component created with commodore component create will be ready to be managed by modulesync-control of Project Syn. In order for this to happen, you have to add your component to managed_modules.yml.

Rules established by modulesync-control

Components kept in sync by modulesync-control must adhere to some rules.

Don’t edit the following files:

Makefile

If you need to add new make targets, you can add them to new custom Makefiles (suggested file ending .mk). You can include them in Makefile by adding them to the list variable Makefile.includes.

.gitignore

If you have more things to exclude, add them to .gitignore.additionalEntries