DevOps Classroom notes 28/Oct/2023

Build a dotnet application

sudo apt-get update && \
  sudo apt-get install -y git dotnet-sdk-7.0
  • Manual steps:
git clone https://github.com/nopSolutions/nopCommerce.git
cd nopCommerce
git checkout master
dotnet build src/NopCommerce.sln -c Release
dotnet test -c Release src/Tests/Nop.Tests/Nop.Tests.csproj -o TestResults/
dotnet publish src/Presentation/Nop.Web/Nop.Web.csproj -c Release -o published/

Azure DevOps Pipeline

  • Our agent is still default
  • build steps
dotnet build src/NopCommerce.sln -c Release
dotnet test -c Release src/Tests/Nop.Tests/Nop.Tests.csproj -o TestResults/
dotnet publish src/Presentation/Nop.Web/Nop.Web.csproj -c Release -o published/
  • When should the project be built
    • option 1: Whenever code is pushed to some branch
    • option 2: At schedule time
    • option 3: On Pull Request
  • Sections in Azure DevOps pipeline yaml

  • Crontab Refer Here
  • Pipeline which i have built so far
---
pool: default

trigger:
  - master

steps:
  - task: DotNetCoreCLI@2
    inputs:
      command: build
      projects: src/NopCommerce.sln
      configuration: Release
  - task: DotNetCoreCLI@2
    inputs:
      command: test
      projects: "**/*.Tests.csproj"
      publishTestResults: true
  • Exercise: add the publish step and also zip the files after publish
  • change the names displayed during build to
    • build the code
    • test the code
    • publish the code
      Preview

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner