From 119f7dd1538f919faa373b964cfba22ae7117a75 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Thu, 1 Apr 2021 19:28:03 -0400 Subject: [PATCH] [CI] Fwd labels and ensure dotnet tests are run when targeting main. (#11068) * [CI] Fwd labels and ensure dotnet tests are run when targeting main. * Add 'run-dotnet-tests' to the tags to make manuel happy. --- tools/devops/automation/templates/build/build.yml | 2 -- .../automation/templates/build/configure.yml | 14 ++++++++++++++ tools/devops/automation/templates/build/stage.yml | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/devops/automation/templates/build/build.yml b/tools/devops/automation/templates/build/build.yml index c92b76e3ef..03de5e42cc 100644 --- a/tools/devops/automation/templates/build/build.yml +++ b/tools/devops/automation/templates/build/build.yml @@ -594,8 +594,6 @@ steps: timeoutInMinutes: 600 enabled: ${{ parameters.runTests }} env: - ${{ if eq(variables['Build.SourceBranchName'], 'main') }}: # only works if you have a main branch - XHARNESS_LABELS: 'run-dotnet-tests' IsPR: $(configuration.IsPR) GITHUB_TOKEN: $(GitHub.Token) # used to filter the tests to be ran BUILD_REVISION: jenkins diff --git a/tools/devops/automation/templates/build/configure.yml b/tools/devops/automation/templates/build/configure.yml index 600f0df57f..90f75c4bbc 100644 --- a/tools/devops/automation/templates/build/configure.yml +++ b/tools/devops/automation/templates/build/configure.yml @@ -45,6 +45,20 @@ steps: $ref = $prInfo.base.ref $tags.Add("$ref") + # decide if we add the run-dotnet-tests label (if not present) this is done only for main + # we can use $ref for that :) + $xharnessLabels = $prInfo.labels -join "," + if ($ref -eq "main" -and -not ("run-dotnet-tests" -in $xharnessLabels)) { + $tags.Add("run-dotnet-tests") + if ($xharnessLabels -eq "") { + $xharnessLabels = "run-dotnet-tests" + } else { + $xharnessLabels = @($xharnessLabels, "run-dotnet-tests") -join "," + } + } + + Write-Host "##vso[task.setvariable variable=xharness-labels;isOutput=true]$xharnessLabels" + # set output variables based on the git labels $labelsOfInterest = @( "build-package", diff --git a/tools/devops/automation/templates/build/stage.yml b/tools/devops/automation/templates/build/stage.yml index 9487f252fe..c9ef7afbd1 100644 --- a/tools/devops/automation/templates/build/stage.yml +++ b/tools/devops/automation/templates/build/stage.yml @@ -74,6 +74,7 @@ jobs: SkipApiComparison: $[ dependencies.configure.outputs['labels.skip-api-comparison'] ] # set the branch variable name, this is required by jenkins and we have a lot of scripts that depend on it BRANCH_NAME: $(Build.SourceBranchName) + XHARNESS_LABELS: $[ dependencies.configure.outputs['labels.xharness-labels'] ] pool: name: $(AgentPoolComputed) demands: