Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frankely/de9a9113e5618ac3c4ffa3f48d430ae2 to your computer and use it in GitHub Desktop.
Save frankely/de9a9113e5618ac3c4ffa3f48d430ae2 to your computer and use it in GitHub Desktop.
Pulumi Azure DevOps Pipeline .Net Core WebApi Deployment
pool:
vmImage: 'ubuntu-latest'
trigger:
batch: true
branches:
include:
- master
- releases/*
paths:
include:
- DevOps/ChiliPepperPod
variables:
buildConfiguration: 'Debug'
Directory: 'DevOps/ChiliPepperPod'
PackagesToPack: '$(Directory)/WebApi/WebApi.csproj'
PulumiDirectory: '$(Directory)/WebApi.Deployment'
stages:
- stage: Publish
jobs:
- job: Publish
displayName: 'Publish'
steps:
- task: DotNetCoreCLI@2
displayName: 'Publish WebApi'
inputs:
command: 'publish'
arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)/WebApi'
projects: '$(PackagesToPack)'
workingDirectory: '$(Directory)'
- publish: $(Build.ArtifactStagingDirectory)/WebApi
displayName: 'Publish Artifact'
artifact: WebApi
- job: Deploy
dependsOn: Publish
displayName: 'Deploy'
steps:
- download: current
displayName: 'Download Artifact'
artifact: WebApi
- task: Pulumi@1
displayName: 'Set stagingDirectory'
inputs:
command: 'config'
args: 'set stagingDirectory $(Pipeline.Workspace)/WebApi/WebApi.zip'
cwd: '$(PulumiDirectory)'
stack: 'dev'
- task: Pulumi@1
displayName: 'Preview'
inputs:
azureSubscription: '$(AzureSubscription)'
command: 'preview'
cwd: '$(PulumiDirectory)'
stack: 'dev'
- task: Pulumi@1
displayName: 'Deploy'
inputs:
azureSubscription: '$(AzureSubscription)'
command: 'up'
args: '--yes'
cwd: '$(PulumiDirectory)'
stack: 'dev'
@frankely
Copy link
Author

Make sure to set up the stagingDirectory locally so you can also run pulumi preview/up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment