Using repository templates
Learn how to create repository templates and how to use them to create new repositories
This guide provides instructions on how to create new repositories using templates with the Codebase Governor (CBG). Follow these steps to efficiently manage your repositories within a capability.
Using templates in Codebase Governor provides several benefits, including:
- Standardization: You can ensure that all your repositories have the same configuration and settings.
- Time-saving: Creating new repositories from a template saves you time and reduces errors.
- Consistency: Your repositories will be consistent across your organization, making it easier to manage and maintain them.
Template Creation
To create a new template, add or use an existing repository configuration file within the appropriate capability folder. If the repository does not already exist in Flutter-Global, the Codebase Governor will automatically create it and apply all necessary configurations.
To create a new template, follow these steps:
- Navigate to the
org-configrepository main page. - Open the
codebasesfolder. - Open your
capabilityfolder orcreate a new one. - Click the
Add file>Create new filebutton. - If the repository doesn’t exist: enter your repository name in the
Name your file...field. The file name must follow the<NAME_OF_REPOSITORY>.ymlpattern. For example, for a repository namedmy-template, the filename would bemy-template.yml. - If the repository already exists: navigate to the repository configuration file and click the
Edit this filebutton. -
Add the
is-templatekey in the repository configuration properties in the file contents textarea.is-template: true - Click on the
Commit changes...button. - Add a
Commit message. - Click on
Propose changesto open a Pull Request.
Once the pull request is approved and merged, CBG will create the template and apply any changes defined in the configuration.
After designating the repository as a template, add the desired content and configurations that will be used in future repositories created from this template.
Using Templates
To use an existing template for creating a new repository, add a using-template property to your repository configuration file.
For example:
using-template: <repository_name>
This will create a new repository with the same configuration as the my-template template.
To use a template, follow these steps:
- Navigate to the
org-configrepository main page. - Open the
codebasesfolder. - Open your
capabilityfolder orcreate a new one. - Click the
Add file>Create new filebutton. - Enter your repository name in the
Name your file...field. The file name must follow the<NAME_OF_REPOSITORY>.ymlpattern. -
Add the
using-templateproperty to the file contents textarea, specifying the template you want to use.using-template: my-template - Click on the
Commit changes...button. - Add a
Commit message. - Click on
Propose changesto open a Pull Request.
Once the pull request is approved and merged, CBG will create the new repository using the template configuration.
Next Steps
Refer to the documentation for more details.