Azure DevOps - Handling single release for separate code repositories for UI and Dotnet API layer

筅森魡賤 提交于 2021-01-29 06:38:40

问题


I have separate existing code repositories- One for Angular UI and one for .NET 4.7 API layer. In the manual process, The compiled UI code is placed in wwwroot folder after dotnet publish is executed, and the artifacts are deployed to an Azure App service. While trying to implement CI using Azure DevOps, I had to create two build pipelines for UI and BackEnd. In the release pipeline, it looks like I have to unzip the artifacts, write a copy step to UI artifacts into wwwroot and then again zip it before deploying to an App service.

I can only imagine this isnt the best approach. Given that I am new to Azure DevOps, I would like to know the best practices especially while handling relatively legacy code. I would have kept both the UI and API layer in a single repository if I could do that now. What is the best way to handle this?

UPDATE - Can I have multiple repositories built in a single build pipeline? Based on the article - https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/multi-repo-checkout?view=azure-devops

Thanks, AK


回答1:


Yes you can have multiple repo.

resources:
  repositories:
  - repository: MyGitHubRepo # The name used to reference this repository in the checkout step
    type: github
    endpoint: MyGitHubServiceConnection
    name: MyGitHubOrgOrUser/MyGitHubRepo
  - repository: MyBitbucketRepo
    type: bitbucket
    endpoint: MyBitbucketServiceConnection
    name: MyBitbucketOrgOrUser/MyBitbucketRepo
  - repository: MyAzureReposGitRepository # In a different organization
    endpoint: MyAzureReposGitServiceConnection
    type: git
    name: OtherProject/MyAzureReposGitRepo

trigger:
- main

pool:
  vmImage: 'ubuntu-latest'

steps:
- checkout: self
- checkout: MyGitHubRepo
- checkout: MyBitbucketRepo
- checkout: MyAzureReposGitRepository

- script: dir $(Build.SourcesDirectory)

And in terms of your original question you can publish your changes and without zipping them (set zipAfterPublish to false):

- task: DotNetCoreCLI@2
  inputs:
    command: publish
    publishWebProjects: True
    arguments: '--configuration $(BuildConfiguration) --output output_folder'
    zipAfterPublish: False
    workingDirectory: backend/app/

and then copying your wwwroot and zipped wwwroot and your backend app into two separate archives and publishem them.




回答2:


I would create two build pipelines that publishes a package after each successful build to an Azure Artifact Feed.

Then 1 deploy pipeline that downloads both packages and apply further deploy logic.



来源:https://stackoverflow.com/questions/65000368/azure-devops-handling-single-release-for-separate-code-repositories-for-ui-and

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!