Reputation: 3256
We're trying to release an Angular 7 / .NET Core application into Azure using the DevOps release pipelines. I have my build setup to create the .NET and Angular builds as separate artifacts which you can see in the screen shots below (under the Package or Folder box).
From what I've read it seems that you need to create two separate release tasks to deploy the builds to the web app. However the second build seems to be overriding the first which is causing the API not to start.
Does anyone know of a way to ensure the deployments in a given stage simply appends the changes rather than replacing them? Or is there something else I am missing here?
Upvotes: 1
Views: 1725
Reputation: 777
My recommendation would be to implement the following pattern for your pipeline:
You're missing step 3, so you'd want something like the following logic defined in YAML, where you create a new zip that represents your actual deployed bits in your pipeline. Then release that artifact, since it is the representation of what you have running on your instances.
- job: CreateReleaseArtifact displayName: 'Package for shared-hosting of angular app and web api' pool: vmImage: windows-2019 dependsOn: - BuildNetcore - BuildAngularApp condition: succeeded() steps: - checkout: none - download: current - task: CopyFiles@2 displayName: 'Copy WebApi Files' inputs: SourceFolder: $(Pipeline.Workspace)/api Contents: '**/*' TargetFolder: $(Pipeline.Workspace)/package includeRootFolder: false - task: CopyFiles@2 displayName: 'Copy Angular Files' inputs: SourceFolder: $(Pipeline.Workspace)/webapp Contents: 'wwwroot/**' TargetFolder: $(Pipeline.Workspace)/package includeRootFolder: true OverWrite: true - publish: $(Pipeline.Workspace)/package artifact: package
Upvotes: 1
Reputation: 24569
Does anyone know of a way to ensure the deployments in a given stage simply appends the changes rather than replacing them?
Based on my experience, in your case, after deploy the API or Angular 7, then I you could use the Kudu zip API to upload another one to the Azure WebApp.
You could use the Powershell task to do that. For more inforamtion about powershell demo code, you could refer to this link.
If creating another WebApp is acceptable, you could add a new WebApp and use the same service plan (no extral cost). Then you could deploy them separately.
Upvotes: 0