DevOps Classroom Series – 30/May/2020

Azure DevOps

  • Azure DevOps offers services to

    • Plan work
    • Source Code Management
    • Build and Deploy application
  • Visual Studio Team Services is now Azure DevOps

  • Azure DevOps has two modes

    • Azure DevOps Services:
      • This is a hosted service.
      • On Azure Cloud Azure DevOps is hosted
    • Azure DevOps Server
      • You need to install the Server
      • Generally used for On-Premise builds and deployments
  • Azure Services

    • Azure Repos:
      • Git or Team Foundation Version Control
    • Azure Pipelines
      • provides build and release pipelines for delivery of application
    • Azure Boards
      • set of Agile tools to support planning, tracking work using kanban and Scrum
    • Azure Test Plans
      • Tools to test apps
    • Azure Artifacts
      • Like artifactory a binary repository with Maven, npm, nuget etc capabilities.
  • Azure DevOps Services:

    • Option 1: Using Azure Login
    • Option 2: Create an azure DevOps Services signin using GitHub from here
  • Create an Organization and Project in Azure DevOps Services Preview

Azure DevOps Interfaces

Azure DevOps Pipelines

  • Note: This whole series is assuming you know Jenkins and Jenkins Pipelines
  • Lets do the basic comparision

Jenkinsfile vs azure-pipelines.yml

  • In Jenkins the pipleines are configured in Jenkinsfile and in azure-devops we create the pipeline in azure-pipelines.yml
  • Example Jenkinsfile
pipeline {
    agent any
    stages {
        stage('build') {
            steps {
                git 'https://github.com/mycode.git'
                sh 'mvn package'
            }
        }
    }
}
  • Same in azure-pipelines.yml
jobs:
  - job: build
    steps:
      - script: git clone 'https://github.com/mycode.git'
      - script: mvn package
  • Jenkins Pipeline Structure Preview

  • Azure Pipeline Structure Preview

  • note: Agent is exactly like Jenkins Node

  • Agents: Agents are of three types

    • Microsoft Azure Agents:
      • These agents are created/managed By DevOps pipeline in Azure
      • Need to know the names of the image/label Refer Here
    • Self-Hosted
    • Container
  • Agents are grouped as Agent pools and Each agent will have capabilities.

  • In Jenkins We Use Parameters to pass inputs to the Job, Same in Azure DevOps.

  • In Jenkins we use pipeline steps reference Refer Here and in the case of Azure DevOps we use tasks for actual activities Refer Here

  • YAML Schema References

Scenario: Build a Java Project on Microsoft Hosted Agent

  • Open the project in visual studio code (gameoflife) and ensure azure devops extensionis installed Preview

  • Lets write a pipeline

---
trigger:
  - master
  - develop

pool:
  name: KhajaLearning

stages:
  - stage: Build
    jobs:
      - job: 'BuildJob'
        steps:
          - task: Maven@3
            inputs:
              goals: deploy
              mavenPomFile: 'pom.xml'
              publishJUnitResults: true
              testResultsFiles: '**/surefire-reports/TEST-*.xml'
              javaHomeOption: 'JDKVersion'
              mavenVersionOption: 'Default'
              mavenAuthenticateFeed: false
              effectivePomSkip: false
              sonarQubeRunAnalysis: false
      - job: 'Deploy'
        steps:
          - task: Bash@3
            inputs:
              targetType: inline
              script: 'terraform init ./deployment/ && terraform apply -auto-approve ./deployment/'
          

Summary

  1. Configure Git Repos

  2. Add azure-pipelines.yaml

  3. Configure Artifacts and create feed (if required)

  4. Maintain the structure and look at YAML task definitions Refer Here

  5. Exercise: Create a azure devops pipeline for spring pet clinic

Leave a Reply

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

Please turn AdBlock off
Customized Social Media Icons from Acurax Digital Marketing Agency

Discover more from Direct DevOps from Quality Thought

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

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube