DevOps Classroom notes 12/Apr/2025

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
    • build
    • agent
    • ..
  • 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
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%