Looking for a quick introduction to Scaffolder? Check out the Cortex Academy course, Intro to Scaffolder.

Creating a Scaffolder template
Prerequisites- A Git integration with
writeaccess. The following integrations are available:- Azure DevOps - Configure the Azure DevOps token with
Code read, write & manageaccess. - Bitbucket
-
Cloud - Configure the Bitbucket token with
Repositories - admin and deletescopes. -
Data Center - Bitbucket Data Center uses
OAuthfor authentication rather than workspace tokens. The configured OAuth credentials must have permissions to:- Read the source repository being cloned
- Create a new repository
-
Cloud - Configure the Bitbucket token with
- GitHub - Cortex’s GitHub app is pre-configured with permissions for the Scaffolder.
- GitLab - Configure the GitLab access token with
writepermissions.
- Azure DevOps - Configure the Azure DevOps token with
- Configure your username’s identity mappings for your Git provider.
Step 1: Creating a Cookiecutter template
Before you can use the Scaffolder, you’ll need a Cookiecutter template. You can use an existing template or create a new one.Using a Cookiecutter template
To get started quickly, you can use an existing open source template.- Find an open source template and clone the repo.
-
Open your
cookiecutter.jsonfile, located in the root of the template repository. -
In the file, add a
versionkey and enter the version number. This lets Cortex record the template version used for each project in the Catalog, so you can track which projects are running outdated templates.
- Follow the Cookiecutter instructions to generate the project.
Creating a new Cookiecutter template
To create your own template, follow the Cookiecutter tutorial. Once your template is ready, use the Cookiecutter documentation to generate a project from it.Step 2: Adding the template to Cortex
Users with theConfigure Scaffolder Templates permission can add the Cookiecutter template to Cortex.
- From the main sidebar, select Workflows.
-
In the upper-right corner of the Workflows page, click Register Scaffolder template.

