Creating Stencil Template Repos

Once you are familiar with base templates, you might need to add your own Stencil templates into a public or private repository and use them with Formations.

To achieve this, simply create a git repository and connect it to your Skycap account. You can do this by visiting Accounts Settings > External Services and then clicking on the Stencil Template Repos tab.

To add a new repo click on the + button and then enter the URL of the repo, the branch you are using and give your repo a distinctive name. Skycap then pulls the contents of the repo down and makes it available to use in your Formations.

A Stencil Template Repo should include a single templates.json file that holds meta-data about the templates you have in the repo. Here is a sample templates.json taken from this repository:

{
	"version": "v1",
	"templates": [
		{
			"name": "Service",
			"filename_pattern": "${service}_service.yml",
			"filename": "service.yml",
			"description": "Defines a service",
			"context_type": "service",
			"tags": ["service"],
			"preferred_sequence": 2
		},
		{
			"name": "Deployment",
			"filename_pattern": "${service}_deploy.yml",
			"filename": "deploy.yml",
			"description": "Defines a deployment",
			"context_type": "service",
			"tags": ["deployment"],
			"preferred_sequence": 1
		}
	]
}
	

Under templates, you can find the following attributes

Because Stencils are designed to be reusable, operators or developers can generate these Stencil templates (“base templates”) and make them available to the rest of the team via this feature.

These Stencils are usable by anyone with the appropriate permissions and can be enforced by the operators of the cluster to ensure good governance of the infrastructure.

Updating Templates within Skycap

Once a Stencil Template Repo is synchronized with Skycap, a copy of it is held on Skycap.

You can update this copy either by setting up a Webhook from your git repository to resync it with the repository after each commit, using the CX Toolbelt or clicking the Sync icon on the Stencil Template Repo page. This will manually update your templates in Skycap based on the latest commit in your git repository.