Setting up deployment for a new service - Arthyon/microservice-poc GitHub Wiki
To make a new service available you need to add some configuration. First the required build-pipeline and deploy must be created in Azure DevOps, then the Kubernetes-configuration must be updated in the repository.
Azure DevOps
A new build pipeline must be added, in addition to connecting this pipeline to the input artifacts in the deploy pipeline.
Adding a new build
The easiest way to do this is to clone an existing pipeline by selecting one, then choosing ... -> Clone.
- Change the name but leave the YAML file path as is
- Choose the
Get sources-step and change Tag format prefix to the new servicename - Change the variables
serviceNameandsourceRootto match the new service - Save and Queue
Connecting build to release
- Wait for the first build to complete so the Container registry is updated with the new image
- Edit the release pipeline and
+ Adda new artifact. - Choose
Buildand choose the new build pipeline - Set Default version to
Latest - Note the value in
Source alias, it is important later Add
If the new artifact should automatically trigger a deploy, click the small lightning icon and enable the trigger.
In the repository
Make note of these values to make it easier to set up:
- The
Source aliasfrom the previous step - The
nameof the service you chose when creating the template - The
serviceName-variable from the build pipeline
Start by copying one of the existing entries in values.cloud.yaml, depending on if it is a .Net or Node-service and name it the same as the name in the template.
The version-label is fetched from an environment variable during the deployment, and is on the form RELEASE_ARTIFACTS_{Source alias}_BUILDNUMBER. Add the source alias here, as well as in the container image.
NOTE: This will most likely use double underscore because the source alias contains an underscore.
The container image is on the form {registryName}/{serviceName}:{buildnumber}. registryName is common for all images, so this can stay as it is. serviceName is the variable from the build pipeline. Buildnumber is the variable from the previous paragraph.
Publishing Api to Api Management
There is a special Task group that publishes api specifications during the deploy.
Go to Task groups in the side menu and edit the group named Publish Api Specifications.
Right click and clone one of the existing entries. This is a powershell script (Can be found in Infrastructure/apim) that will interact with Azure Api Management Service.
Change the Display name of the task to reflect the new service's name. Click ... next to Script Arguments and change these properties:
apiName: The display name of the api in Azure Management Services. MUST be wrapped in quotation marks if it contains spacesapiId: A unique identifier, could be service name separated by dashesbuildNumber: Is on the form$(Release.Artifacts.<source alias>.BuildNumber)apiSuffix: Same as path chosen in the Ingress during initial service setup (without the first / )swaggerFilePath: Path to the swagger artifact, on the form$(System.ArtifactsDirectory)/<source alias>/specification/api.swagger.json
Save the Task group.