I am trying to change my yaml file to add some more tasks. This is my current yaml file:
trigger:
- master
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
# according to: https://github.com/MicrosoftDocs/vsts-docs/issues/3845,
# maven options should go to goals instead, as mavenOptions is for jvm options
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'verify -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true --batch-mode --show-version'
I want to run one goal only if the branch that runs is master. Basically with my tests, I create a dockerfile and I want to push it to dockerhub, but I don't want that to happen every time someone opens a pull request; I want that to happen only if master is running the tests. Something like this
if branch == master
steps: *
but I don't seem to find anything in the Azure Pipelines documentation on how to do this