Skip to content

Commit

Permalink
Attempt to get release stage to Work
Browse files Browse the repository at this point in the history
More guesses at fixing test result publishing

Add pool to releast job

Update release conditions

Try a different method of skpping releases

Fix bad powershell script

Change release check method to avoid checking out code

Work done for #196
  • Loading branch information
atruskie committed Apr 5, 2020
1 parent bd65209 commit 4b8bd72
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 22 deletions.
42 changes: 29 additions & 13 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,37 +35,53 @@ stages:
- template: build/azure-pipelines-build.yml
- stage: release
jobs:
# this is really all quite ridiculous, but $(Build.SourceVersionMessage)
# is not defined until the step stage so, and only if source is checked out *sigh*
- job:
displayName: Check if a release is needed
pool:
vmImage: ubuntu-latest
steps:
- checkout: none
- pwsh: |
$commit = Invoke-RestMethod -Method Get -Uri "https://api.github.com/repos/$(Build.Repository.Name)/commits/$(Build.SourceVersion)" -Headers @{Authorization="token ${env:AU
DIO_ANALYSIS_CI}"}
$commit_message = $commit.commit.message
Write-Output "Analyzing commit message for [release] tag:`n$commit_message"
$is_manual_release = $commit_message -ilike '*\[release\]*'
$is_weekly_release = '$(Build.Reason)' -ieq 'Schedule'
$should_release = $is_weekly_release -or $is_manual_release
Write-Output "##vso[task.setvariable variable=isManualRelease;isOutput=true]$is_manual_release"
Write-Output "##vso[task.setvariable variable=isWeeklyRelease;isOutput=true]$is_weekly_release"
Write-Output "##vso[task.setvariable variable=shouldRelease;isOutput=true]$should_release"
env:
AUDIO_ANALYSIS_CI: $(AUDIO_ANALYSIS_CI)
- job:
displayName: Release
variables:
manualRelease: $( contains(variables['Build.SourceVersionMessage'], '[release]')
weeklyRelease: $( eq(variables['Build.Reason'],'Schedule'))
condition: eq(variables['shouldRelease'], 'true')
pool:
vmImage: ubuntu-latest
steps:
- pwsh: Write-Host "##vso[task.complete result=Canceled;]Skipping release"
# cancel the job, if
# it is not a weekly release
# and
# it is not a manual release
condition: and(ne(weeklyRelease, true), ne(manualRelease, true))
displayName: Cancel the release unless we want it to continue

- checkout: self
clean: true
fetchDepth: 200
lfs: false
persistCredentials: true
displayName: "Shallow cloning repo"

# downloads to $(System.ArtifactsDirectory)
# downloads to $(System.ArtifactsDirectory)
- task: DownloadBuildArtifacts@0
inputs:
buildType: current
downloadType: all
# avoid downloading cod coverage report
itemPattern: '**/*.(xz|zip|txt)'
displayName: Download previous build artefacts

# every build produced version vars, just pick the one from any
- pwsh: |
Get-ChildItem -recurse $(System.ArtifactsDirectory)
Get-Content $(System.ArtifactsDirectory)/AP_version_vars.txt | Write-Output
Get-Content $(System.ArtifactsDirectory)/any/AP_version_vars.txt | Write-Output
displayName: Reconstitute variables
- pwsh: ./build/release_notes.ps1 v$(AP_Version) -update_changelog
Expand Down
12 changes: 4 additions & 8 deletions build/azure-pipelines-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:

- pwsh: |
$sdkVersion = (Get-Content "global.json" | ConvertFrom-Json).sdk.version
echo "##vso[task.setvariable variable=sdkVersion]$sdkVersion"
Write-Output "##vso[task.setvariable variable=sdkVersion]$sdkVersion"
displayName: Get .NET SDK version from "global.json"
# the following steps were adapted form this guide:
Expand All @@ -118,7 +118,7 @@ jobs:
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/AP_version_vars.txt'
artifactName: AP_$(platformTag)$(configurationTag)
artifactName: $(platformTag)$(configurationTag)

- task: DotNetCoreCLI@2
inputs:
Expand All @@ -141,13 +141,9 @@ jobs:
RunConfiguration.DisableAppDomain=true
displayName: Run Acoustics.Test
- pwsh: |
GetChild-Item -Recursive $(Agent.TempDirectory)/Acoustics.Test_Results
Get-Content $(Agent.TempDirectory)/Acoustics.Test_Results/*.trx
- task: PublishTestResults@2
inputs:
testResultFormat: VSTest
testResultsFormat: VSTest
testResultsFiles: '**/*.trx'
searchFolder: $(Agent.TempDirectory)/Acoustics.Test_Results
testRunTitle: "Acoustics.Test for ${{ platform.rid }} ${{ configuration }}"
Expand Down Expand Up @@ -179,7 +175,7 @@ jobs:
testResultsFiles: '**/*.trx'
searchFolder: $(Agent.TempDirectory)/AED.Test_Results
testRunTitle: ".Test for ${{ platform.rid }} ${{ configuration }}"
buildConfig: ${{ configuration }}
buildConfiguration: ${{ configuration }}
buildPlatform: $(platformTag)
publishRunAttachments: true
condition: succeededOrFailed()
Expand Down
2 changes: 1 addition & 1 deletion src/git_version.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $self_contained = if ($self_contained -eq 'true') { 'true' } else { 'false' }

$commit_hash = git show -s --format="%H"

$branch = git symbolic-ref --short -q HEAD
$branch = ((git log -n 1 --pretty=%d HEAD) | Select-String ", ([^,]*)\)").Matches[0].Groups[1].Value

$describe = git describe --dirty --abbrev --long --always

Expand Down

0 comments on commit 4b8bd72

Please sign in to comment.