Last active
July 24, 2020 20:08
-
-
Save frankely/de9a9113e5618ac3c4ffa3f48d430ae2 to your computer and use it in GitHub Desktop.
Pulumi Azure DevOps Pipeline .Net Core WebApi Deployment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure to set up the stagingDirectory locally so you can also run pulumi preview/up.