Azure Pipeline (YAML)
Azure Pipelines Representation
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
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'
---
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'
---
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
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
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.