Azure DevOps Contd
Building Java Project in Azure DevOps using Self Hosted Agent
- Azure Pipeline yaml schema Refer Here
- Task in Azure DevOps Pipelines: Tasks internally get converted in low level os commands/api calls.
- Azure DevOps has lot of predefined tasks Refer Here
- We can also get additional tasks from Market Refer Here
- Lets acheive building the code without using any task.
- Manual command is
mvn package
- The pipeline is
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
pool:
name: Default
steps:
- bash: mvn package
-
Push the changes and build should start (trigger)
-
Lets try using tasks for maven Refer Here
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
pool:
name: Default
steps:
- task: Maven@3
inputs:
mavenPOMFile: 'pom.xml'
goals: 'package'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
testRunTitle: 'unittests'
- Now push the changes and wait for pipeline getting executed
Build pipeline for dotnet projectt
- Manual steps:
- Install .net 7
- clone nop commerce and checkout to master branch
- commands
yaml
git checkout master
dotnet restore src/NopCommerce.sln
dotnet build src/NopCommerce.sln
- Find tasks to perform restore and build and fill with the values required to build this project google
azure devops task list
- The pipeline will be approximately equavalent to
---
trigger:
- master
pool:
name: Default
steps:
- task: DotNetCoreCLI@2
inputs:
command: restore
projects: src/NopCommerce.sln
- task: DotNetCoreCLI@2
inputs:
command: build
projects: src/NopCommerce.sln