azuredevopslabs icon indicating copy to clipboard operation
azuredevopslabs copied to clipboard

How to pick directory Paths based on Build Agent Name in AzureDevops task

Open vivuu1989 opened this issue 2 years ago • 2 comments

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'

vivuu1989 avatar Sep 24 '23 13:09 vivuu1989

Any method to achieve this using AzureDevops pipeline?

vivuu1989 avatar Sep 27 '23 09:09 vivuu1989

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.

surajshenoy avatar Oct 30 '23 12:10 surajshenoy