Create template repo's and provision new repo's with these templates using this Azure Function. Including replacement of placeholders & GUID management for project files & automatic devops pipelines.
The function relies heavily on a naming standarization. It expects your repositoryname to consist out of a generic platform/company name, a repository type and the componentname. It should be called something like MyPlatform.MyRepoType.MyComponent
. The template repository used for this example will be MyPlatform.Templates.MyRepoType
.
It will then copy the template repo, replace placeholders and commit the output to the newly created repository. In this way, it becomes painless to create new repositories for, for example, your microservices. The pipeline will also be automatically added to the Azure DevOps Pipelines module. This gets you right into developing features!
As with other AzDocs components, this will only work in combination with Azure & Azure DevOps.
Variable name | Example value | Description |
---|---|---|
AzureDevOps.OrganizationName |
mydevopsorg |
The organization name of your Azure DevOps instance. |
AzureDevOps.PersonalAccessToken |
xfn2q7kdv9sypb2d3mvqtgdyx7xsba926q5rat2mn62ynj7347vf |
Your Personal Access Token which has Read & Execute for Builds, Read, write & manage for Code, Read for Project and Team, Read, write & execute for Release to the organisation you deploy this Provisioner for. |
AzureDevOps.Repository.YamlPipelineFilePath |
pipeline-orchestrator.yml |
The path to your pipeline YAML. |
AzureDevOps.Repository.Author.Name |
John Doe |
Your displayname to be used in the GIT commit while provisioning the repositories. |
AzureDevOps.Repository.Author.Email |
[email protected] |
Your e-mailadress to be used in the GIT commit while provisioning the repositories. |
AzureDevOps.Pipeline.BuildAgentQueueName |
Hosted Ubuntu 1604 |
The buildqueue name. For now we recommend using Hosted Ubuntu 1604 as the value. Other values seem to have bugs. You can override the real buildqueue in your YAML pipeline. |
AzureDevOps.Pipeline.DefaultPipelineNamePostfix |
SomeOptionalPostfix |
Optional. The pipeline created based on the AzureDevOps.Repository.YamlPipelineFilePath file in the root dir will receive this postfix. |
- Deploy this Azure Function (see next chapter for pipelines)
- Add a
Service Hook
(with the typeWebhook
) in your Azure DevOps TeamProject with a trigger onCode Pushes
toAny
repository, branch or member of a group. - Create a template repo
Test.Templates.Microservice
- Put some files inside the
Test.Templates.Microservice
repo. Make sure to put[[COMPONENTNAME]]
somewhere in the filenames or in the file contents. - Make sure to also put in a YAML Pipeline into the repo (we use
pipeline-orchestrator.yml
for this in the root of the repository). - Create a new repo
Test.Microservice.MyFirstMicroservice
(make sure to commit a readme or anything, so that there will be a code push initialized) and wait a few seconds. - Refresh the page and you will see the processed files from the
Test.Templates.Microservice
repository in your newTest.Microservice.MyFirstMicroservice
repository! - Go to
Pipelines
-->All
and find your new pipeline(s) imported!
We've also included pipelines to deploy this functionapp to Azure. There are two flavours: with or without application gateway. In both pipelines you can enable vnet whitelisting/integration to avoid resources from being publicly exposed. Make sure to read the readme's in the top of the pipeline-orchestrator files.