Repository that contains our azure pipelines templates that are used in the CI/CD workflow of the .NET applications.
It is a refactored and improved version of the previously version.
We have two templates that we can use in our applications (github flow and git flow). To use them, the only thing you have to do is change the name to azure-pipelines.yaml e put in to the ./devops folder.
For now, it is required to use it together with two other variable templates, variables.production.yml and variables.staging.yml in the devops folder.
You have two edit and change a few things to adapt to your needs. In this part you will have to change the last two lines and change to your default pipeline variable group and the specific api variable group.
variables:
- template: 'variables/defaults.template.yml@templates' # Default static pipeline variables
- group: DEFAULT_PIPELINE_LIB
- group: API_PIPELINE_VARIABLES
In my case, the default variable group name is Pipeline_Defaults. And inside it, you will have a few variables that will be shared across all your azure devops projects pipelines.
The url to the company's docker registry.
Your azure devops organization service docker connection name. You can find or configure it this way:
- Go to Project Settings when inside your azure devops project in the left bottom button.
- Go to Service Connections and there you will find or configure your docker service name.
Our azure devops organization name.
Your azure devops organization service Sonarqube connection name. You can repeat the same steps that you used to find the docker registry connection name.
In this variable group, you will put your api specific variables that suits your workflow.
Variable that is needed when the api is deployed using Docker. It is the docker image name.
Important variable that it's value will be used to preffix all application variables when deployed.
Flag variable that controls if the application will be deployed using docker or not.
Flag variable that controls if the integration tests will be executed when deploying to staging.
Flag variable that controls if the application will deploy a SDK project to nuget.
Flag variable that controls if the sonarqube static analysis will be executed every time a build is triggered.
Flag variable that controls if the application xunit unit tests will be executed every time a build is triggered.
Time that the pipeline will wait after staging deployment and before executing the integration tests. The format is 15s for example.
Path to the main project folder.
Name of the main project. It will be used as the name of the Sonarqube project in sonar cloud.
Full path to the nuget config file. It will be used as an argument when building the application to restore private packages.
Path to the SDK project folder.
Name of the sonar cloud project that was created by an administrator to hold the api analysis.
Path to the test project folder.
Now you only have to change to your github project service connection name. Just the value in the endpoint property.
resources:
repositories:
- repository: templates
type: github
name: eduardosbcabral/azure-pipelines-templates
endpoint: YOUR_SERVICE_GITHUB_CONNECTION_NAME
Now you are ready to go and using a shared azure pipeline.