Combining multiple repositories with Azure DevOps pipeline (III)

Published Jun 26 2021 12:25 AM 8,527 Views
Microsoft

Introduce the second source repository

Let's go back to the YAML file editing interface and add the following paragraph after the trigger:- master segment at the beginning of the file:

 

resources:
  repositories:
    - repository: Angular
      name: <YourProjectName>/ASP_Angular
      type: git
      ref: main

 

Here repository:  Angular is a code name for the referenced source repository, which can be simply called later.

name: <OurProjectName>/ASP_Angular is the "project name / repository name" format.

ref: Main claims to use the main branch.

Then add  after steps:

 

- checkout: Angular
  displayName: 'checkout Angular'

- checkout: self
  displayName: 'check Backend'

 

The task means checking out the front-end repository. Because a second source repository is introduced, the current repository itself also has a task - checkout:self to check out. Now save and run. Because a second source repository is included in the current pipeline, we will see a prompt to grant permission when we run this pipeline for the first time.  

snowpeak_0-1624691957631.png

 

Click the View button.

snowpeak_1-1624691957649.png

 

Just click the "Permit" button on the float layer. This permission only needs to be done the first time we add a task, and it won't pop up again.

This execution probability will fail.

snowpeak_2-1624691957661.png

 

We click on this error message and jump directly to the specific error log.

snowpeak_3-1624691957675.png

 

ASP build tasks that used to work properly did no work this time. Let's locate the task that were previously built by the wizard.  

 

- script: dotnet build --configuration $(buildConfiguration)
  displayName: 'dotnet build $(buildConfiguration)'

 

Replace with this below.

 

- task: DotNetCoreCLI@2
  displayName: 'dotnet build'
  inputs:
    command: 'build'
    projects: '**/*.csproj'
    arguments: '--configuration $(BuildConfiguration)'

 

Save and run again and it works fine. We click on the Job link on the green check-in on the job run details page to see that the task of checking out the back-end repository of the front-end repository in the log is complete, and we can click on each task name to view the detailed log.

snowpeak_4-1624691957689.png

Note that there is a line in the log checked out by the front-end project here

git init "/home/vsts/work/1/s/ASP_Angular"

This means the path where the front-end code was saved in the container that our job was executed by the pipeline. We note this path down and we will need it to add build tasks later.

3 Comments
Co-Authors
Version history
Last update:
‎Jun 26 2021 07:50 PM
Updated by: