Skip to content

Commit

Permalink
Dynamically determine build number depending on PR or not (#400)
Browse files Browse the repository at this point in the history
Dynamically determine build number depending on PR or not.

Relates to #398
  • Loading branch information
tomkerkhove authored Mar 13, 2019
1 parent fe53945 commit 3e821c7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .azure-devops/scraper-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: PR$(System.PullRequest.PullRequestNumber)$(Rev:-rr)
name: $(Date:yyyyMMdd)$(Rev:.r)
resources:
- repo: self
trigger:
- master
variables:
Image.TaggedName: 'tomkerkhove/promitor-agent-scraper-ci:$(Build.BuildNumber)'
jobs:
Expand Down Expand Up @@ -28,6 +30,16 @@ jobs:
pool:
vmImage: ubuntu-16.04
steps:
- powershell: |
$prNumber = '$(System.PullRequest.PullRequestNumber)'
$buildNumber = '$(Build.BuildNumber)'
Write-Host "Initial build number: '$buildNumber'"
Write-Host "PR Number '$prNumber'"
$buildNumber = 'PR$(System.PullRequest.PullRequestNumber)'
Write-Host "##vso[build.updatebuildnumber]$buildNumber"
Write-Host "Build number is '$buildNumber'"
displayName: 'Change Build Number to PR format'
condition: eq(variables['Build.Reason'], 'PullRequest')
- task: Docker@1
displayName: 'Build an image'
inputs:
Expand Down Expand Up @@ -61,5 +73,6 @@ jobs:
dockerRegistryEndpoint: 'Docker Hub'
command: 'Push an image'
imageName: '$(Image.TaggedName)'
condition: eq(variables['Build.Reason'], 'PullRequest')


0 comments on commit 3e821c7

Please sign in to comment.