azuredevopslabs
azuredevopslabs copied to clipboard
How to pick directory Paths based on Build Agent Name in AzureDevops task
We have a requirement in Azuredevops task to pick the Tasks filesystem path (gradleHome), based on the agent.name as we have different kind of agents in the same pool.
I tried, below solution, but didn't work. It's not picking the gradleHome Pathas per the agent picked.
- task: Gradle@2
displayName: 'Clean Project'
inputs:
workingDirectory: 'xxxx'
gradleWrapperFile: '$(System.DefaultWorkingDirectory)/gradlew'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
${{ if startsWith(variables['Agent.Name'], 'mypool1')}}:
tasks: 'clean <Commands> -Dgradle.user.home=/opt/gradle-8.0.2'
${{ if notIn(variables['Agent.Name'], 'azdevops-android-scaledjob')}}:
tasks: 'clean <Commands> -Dgradle.user.home=/data/gradle'
Any method to achieve this using AzureDevops pipeline?
Hi @vivuu1989, this forum is available to discuss the concerns regarding Azuredevopslabs site and the content. Seems like your concern is not related to any of the labs. Please try finding the solution in the relevant forum.