DevOps Classroom Series – 10/Oct/2020

Azure DevOps

  • Formerly called as Visual Studio Team Services (VSTS)

  • Azure DevOps provides developer services to support teams to

    • plan work
    • collaborate on code development
    • build applications
    • deploy applications
  • Azure DevOps provides the following Services

    • Azure Repos:
      • Git Repositories or TFVC for source control of your code
    • Azure Pipelines:
      • Provide build & release services to support ci/cd
    • Azure Boards
      • Suite of agile tools to support planning & tracking work, code defects and issues.
    • Azure Test Plans:
      • Provides tools to test apps.
      • It support manual testing and continous testing
    • Azure Artifacts:
      • allows the team to share Maven, npm and Nuget Packages from public and private sources and integrate package sharing into CI/CD
  • Azure DevOps is available as

    • Azure DevOps Services:
      • This is a hosted solution
      • Quick setup
      • Comes will all the servcies mentioned above
    • Azure DevOps Server
      • On-Premise installation is required
      • Refer Here for installation
  • Create a Git Repository for the project using New Repository Section.

  • To Setup the build just click on Setup Build and Select Maven, The Pipleine will start building the code. sounds simple. Preview Preview

  • Now lets look at what happens. Azure Pipelines will create a file called as azure-pipelines.yml in the root folder of version control which looks as shown below\

# Maven
# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/java

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: Maven@3
  inputs:
    mavenPomFile: 'pom.xml'
    mavenOptions: '-Xmx3072m'
    javaHomeOption: 'JDKVersion'
    jdkVersionOption: '1.8'
    jdkArchitectureOption: 'x64'
    publishJUnitResults: true
    testResultsFiles: '**/surefire-reports/TEST-*.xml'
    goals: 'package'

  • Now lets try to understand how to write this kind of a file.
  • Note: Azure DevOps is very well documented Refer Here

Concepts of Azure Pipelines

  • Lets look at the basic workflow Refer Here Preview
  • To write a pipeline we need to understand YAML Refer Here and YAML Schema for Azure DevOps Refer Here
  • Now lets see the equivalent Jenkinsfile for the above azure-pipelines
pipeline {
    agent {
        label: 'ubuntu-latest'
    }
    stages {
        stage('packagepetclinic'){
            steps {
                sh 'mvn package'
                junit '**/surefire-reports/*.xml'
            }
        }
    }
}

Pools and Agents

  • Configuring Agents and Pools Preview Preview Preview Preview Preview Preview
  • We have two options for pools
    • Self Hosted:
      • This can be any virtual machine/physical connected to internet and then we need to configure the agent
    • Azure Virtual Machine Scale Sets: Azure vmss can automatically scale up/down to handle build loads
  • Lets configure a self hosted agent Preview Preview Preview
  • Now follow the steps to download the agent.
  • Detailed instruction for configuring agent Refer Here
  • To configure the Agent we require PAT

Leave a Reply

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

About learningthoughtsadmin