-
Configure the template:
- Provider - Select which Git provider you are using.
- Name - Enter a name for the template. This will be seen by developers when they create a service using the template.
- Description - Add a description to help others understand the template’s purpose.
- Tags - Optionally, add tags to describe the template. For example, these could help developers understand whether the template is meant to be used for a specific service type, what language it uses, and more.
-
Below Configuration, fill in the fields:
- Git provider configuration - Enter the configuration, e.g.,
default- By default, the option Use this configuration for all git operations is enabled. When enabled, Cortex uses the selected configuration for all Git operations (e.g., fetching the template details, populating the form options, and creating the new repo or Pull Request). The form options will be filtered to only those organizations or repositories that the selected configuration has access to.
- With this setting disabled, you can use a single Scaffolder template with multiple organizations/configurations. While the selected configuration must still have to access the template’s repository, the remaining Git operations will be run dynamically based on the user’s form selections. The Scaffolder form options will be populated using data from all configurations. Then, Cortex will automatically use a configuration with access to the selected organization (if scaffolding a new repository) or repository (if scaffolding a new PR) for all remaining Git operations.
- Git URL - Enter the git URL where your template lives, e.g.
https://github.com/cortexapps/cookiecutter-employee - Git ref (optional) - Enter a git ref (branch name, tag, or commit SHA) to pin the template to a specific version of the repository. For example, entering v1.0.0 will always pull the template as it existed at that tag, regardless of subsequent changes to the default branch. If left blank, the template will pull from the default branch.
- Subdirectory for Cookiecutter template (optional) - If your Cookiecutter template is not stored at the root of your repository, enter the subdirectory URL here.
- Configuration requirements - Select one of the following:
- New service. Cortex service descriptor will be generated for the service and it will be automatically added to relevant catalogs.
- If you don’t select this option, you will still have the option to create a service entity when running the Scaffolder.
- New pull request. When enabled, the template can only be used to open pull requests against existing repositories.
- Both. Enable both “New service” and “New pull request” configurations.
- Neither. Disable both “New service” and “New pull request” configurations.
- New service. Cortex service descriptor will be generated for the service and it will be automatically added to relevant catalogs.
- Visibility - When creating a new repository choose the default visibility of the repository. If you do not specify, the template defaults to setting a new repository as private.
- The available options depend on the Git provider. The
Publicsetting only works if the org containing the repository allows it. TheInternalsetting only works for GitHub Enterprise accounts. - When running a Workflow that contains a Scaffolder block, you can configure an override to change the repo visibility.
- The available options depend on the Git provider. The
- Create cortex.yaml in git when creating a new service - When enabled, a cortex.yaml will be created in git when the Scaffolder creates a new service.
- If you don’t enable this setting, the entity descriptor will be added via the API.
- Show README.md during Scaffolding - When enabled, the project’s README.md will be displayed when inputting the variables to use while rendering the template. If there is no README.md, nothing will be shown.
- Git provider configuration - Enter the configuration, e.g.,
- Click Register Scaffolder template.
Step 3: Create a Workflow with a Scaffolder step
After you have added a template to Cortex, you can start using the Scaffolder in a Workflow. Follow the instructions in the Workflows documentation for creating a Workflow and adding a Scaffolder block.If your Scaffolder template requires input variables, you can configure overrides in your Workflow’s Scaffolder block. This allows you to use output from previous Workflow steps as the responses to the template. To streamline the process and avoid extra prompts, you can add a User Input block before the Scaffolder to collect responses that will be used in the Scaffolder template.See an end-to-end Scaffolder Workflow example in Scaffolding a new service with custom data based on user input.
View Scaffolder templates
View all templates available to your organization under Workflows > Scaffolders. The template’s Cortex ID (CID) can be found at the top of the page while editing the Scaffolder template:
Troubleshooting and FAQ
See frequently asked questions below.When running a Scaffolder and choosing from my list of Azure DevOps projects, some projects aren't appearing as expected
When running a Scaffolder and choosing from my list of Azure DevOps projects, some projects aren't appearing as expected
This can happen if you have enabled the option Use this configuration for all git operations when configuring your template in Cortex. Disable this setting for the ability to choose from all configurations.
My Scaffolder block fails after I added a hook to my template
My Scaffolder block fails after I added a hook to my template
Hooks run in a sandbox that can’t access the network, run shell commands, read environment variables, or reach files outside the generated project. A hook that relies on any of these, creates a symbolic link, or exits with an error fails the block. See Running Cookiecutter hooks for what’s supported.
When running a Scaffolder Workflow that pushes template files to a newly created repository, the Workflow completes successfully, but no files appear in the repository
When running a Scaffolder Workflow that pushes template files to a newly created repository, the Workflow completes successfully, but no files appear in the repository
This occurs when the branch name entered during the Scaffolder run does not match the default branch configured in your Git provider. For GitLab, Azure DevOps, and Bitbucket, the branch specified must match the repository’s default branch (typically
main or master). If it does not match, the Workflow will report successful completion but template files will not be pushed to the new repository.Scaffolding Workflow appears stuck with no error
Scaffolding Workflow appears stuck with no error
Scaffolder runs might hang without surfacing an error when cloning large repositories or monorepos to open a pull request. Enabling sparse checkout can resolve this by cloning the repository without retrieving all of its git object data. This option is effective when a Scaffolder run only creates new files; if it needs to modify or delete existing files, use the standard clone path instead.How to recognize the issue:
- The scaffolding step runs for around 5 minutes and then terminates. This is the clone timeout — if the operation doesn’t complete within that window, it’s cancelled.
- The run fails with exit code 137, which indicates the process was killed by the system (typically due to memory pressure).
- The target repository is large. You can measure it with
git count-objects -v.
- From the main sidebar, select Workflows.
- Select the Scaffolders tab.
- On the Scaffolders page, locate the template, then click the pencil icon next it.
- Toggle on Enable sparse checkout.
- Click Update Scaffolder.