Azure Devops
Self hosted agents
- Configuring selfhosted agent on linux
- Once agent is online it shows in the Agent Pool
- azure-pipelines
---
pool: default
trigger:
- master
jobs:
- job: Preparation_job
displayName: install softwares
steps:
- task: DotNetCoreInstaller@1
inputs:
packageType: 'sdk'
version: 6.x
- job: Build_Job
displayName: Build dotnet project
dependsOn: Preparation_job
condition: succeeded()
steps:
- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: src/dotnet-demoapp.csproj
- job: Test_Job
displayName: Test dotnet
dependsOn: Build_Job
condition: succeeded()
steps:
- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: tests/tests.csproj
Variables in Azure Pipelines
- Refer Here for official docs
- Azure DevOps Pipelines allows us to
- create our custom variables
- use predefined variables Refer Here
- We can use predefined variables according to the needs in the pipeline, some examplse copy the builds to the shared folder/s3/azure storage account
---
pool:
name: "Azure Pipelines"
vmImage: 'ubuntu-latest'
trigger:
- main
steps:
- task: Bash@3
inputs:
targetType: inline
script: echo "Build Directory is $(Agent.BuildDirectory)"
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
goals: 'package'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
jdkVersionOption: '1.17'
- Creating user-defined variables Refer Here
- Parameters are the inputs that can be passed during build triggers
---
pool:
name: "Azure Pipelines"
vmImage: 'ubuntu-latest'
trigger:
- main
parameters:
- name: goal
displayName: Maven Goal
type: string
default: package
values:
- clean
- package
- test
- compile
- install
- deploy
variables:
- name: checking
value: nothing
steps:
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
goals: ${{ parameters.goal }}
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
jdkVersionOption: '1.17'