mirror of https://github.com/OpenTTD/OpenTTD
Fix: [AzurePipelines] Run commit checker only for PRs and pass it the target branch (#7356)
parent
383e2d1082
commit
f7f1efc84f
|
@ -6,5 +6,5 @@ steps:
|
||||||
git config user.email 'info@openttd.org'
|
git config user.email 'info@openttd.org'
|
||||||
git config user.name 'OpenTTD CI'
|
git config user.name 'OpenTTD CI'
|
||||||
git rebase origin/${SYSTEM_PULLREQUEST_TARGETBRANCH}
|
git rebase origin/${SYSTEM_PULLREQUEST_TARGETBRANCH}
|
||||||
displayName: 'Rebase to $(System.PullRequest.TargetBranch)'
|
displayName: 'Rebase to target branch'
|
||||||
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
|
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
|
||||||
|
|
|
@ -4,11 +4,27 @@ parameters:
|
||||||
ContainerCommand: ''
|
ContainerCommand: ''
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
# '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'))
|
||||||
|
|
||||||
- task: Docker@1
|
- task: Docker@1
|
||||||
${{ if eq(parameters.Image, 'compile-farm') }}:
|
${{ if eq(parameters.Image, 'compile-farm') }}:
|
||||||
displayName: 'Build'
|
displayName: 'Build'
|
||||||
${{ if eq(parameters.Image, 'compile-farm-ci') }}:
|
${{ if eq(parameters.Image, 'compile-farm-ci') }}:
|
||||||
displayName: 'Build and test'
|
displayName: 'Build and test'
|
||||||
|
${{ if eq(parameters.Tag, 'commit-checker') }}:
|
||||||
|
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
|
||||||
inputs:
|
inputs:
|
||||||
command: 'Run an image'
|
command: 'Run an image'
|
||||||
imageName: openttd/${{ parameters.Image }}:${{ parameters.Tag }}
|
imageName: openttd/${{ parameters.Image }}:${{ parameters.Tag }}
|
||||||
|
@ -16,3 +32,5 @@ steps:
|
||||||
workingDirectory: '$(Build.SourcesDirectory)'
|
workingDirectory: '$(Build.SourcesDirectory)'
|
||||||
containerCommand: ${{ parameters.ContainerCommand }}
|
containerCommand: ${{ parameters.ContainerCommand }}
|
||||||
runInBackground: false
|
runInBackground: false
|
||||||
|
envVars: |
|
||||||
|
TARGET_BRANCH
|
||||||
|
|
Loading…
Reference in New Issue