AI Features

Change Pipeline Variable at Run Time

Learn how to allow users to change the values of the pipeline variables before running the pipeline.

Instead of hard-coding the priority value in the Maven goals, we use the $(Priority) variable:

- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'clean test -Dgroups=$(Priority)' <--------------------

But if we want to run the tests that belong to the Medium group instead of High, we have to change the Priority pipeline ...

Ask