DevOps Classroomnotes 22/May/2022

Azure DevOps

  • Azure DevOps provides the services for allowing teams to plan work, code collaboration and development, build and deploy applications.
  • Azure DevOps comes in two offerings
    • Azure DevOps Server (Self Hosted)
    • Azure DevOps Services
  • Installing Azure DevOps Server Refer Here for single server and Refer Here for two server installation and Refer Here for multi server installation
  • Azure DevOps Services Can be signed Refer Here
  • Login into Azure DevOps Account, Create an Organization and project as discussed in the class
    Preview
  • You can perform Agile Project Management, Sprint planning etc with Boards
    Preview
  • Any Documentations w.r.t your project can be hosted using wikis
    Preview
    Preview
  • When you work with Azure DevOps, you can use Git or TFS version control system. The default version control system is Git and Source code can be hosted in the Git Repositories by Azure DevOps
    Preview
  • We can use this for version control
    Preview
  • Now since we have the code in the repository, the only thing that is left is creating a ci/cd pipeline.
  • To execute this pipeline we need servers (similar to jenkins nodes) which we refer as agents.
  • Refer Here to the list of the microsoft hosted agents
  • We can also use our
  • So for our project needs we would setup necessary agents.
  • To Create a pipeline we use YAML Language.
  • Refer Here for the YAML Schema reference
  • The pipeline is base of the YAML Schema Refer Here
  • The file which you need to create is azure-pipelines.yaml
  • Java pipeline example Refer Here
    Preview
# 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:
- develop

pool:
  vmImage: ubuntu-latest

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

  • Lets setup the Microsoft Agent
    Preview
  • Configure Parallel jobs and run the pipeline
    Preview
  • Refer Here for the tasks
  • Refer Here for the view of all of the tasks

Lets setup the self hosted agent

  • Ensure you have a linux instance with java, maven, git installed
  • Lets create a new agent pool
    Preview
    Preview
  • Now we need to configure and generate a token Refer Here
    Preview
  • Follow the instructions for setting up the agent and view the agent status
    Preview
  • Example CI/CD Pipeline
# 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:
  - sprint_release_1
stages:
  - stage: build
    displayName: 'build the spring petclinic'
    pool: qtpool
    jobs: 
      - job: 'buildthecode'
        steps:
          - task: Maven@3
            inputs:
              mavenPomFile: 'pom.xml'
              mavenOptions: '-Xmx3072m'
              javaHomeOption: 'JDKVersion'
              jdkVersionOption: '1.11'
              jdkArchitectureOption: 'x64'
              publishJUnitResults: true
              testResultsFiles: '**/surefire-reports/TEST-*.xml'
              goals: 'package'
  - stage: deploy
    displayName: 'deploy the application'
    pool: 
      vmImage: ubuntu-20.04
    jobs:
      - job: 'deploy'
        steps:
          - task: Bash@3
            inputs:
              script: 'ansible --version'

  • Exercise: Create an Azure pipeline to build gameoflife/spring petclinic from github using agent of your choice Refer Here
  • Refer Here for using azure pipelines of different technologies
  • Try to create the Jenkinsfile for the examples of
    • .net core
    • python
    • nodejs

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner