azure-devops
A collection of templates and tools for use with Azure DevOps.
#
Installationazure-pipelines.yml
#
StagesFor most use cases, the stage template will be able to handle all your build and deployment needs.
#
Steps- Build the app (See Build for more details)
- Deploy to Int (See Deploy from more details)
- [Optional] Create Sentry release (See Sentry for more details)
- Deploy to RC
- Deploy to Prod
#
Usageazure-pipelines.yml
#
Parametersparameter | required | default | description |
---|---|---|---|
build | no | {} | Parameters to pass to the build job. See below for details. |
sentry | no | {} | Parameters to pass to the build job. See below for details. |
deploy.buildPath | no | $(Pipeline.Workspace)/drop | The directory to find the app's build artifact in. |
deploy.{env} | no | {} | Parameters to pass to deploy stages by {env} . |
deploy.{env}.environment | no | {env} | The Azure DevOps environment. Used for manual release approvals. |
deploy.{env}.resourceGroup | no | hub-{env} | The Azure resource group the appService is under. |
deploy.{env}.subscription | no | Prod: SharedMicroservices-Production Others: SharedMicroservices-Development | The Azure subscription the appService is under. |
deploy.{env}.appService | no | The Hub app service for the given environment. Eg. hub-{env}-westus1 | The Azure subscription to deploy the app to. |
deploy.{env}.condition | no | Int: Not a PR and on the master , develop , or main branchOthers: The previous stage succeeded | |
deploy.{env}.dependsOn | no | The previous environment's deploy stage. | The stage name to depend on prior to running this environment's deploy stage |
#
BuildA build job template is provided for apps under Hub DevOps Project.
#
Steps- Access GitHub Service User credentials from the
BuildAndDeployShared-KV
key vault - Configure Git to fetch GitHub repositories with HTTPS and service user credentials. This is a compatibility fix for Hub v1 apps.
- Install Node.js
- Uses the
nodeVersion
parameter
- Uses the
- Set variables
- Sets the artifact output directory from the
package.json
homepage
property - Detects if the repository is using
npm
oryarn
as a package manager
- Sets the artifact output directory from the
- Authenticate NPM Registry
- Install dependencies with the detected package manager
- Build
- Replace version numbers in
main.js
for Hub v1 apps to cache bust - Test
- Sets the
CI
environment variable to true to disable test watching inreact-scripts
- Sets the
- Create ping
- Create a
ping
json file inbuildDir
with the name and version frompackage.json
- Create a
- Copy Files
- Publish Build Artifacts
#
Usageazure-pipelines.yml
parameter | required | default | description |
---|---|---|---|
hubVersion | no | 3 | The version of the Hub framework to build |
buildDir | no | 'build' | The directory containing the build output |
nodeVersion | no | '12.x' | Node.js version pattern Azure DevOps docs |
pool | no | vmImage: 'ubuntu-16.04' | The pool option value Azure DevOps Docs |
workingDirectory | no | '.' | The directory of where your web project to build resides (if it is not in the root of the repo). This is where npm will be run. |
#
DeployA deploy stage template is provided for deploying Hub Apps to a single environment.
#
Steps- Validate parameters
- Start Azure App Service staging slot
- Delete the previous app folder contents in the staging slot
- Upsert the app folder to the provided Azure App Service staging slot
- Check ping endpoints for the
hub.app
and for the deployed app on staging slot - Delete the previous app folder contents in the production slot
- Upsert the app folder to the provided Azure App Service production slot
- Stop Azure App Service staging slot
#
Usageazure-pipelines.yml
parameter | required | default | description |
---|---|---|---|
environment | yes | The name of the Azure DevOps environment | |
subscription | yes | The Azure subscription the App Service is under | |
appService | yes | The name of the App Service to deploy to | |
resourceGroup | yes | The name of the resource group where the App service is located | |
buildPath | yes | The path to the downloaded artifact. This contains the Hub App bundle. |
#
SentryAn optional Sentry stage template is provided for creating Releases in Sentry and uploading sourcemaps. This will pre-create a Release in Sentry in which your application code can report against.
If you intend to utilize this feature, please ensure that Sentry is properly initialized in your application code.
#
Steps- Grabs Sentry credentials from Key Vault
- Installs Node.js
- Uses the
nodeVersion
parameter
- Uses the
- Install
sentry-cli
- Create Release in Sentry
- Uses
{package.json name}@{package.json version}
format for release name
- Uses
#
Usageazure-pipelines.yml
parameter | required | default | description |
---|---|---|---|
project | yes | The name of the Sentry project. Should be the same Project in which you initialize Sentry with (via the DSN). | |
nodeVersion | no | '12.x' | Node.js version pattern Azure DevOps docs |