From ca31109c687ffb508e614d9aff35c4c2b288bc61 Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Wed, 4 Sep 2024 22:36:08 +0200 Subject: [PATCH] Update pipeline to run SonarCloud tasks when succeeded() and not a PR from a fork --- .azuredevops/Pipelines/Templates/prepare-code-analysis.yaml | 2 +- .azuredevops/Pipelines/Templates/publish-code-analysis.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.azuredevops/Pipelines/Templates/prepare-code-analysis.yaml b/.azuredevops/Pipelines/Templates/prepare-code-analysis.yaml index d261d5c4..96cd25f3 100644 --- a/.azuredevops/Pipelines/Templates/prepare-code-analysis.yaml +++ b/.azuredevops/Pipelines/Templates/prepare-code-analysis.yaml @@ -10,5 +10,5 @@ steps: extraProperties: | sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/**/*.trx sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/**/*.opencover.xml - condition: or( ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.PullRequest.IsFork'], 'false') ) + condition: and(succeeded(), or( ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.PullRequest.IsFork'], 'false') )) \ No newline at end of file diff --git a/.azuredevops/Pipelines/Templates/publish-code-analysis.yaml b/.azuredevops/Pipelines/Templates/publish-code-analysis.yaml index 8e6deaa0..2214df77 100644 --- a/.azuredevops/Pipelines/Templates/publish-code-analysis.yaml +++ b/.azuredevops/Pipelines/Templates/publish-code-analysis.yaml @@ -2,11 +2,11 @@ steps: - task: SonarCloudAnalyze@2 displayName: ⚙️ Run Code Analysis - condition: or( ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.PullRequest.IsFork'], 'false') ) + condition: and(succeeded(), or( ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.PullRequest.IsFork'], 'false') )) - task: SonarCloudPublish@2 displayName: 📢 Publish Quality Gate Result - condition: or( ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.PullRequest.IsFork'], 'false') ) + condition: and(succeeded(), or( ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.PullRequest.IsFork'], 'false') )) - pwsh: | dotnet tool install --tool-path . dotnet-reportgenerator-globaltool