DevOps Classroomnotes 05/Feb/2023

Azure Pipeline (YAML)

  • Azure Pipelines Representation
    Preview
  • Azure Pipeline is collection of
    • Stages: Each Stage is collection of Jobs
    • Job: Collection of Steps
    • Each Step can be executed using Task or script (direct command)
  • If you only one stage directly we can write jobs in pipeline
  • If you only one stage and one job we can directly write steps in pipeline

Lets try to write a YAML pipeline for spring petclinic

  • We need git, JDK 17 and maven so we need to figure out which agent has these softwares or create your self hosted agent with all the softwares installed and maintained by you.
  • Refer Here for the official docs of Azure DevOps Microsoft Hosted agents
  • Microsoft hosted agents will be of size D2S (2 vcpu and 8 GB)
  • Pipeline with stages structure Refer Here
  • Pipeline with job structure Refer Here
  • Creating YAML files in visual studio code
    Preview
  • Azure DevOps has lot of predefined tasks for build and deployment Refer Here
  • Lets create YAML with stages
---
pool:
  name: "Azure Pipelines" 
  vmImage: 'ubuntu-latest'

trigger:
  - main

stages:
  - stage: BuildStage
    displayName: CI
    jobs:
      - job: mavenjob
        displayName: maven
        steps:
          - task: Maven@3
            inputs:
              mavenPomFile: 'pom.xml'
              goals: 'package'
              publishJUnitResults: true
              testResultsFiles: '**/surefire-reports/TEST-*.xml'
              jdkVersionOption: '1.17'


  • Same pipeline with jobs
---
pool:
  name: "Azure Pipelines" 
  vmImage: 'ubuntu-latest'

trigger:
  - main


jobs:
  - job: mavenjob
    displayName: maven
    steps:
      - task: Maven@3
        inputs:
          mavenPomFile: 'pom.xml'
          goals: 'package'
          publishJUnitResults: true
          testResultsFiles: '**/surefire-reports/TEST-*.xml'
          jdkVersionOption: '1.17'


  • Same pipeline with steps
---
pool:
  name: "Azure Pipelines" 
  vmImage: 'ubuntu-latest'

trigger:
  - main

steps:
  - task: Maven@3
    inputs:
      mavenPomFile: 'pom.xml'
      goals: 'package'
      publishJUnitResults: true
      testResultsFiles: '**/surefire-reports/TEST-*.xml'
      jdkVersionOption: '1.17'


Lets build a java 8 project

  • Manual steps
git clone https://github.com/wakaleo/game-of-life.git
cd game-of-life
mvn package
# gameoflife-web/target/gameoflife.war

Azure DevOps – EcoSystem

  • Refer Here for demonstrations from azure devops
  • Use this for examples on different technologies

Exercise

  • Build openmrs
git clone https://github.com/openmrs/openmrs-core.git
cd openmrs-core
mvn package
git clone https://github.com/nopSolutions/nopCommerce.git

# dotnet-sdk 6.0
dotnet build <path to sln>

Free Plan – How to enable free minutes

  • Lot of crypto currency miners have started using free Azure devops pipelines to mine bitcoin
  • No one gets free minutes until a form is filled and approved by microsoft.

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

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

Please turn AdBlock off
Animated Social Media Icons by Acurax Wordpress Development Company

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