How to use this appendix
Use this as the complete Azure Pipelines YAML reference for the demo applications.
Before running these listings, connect the intended GitHub repository to Azure Pipelines and configure the named hosted image/SDK. S3 deployment additionally requires AWS CLI v2, the bucket value and approved AWS authentication on the agent. Authentication configuration is intentionally environment-specific; the placeholder comments do not authenticate a deployment. See Prerequisites.
D.1 C# pipeline
trigger:
branches:
include:
- main
pr:
branches:
include:
- main
pool:
vmImage: windows-latest
stages:
- stage: BuildAndTest
displayName: Build and test
jobs:
- job: Build
displayName: Build C# demo
steps:
- checkout: self
- powershell: |
dotnet restore JenkinsCSharpDemo.sln
displayName: Restore
- powershell: |
dotnet build JenkinsCSharpDemo.sln --configuration Release --no-restore
displayName: Build
- powershell: |
dotnet test JenkinsCSharpDemo.sln --configuration Release --no-build
displayName: Test
- powershell: |
dotnet publish src/JenkinsHelloWorld/JenkinsHelloWorld.csproj `
--configuration Release `
--runtime win-x64 `
--self-contained false `
--output "$(Build.ArtifactStagingDirectory)/publish"
displayName: Publish application
- publish: $(Build.ArtifactStagingDirectory)/publish
artifact: JenkinsHelloWorld
displayName: Publish pipeline artifact
D.2 Static-site pipeline
trigger:
branches:
include:
- main
pool:
vmImage: windows-latest
stages:
- stage: ValidateAndDeploy
jobs:
- job: Site
steps:
- checkout: self
- powershell: |
./scripts/Test-StaticSite.ps1
displayName: Validate static site
- powershell: |
aws s3 sync ./site "s3://$(S3_BUCKET)"
displayName: Deploy to S3
Required secret/runtime configuration is deliberately external to source control.