Microsoft Hosted Agents
- Microsoft hosted agents are hosted by ado
- For list of agents with softwares installed in it Refer Here
Dotnet core build on Microsoft Hosted Agent
- Watch classroom video
- Run on every pull request to develop branch
---
pool:
vmImage: ubuntu-latest
trigger: none
pr:
- develop
steps:
- task: DotNetCoreCLI@2
displayName: Restore Projects
inputs:
command: restore
projects: "src/NopCommerce.sln"
- task: DotNetCoreCLI@2
displayName: Build the Web Project
inputs:
command: build
projects: "**/Nop.Web.csproj"
- Run on every change pushed to develop branch i.e. this executes whenever a PR is merged.
---
pool:
vmImage: ubuntu-latest
trigger:
- develop
steps:
- task: DotNetCoreCLI@2
displayName: Restore Projects
inputs:
command: restore
projects: "src/NopCommerce.sln"
- task: DotNetCoreCLI@2
displayName: Build the Web Project
inputs:
command: build
projects: "**/Nop.Web.csproj"
- task: DotNetCoreCLI@2
displayName: Run the tests
inputs:
command: test
projects: "**/Nop.Tests.csproj"
- Run pipeline on schedule
- day build every 2 hours on a weekday
- nightly build on release branch at 10 PM
- Day build for every 2 hours on weekdays
---
pool:
vmImage: ubuntu-latest
trigger: none
schedules:
- cron: "30 */2 * * 1-5"
displayName: "CI Schedule every 2 hours on Weekday"
branches:
include:
- develop
batch: false
always: false
steps:
- task: DotNetCoreCLI@2
displayName: Restore Projects
inputs:
command: restore
projects: "src/NopCommerce.sln"
- task: DotNetCoreCLI@2
displayName: Build the Web Project
inputs:
command: build
projects: "**/Nop.Web.csproj"
- task: DotNetCoreCLI@2
displayName: Run the tests
inputs:
command: test
projects: "**/Nop.Tests.csproj"
- Exercise: Try React Js Project
Reusability
Parameter & Variables
- Azure DevOps Pipeline Variables
- Azure DevOps has lots of predefined variables with information about
- Allows us to use Environmental Variables
- Allows to create user defined variables
- Allows to organize variables in a variable group
Exercise:
- Add publish in the devops ci pipeline which runs once every 2 hours
- Also add configuration = Release for CI and configuration = Debug for PR pipeline