0

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://learn.microsoft.com/en-us/azure/devops/pipelines/repos/multi-repo-checkout?view=azure-devops

Thanks, AK

KeenUser
  • 5,305
  • 14
  • 41
  • 62

2 Answers2

0

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.

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
0

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.

michiel Thai
  • 547
  • 5
  • 16
  • Probably this is the way to go, because if I check out multiple repositories in a single pipeline, I cannot have the build triggered for a check in, in any of the branch.It could be possible, but not sure if it would complicate things more. Having two separate build pipelines might simplify things – KeenUser Nov 25 '20 at 23:34