2019-01-05 19:11:29 +00:00
|
|
|
parameters:
|
|
|
|
Image: ''
|
|
|
|
Tag: ''
|
|
|
|
ContainerCommand: ''
|
|
|
|
|
|
|
|
steps:
|
2019-03-10 10:42:53 +00:00
|
|
|
# 'envVars' in the 'Docker@1' task is a bit funky. When you want to use a
|
|
|
|
# variable, you have to quote it. But the quote is also sent directly to
|
|
|
|
# Docker and ends up in the variable, which you don't want. To work around
|
|
|
|
# this, we set the correct variable first (which becomes an env-variable), and
|
|
|
|
# pass that env-variable through to Docker. We cannot use the normal
|
|
|
|
# 'variables' entry, as we are a template. So that results in this bit of
|
|
|
|
# Bash code. Not because it is pretty, but it is the only way we found that
|
|
|
|
# works.
|
|
|
|
- bash: |
|
|
|
|
echo "##vso[task.setvariable variable=TARGET_BRANCH]${SYSTEM_PULLREQUEST_TARGETBRANCH}"
|
|
|
|
echo "Target branch is ${SYSTEM_PULLREQUEST_TARGETBRANCH}"
|
|
|
|
displayName: "Set target branch"
|
|
|
|
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
|
|
|
|
|
2019-01-05 19:11:29 +00:00
|
|
|
- task: Docker@1
|
|
|
|
${{ if eq(parameters.Image, 'compile-farm') }}:
|
|
|
|
displayName: 'Build'
|
|
|
|
${{ if eq(parameters.Image, 'compile-farm-ci') }}:
|
|
|
|
displayName: 'Build and test'
|
2019-03-10 14:09:57 +00:00
|
|
|
# Run the commit-checker only if it is a Pull Request
|
2019-05-02 20:17:09 +00:00
|
|
|
condition: and(succeeded(), or(not(contains(variables['Agent.JobName'], 'commit-checker')), eq(variables['Build.Reason'], 'PullRequest')))
|
2019-01-05 19:11:29 +00:00
|
|
|
inputs:
|
|
|
|
command: 'Run an image'
|
|
|
|
imageName: openttd/${{ parameters.Image }}:${{ parameters.Tag }}
|
|
|
|
volumes: '$(Build.SourcesDirectory):$(Build.SourcesDirectory)'
|
|
|
|
workingDirectory: '$(Build.SourcesDirectory)'
|
|
|
|
containerCommand: ${{ parameters.ContainerCommand }}
|
|
|
|
runInBackground: false
|
2019-03-10 10:42:53 +00:00
|
|
|
envVars: |
|
|
|
|
TARGET_BRANCH
|