Skip to content

Commit

Permalink
Execute go mod tidy for perf tests when using live azcore (#21471)
Browse files Browse the repository at this point in the history
* Execute go mod tidy for perf tests when using live azcore

This ensures that any updated dependencies are propagated.

* set default value and fix devops syntax

* runtime expression

* switch param to string

* stricter check, fixed some logging

* debugging

* fix syntax

* define task var, clean up lint

* fix syntax

* define default from a runtime expression

* syntax

* more syntax

* switch back to bool, remove debug logging
  • Loading branch information
jhendrixMSFT authored Sep 1, 2023
1 parent cc212a8 commit ee7c3a2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion eng/pipelines/templates/jobs/archetype-go-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ stages:
- template: /eng/pipelines/templates/variables/globals.yml
displayName: 'Check Release: ${{ parameters.ServiceDirectory }}'
dependsOn: ${{ parameters.DependsOn }}
condition: and(succeeded(), ne(variables['SetDevVersion'], 'true'), ne(variables['Skip.Release'], 'true'), ne(variables['Build.Repository.Name'], 'Azure/azure-sdk-for-go-pr'), ne(variables['Use.AzcoreFromMain'], 'true'))
condition: and(succeeded(), ne(variables['SetDevVersion'], 'true'), ne(variables['Skip.Release'], 'true'), ne(variables['Build.Repository.Name'], 'Azure/azure-sdk-for-go-pr'), ne(variables.UseAzcoreFromMain, 'true'))
jobs:
- job: CheckReleaseJob
displayName: "Check whether need to release"
Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/templates/steps/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ parameters:
steps:
- task: Powershell@2
displayName: Use azcore from main
condition: eq(variables['Use.AzcoreFromMain'], 'true')
condition: eq(variables.UseAzcoreFromMain, 'true')
env:
GO111MODULE: 'on'
inputs:
Expand Down Expand Up @@ -86,7 +86,7 @@ steps:
inputs:
targetType: 'filePath'
filePath: ./eng/scripts/Build_Perf.ps1
arguments: '${{ parameters.ServiceDirectory }}'
arguments: '${{ parameters.ServiceDirectory }} $$(UseAzcoreFromMain)'
pwsh: true

- ${{ if eq(parameters.TestProxy, true) }}:
Expand Down
3 changes: 3 additions & 0 deletions eng/pipelines/templates/variables/globals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ variables:

# Disable CodeQL injections except for where we specifically enable it
Codeql.SkipTaskAutoInjection: true

# Set the default value so that 'Build Performance Tests' step can resolve it
UseAzcoreFromMain: $[eq(variables['Use.AzcoreFromMain'], 'true')]
14 changes: 12 additions & 2 deletions eng/scripts/Build_Perf.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#Requires -Version 7.0

Param(
[string] $serviceDirectory
[string] $serviceDirectory,
[bool] $useAzcoreFromMain
)

Push-Location sdk/$serviceDirectory
Expand All @@ -10,7 +11,7 @@ Push-Location sdk/$serviceDirectory
$perfDirectories = Get-ChildItem -Path . -Filter testdata -Recurse

if ($perfDirectories.Length -eq 0) {
Write-Host "Did not find any performance tests in the directory $(pwd)"
Write-Host "##[command] Did not find any performance tests in the directory $(Get-Location)"
exit 0
}

Expand All @@ -23,6 +24,15 @@ foreach ($perfDir in $perfDirectories) {
Push-Location perf
Write-Host "##[command] Building and vetting performance tests in $perfDir/perf"

if ($useAzcoreFromMain) {
# using a live azcore might be dragging in updated dependencies
Write-Host "##[command] Executing 'go mod tidy' in $perfDir/perf"
go mod tidy
if ($LASTEXITCODE) {
$failed = $true
}
}

Write-Host "##[command] Executing 'go build .' in $perfDir/perf"
go build .
if ($LASTEXITCODE) {
Expand Down

0 comments on commit ee7c3a2

Please sign in to comment.