Skip to content

fix: should run step no longer needs PAT token#516

Merged
adrianignat13 merged 14 commits intodevelopfrom
fix/cryptography_build_pipeline
Mar 2, 2026
Merged

fix: should run step no longer needs PAT token#516
adrianignat13 merged 14 commits intodevelopfrom
fix/cryptography_build_pipeline

Conversation

@adrianignat13
Copy link
Member

Replacement for the GitHub API label check.
It always sets BuildShouldRun=true because path-based triggers already ensure the pipeline only runs on relevant changes. No GithubAuthToken needed.

eplacement for the GitHub API label check.
It always sets BuildShouldRun=true because path-based triggers
already ensure the pipeline only runs on relevant changes.
No GithubAuthToken needed.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Cryptography Azure DevOps pipeline to remove the “should run” GitHub label/API check (and associated PAT requirement) by switching to local templates and relying on existing path-based triggers.

Changes:

  • Switch Activities/Cryptography/azure-pipelines.yml to use a new local stage.start.yml template instead of @common.
  • Add local pipeline templates (stage.start.yml, stage.shouldrun.yml) implementing a token-free “should run” flow.
  • Update .gitignore to ignore several local/agent workspace folders.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

File Description
Activities/Cryptography/azure-pipelines.yml Uses local stage template and adds a pre-test .NET 6 SDK install step.
Activities/.pipelines/templates/stage.start.yml New local stage template that wires build/test/sonar stages and a local should-run job.
Activities/.pipelines/templates/stage.shouldrun.yml New local should-run job that always sets BuildShouldRun=true without GitHub API access.
.gitignore Ignores additional local/agent working directories.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +71 to +74
preTestRun:
- ${{ parameters.preTestRun }}
postTestRun:
- ${{ parameters.postTestRun }}
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preTestRun/postTestRun are also passed as a nested list (`preTestRun:

  • ${{ parameters.preTestRun }}), which will break stepList expansion in the downstream test template. Pass the list directly (or expand with each`) so the final YAML contains a flat sequence of steps.

Copilot uses AI. Check for mistakes.
Comment on lines +85 to +86
variables:
RunAnalysis: 'false'
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PublishSonar stage condition depends on variables['RunAnalysis'] == 'true', but this stage defines RunAnalysis: 'false' locally and there is no code in this template that can flip it to true before the stage condition is evaluated. As written, PublishSonar will never run; either remove this stage, or source RunAnalysis from a pipeline/global variable (don’t override it at stage scope), or base the condition on an output variable from an earlier stage/job.

Suggested change
variables:
RunAnalysis: 'false'

Copilot uses AI. Check for mistakes.
Comment on lines +37 to +42
# Local should-run check — no GitHub API token needed
- template: stage.shouldrun.yml
parameters:
projectName: ${{ parameters.projectName }}
tagName: ${{ parameters.tagName }}

Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DetermineShouldRun currently always sets $shouldRun = $true, so the extra job and the BuildShouldRun-based conditions don’t provide any functional gating but do add time/complexity to every run. If the intent is to always run (as the PR description states), consider removing the should-run job and simplifying the Test/PublishSonar conditions accordingly.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +4
parameters:
projectName: ''
tagName: ''

Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

projectName and tagName parameters are declared but not used anywhere in this template. Consider removing them (or using them in log output) to avoid implying they affect behavior.

Copilot uses AI. Check for mistakes.
Comment on lines +56 to +59
preBuild:
- ${{ parameters.preBuild }}
postBuild:
- ${{ parameters.postBuild }}
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preBuild/postBuild are being passed as a nested list (`preBuild:

  • ${{ parameters.preBuild }}), which will produce an invalid stepList (or a list containing a list) when the child template expects a flat step list. Pass the stepList directly (or use an each` expansion) so the resulting YAML is a flat list of steps.

Copilot uses AI. Check for mistakes.
alexandru-petre and others added 8 commits March 1, 2026 17:34
The shared run template used a generic '*_windows*' glob to find the
test package, which could pick up Python test packages when both
pipelines share the same artifact store. Also removes a stale
StudioProjectPath variable hardcoded to the Database project.

- Add packageNameFilter parameter to stage.run.runtime.tests.windows.yml
  (defaults to '*_windows*' for backward compatibility)
- Set packageNameFilter to '*Cryptography*_windows*' in the Cryptography
  pipeline so it can never accidentally run Python runtime tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
  Root Cause

  The pipeline flow in the Build job is:
  1. "Cleanup .sonarqube folder" — deletes $(Pipeline.Workspace)/.sonarqube
  2. "Prepare analysis on SonarCloud" — skipped (condition: eq(variables['RunAnalysis'], 'true'), but RunAnalysis:
  'false')
  3. Build, package, publish steps...
  4. "Copy Sonar files to artifact staging directory" — checks if .sonarqube exists → fails with "The SonarQube
  directory does not exist!"

  The directory is cleaned up before the build but never recreated because Sonar preparation is skipped.

  Fix

  Added a postBuild step to azure-pipelines.yml that creates a placeholder .sonarqube directory when it doesn't exist.
  This runs after the build (where postBuild is injected by the common template) but before the "Copy Sonar files" step,
   ensuring that step no longer errors out.
Build and portable run jobs use fetchDepth=1 since they need source
files (project.json and docker-compose.yml respectively). Windows run
job uses checkout:none since it only downloads pipeline artifacts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Mirrors the fix already applied to Cryptography. The 'Copy Sonar files'
step in stage.build.yml@common always runs (condition: succeeded()) even
when RunAnalysis=false, causing a red error when the scanner env vars are
not set. The postBuild stub creates a placeholder .sonarqube dir and an
empty SonarScanner.MSBuild.exe so the step exits cleanly. The PublishSonar
stage remains gated by RunAnalysis=false and will not execute.

Applies to: Python, Java, Database, FTP, Credentials

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 10 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +71 to +75
preTestRun:
- ${{ parameters.preTestRun }}
postTestRun:
- ${{ parameters.postTestRun }}
- ${{ parameters.additionalTestJobs }}
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same nested-list issue for preTestRun/postTestRun: using - ${{ parameters.preTestRun }} wraps the step list in another list item. Pass the stepList directly or expand it with an each loop so the test stage receives a flat steps array.

Copilot uses AI. Check for mistakes.
dependsOn:
- Build
- Test
- ${{ parameters.sonarDependsOn }}
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dependsOn is built with - ${{ parameters.sonarDependsOn }}, which can also create a nested list (list-of-lists) when sonarDependsOn contains multiple stages. Prefer expanding the list (e.g., each over sonarDependsOn) or passing it in a way that preserves a flat string list.

Suggested change
- ${{ parameters.sonarDependsOn }}
- ${{ each stage in parameters.sonarDependsOn }}:
- ${{ stage }}

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +33
# Each activity pipeline has path-based triggers that already guarantee
# it only runs when relevant files change. No GitHub API call needed.
$shouldRun = $true
if ($buildReason -eq 'Schedule') {
Write-Host "Scheduled build. Running."
} elseif ($buildReason -eq 'Manual') {
Write-Host "Manual build. Running."
} elseif ($buildReason -eq 'PullRequest') {
Write-Host "PR build. Path triggers already filtered to relevant changes. Running."
} else {
Write-Host "CI build on branch $branchRef. Running."
}
Write-Host "Setting BuildShouldRun to '$shouldRun'"
Write-Host "##vso[task.setvariable variable=BuildShouldRun;isOutput=true]$shouldRun"
displayName: "Determine build should run (path-trigger based)"
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$shouldRun is a PowerShell boolean ($true), which is emitted as True/False. Downstream conditions compare the output to the lowercase string 'true', which can cause the Test/Sonar stages to be skipped depending on expression evaluation. Set the output explicitly to the lowercase string 'true'/'false', or normalize casing in the condition (e.g., with toLower()).

Copilot uses AI. Check for mistakes.
Comment on lines +54 to +76
- powershell: |
Write-Host "##[section]STUB: Sonar analysis is disabled (RunAnalysis=false)"
Write-Host "##[warning]The following stubs are created only to satisfy the 'Copy Sonar files'"
Write-Host "##[warning]step in stage.build.yml@common, which always runs (condition: succeeded())."
Write-Host "##[warning]These stubs have no effect on analysis — the PublishSonar stage is"
Write-Host "##[warning]gated by RunAnalysis=false and will not run."

$sonarDir = Join-Path "$(Pipeline.Workspace)" ".sonarqube"
if (-not (Test-Path $sonarDir)) {
New-Item -ItemType Directory -Path $sonarDir | Out-Null
Write-Host "##[warning]STUB: Created placeholder .sonarqube dir at $sonarDir"
}

$scannerDir = Join-Path $sonarDir "bin"
New-Item -ItemType Directory -Path $scannerDir -Force | Out-Null
$stubExe = Join-Path $scannerDir "SonarScanner.MSBuild.exe"
if (-not (Test-Path $stubExe)) {
New-Item -ItemType File -Path $stubExe -Force | Out-Null
}
Write-Host "##vso[task.setvariable variable=SONARQUBE_SCANNER_MSBUILD_EXE]$stubExe"
Write-Host "##[warning]STUB: Created empty SonarScanner.MSBuild.exe at $stubExe"
Write-Host "##[section]STUB setup complete — 'Copy Sonar files' step will now succeed silently"
displayName: 'STUB - Create Sonar placeholders (RunAnalysis=false)'
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Sonar placeholder PowerShell block is duplicated across multiple activity pipelines. To reduce drift and make future updates safer, consider moving this into a shared template (e.g., Activities/.pipelines/steps/sonar.stub.yml) and referencing it from each pipeline (or wiring it into the local stage.start.yml default postBuild).

Suggested change
- powershell: |
Write-Host "##[section]STUB: Sonar analysis is disabled (RunAnalysis=false)"
Write-Host "##[warning]The following stubs are created only to satisfy the 'Copy Sonar files'"
Write-Host "##[warning]step in stage.build.yml@common, which always runs (condition: succeeded())."
Write-Host "##[warning]These stubs have no effect on analysis — the PublishSonar stage is"
Write-Host "##[warning]gated by RunAnalysis=false and will not run."
$sonarDir = Join-Path "$(Pipeline.Workspace)" ".sonarqube"
if (-not (Test-Path $sonarDir)) {
New-Item -ItemType Directory -Path $sonarDir | Out-Null
Write-Host "##[warning]STUB: Created placeholder .sonarqube dir at $sonarDir"
}
$scannerDir = Join-Path $sonarDir "bin"
New-Item -ItemType Directory -Path $scannerDir -Force | Out-Null
$stubExe = Join-Path $scannerDir "SonarScanner.MSBuild.exe"
if (-not (Test-Path $stubExe)) {
New-Item -ItemType File -Path $stubExe -Force | Out-Null
}
Write-Host "##vso[task.setvariable variable=SONARQUBE_SCANNER_MSBUILD_EXE]$stubExe"
Write-Host "##[warning]STUB: Created empty SonarScanner.MSBuild.exe at $stubExe"
Write-Host "##[section]STUB setup complete — 'Copy Sonar files' step will now succeed silently"
displayName: 'STUB - Create Sonar placeholders (RunAnalysis=false)'
- template: ..\.pipelines\steps\sonar.stub.yml

Copilot uses AI. Check for mistakes.
Comment on lines +66 to +88
- powershell: |
Write-Host "##[section]STUB: Sonar analysis is disabled (RunAnalysis=false)"
Write-Host "##[warning]The following stubs are created only to satisfy the 'Copy Sonar files'"
Write-Host "##[warning]step in stage.build.yml@common, which always runs (condition: succeeded())."
Write-Host "##[warning]These stubs have no effect on analysis — the PublishSonar stage is"
Write-Host "##[warning]gated by RunAnalysis=false and will not run."
$sonarDir = Join-Path "$(Pipeline.Workspace)" ".sonarqube"
if (-not (Test-Path $sonarDir)) {
New-Item -ItemType Directory -Path $sonarDir | Out-Null
Write-Host "##[warning]STUB: Created placeholder .sonarqube dir at $sonarDir"
}
$scannerDir = Join-Path $sonarDir "bin"
New-Item -ItemType Directory -Path $scannerDir -Force | Out-Null
$stubExe = Join-Path $scannerDir "SonarScanner.MSBuild.exe"
if (-not (Test-Path $stubExe)) {
New-Item -ItemType File -Path $stubExe -Force | Out-Null
}
Write-Host "##vso[task.setvariable variable=SONARQUBE_SCANNER_MSBUILD_EXE]$stubExe"
Write-Host "##[warning]STUB: Created empty SonarScanner.MSBuild.exe at $stubExe"
Write-Host "##[section]STUB setup complete — 'Copy Sonar files' step will now succeed silently"
displayName: 'STUB - Create Sonar placeholders (RunAnalysis=false)'
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Sonar placeholder PowerShell block is duplicated across multiple activity pipelines. To reduce drift and make future updates safer, consider moving this into a shared template (e.g., Activities/.pipelines/steps/sonar.stub.yml) and referencing it from each pipeline (or wiring it into the local stage.start.yml default postBuild).

Suggested change
- powershell: |
Write-Host "##[section]STUB: Sonar analysis is disabled (RunAnalysis=false)"
Write-Host "##[warning]The following stubs are created only to satisfy the 'Copy Sonar files'"
Write-Host "##[warning]step in stage.build.yml@common, which always runs (condition: succeeded())."
Write-Host "##[warning]These stubs have no effect on analysis — the PublishSonar stage is"
Write-Host "##[warning]gated by RunAnalysis=false and will not run."
$sonarDir = Join-Path "$(Pipeline.Workspace)" ".sonarqube"
if (-not (Test-Path $sonarDir)) {
New-Item -ItemType Directory -Path $sonarDir | Out-Null
Write-Host "##[warning]STUB: Created placeholder .sonarqube dir at $sonarDir"
}
$scannerDir = Join-Path $sonarDir "bin"
New-Item -ItemType Directory -Path $scannerDir -Force | Out-Null
$stubExe = Join-Path $scannerDir "SonarScanner.MSBuild.exe"
if (-not (Test-Path $stubExe)) {
New-Item -ItemType File -Path $stubExe -Force | Out-Null
}
Write-Host "##vso[task.setvariable variable=SONARQUBE_SCANNER_MSBUILD_EXE]$stubExe"
Write-Host "##[warning]STUB: Created empty SonarScanner.MSBuild.exe at $stubExe"
Write-Host "##[section]STUB setup complete — 'Copy Sonar files' step will now succeed silently"
displayName: 'STUB - Create Sonar placeholders (RunAnalysis=false)'
- template: ..\.pipelines\steps\sonar.stub.yml

Copilot uses AI. Check for mistakes.
Comment on lines +59 to +81
- powershell: |
Write-Host "##[section]STUB: Sonar analysis is disabled (RunAnalysis=false)"
Write-Host "##[warning]The following stubs are created only to satisfy the 'Copy Sonar files'"
Write-Host "##[warning]step in stage.build.yml@common, which always runs (condition: succeeded())."
Write-Host "##[warning]These stubs have no effect on analysis — the PublishSonar stage is"
Write-Host "##[warning]gated by RunAnalysis=false and will not run."

$sonarDir = Join-Path "$(Pipeline.Workspace)" ".sonarqube"
if (-not (Test-Path $sonarDir)) {
New-Item -ItemType Directory -Path $sonarDir | Out-Null
Write-Host "##[warning]STUB: Created placeholder .sonarqube dir at $sonarDir"
}

$scannerDir = Join-Path $sonarDir "bin"
New-Item -ItemType Directory -Path $scannerDir -Force | Out-Null
$stubExe = Join-Path $scannerDir "SonarScanner.MSBuild.exe"
if (-not (Test-Path $stubExe)) {
New-Item -ItemType File -Path $stubExe -Force | Out-Null
}
Write-Host "##vso[task.setvariable variable=SONARQUBE_SCANNER_MSBUILD_EXE]$stubExe"
Write-Host "##[warning]STUB: Created empty SonarScanner.MSBuild.exe at $stubExe"
Write-Host "##[section]STUB setup complete — 'Copy Sonar files' step will now succeed silently"
displayName: 'STUB - Create Sonar placeholders (RunAnalysis=false)'
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Sonar placeholder PowerShell block is duplicated across multiple activity pipelines. To reduce drift and make future updates safer, consider moving this into a shared template (e.g., Activities/.pipelines/steps/sonar.stub.yml) and referencing it from each pipeline (or wiring it into the local stage.start.yml default postBuild).

Suggested change
- powershell: |
Write-Host "##[section]STUB: Sonar analysis is disabled (RunAnalysis=false)"
Write-Host "##[warning]The following stubs are created only to satisfy the 'Copy Sonar files'"
Write-Host "##[warning]step in stage.build.yml@common, which always runs (condition: succeeded())."
Write-Host "##[warning]These stubs have no effect on analysis — the PublishSonar stage is"
Write-Host "##[warning]gated by RunAnalysis=false and will not run."
$sonarDir = Join-Path "$(Pipeline.Workspace)" ".sonarqube"
if (-not (Test-Path $sonarDir)) {
New-Item -ItemType Directory -Path $sonarDir | Out-Null
Write-Host "##[warning]STUB: Created placeholder .sonarqube dir at $sonarDir"
}
$scannerDir = Join-Path $sonarDir "bin"
New-Item -ItemType Directory -Path $scannerDir -Force | Out-Null
$stubExe = Join-Path $scannerDir "SonarScanner.MSBuild.exe"
if (-not (Test-Path $stubExe)) {
New-Item -ItemType File -Path $stubExe -Force | Out-Null
}
Write-Host "##vso[task.setvariable variable=SONARQUBE_SCANNER_MSBUILD_EXE]$stubExe"
Write-Host "##[warning]STUB: Created empty SonarScanner.MSBuild.exe at $stubExe"
Write-Host "##[section]STUB setup complete — 'Copy Sonar files' step will now succeed silently"
displayName: 'STUB - Create Sonar placeholders (RunAnalysis=false)'
- template: ..\.pipelines\steps\sonar.stub.yml

Copilot uses AI. Check for mistakes.
Comment on lines +53 to +76
postBuild:
- powershell: |
Write-Host "##[section]STUB: Sonar analysis is disabled (RunAnalysis=false)"
Write-Host "##[warning]The following stubs are created only to satisfy the 'Copy Sonar files'"
Write-Host "##[warning]step in stage.build.yml@common, which always runs (condition: succeeded())."
Write-Host "##[warning]These stubs have no effect on analysis — the PublishSonar stage is"
Write-Host "##[warning]gated by RunAnalysis=false and will not run."
$sonarDir = Join-Path "$(Pipeline.Workspace)" ".sonarqube"
if (-not (Test-Path $sonarDir)) {
New-Item -ItemType Directory -Path $sonarDir | Out-Null
Write-Host "##[warning]STUB: Created placeholder .sonarqube dir at $sonarDir"
}
$scannerDir = Join-Path $sonarDir "bin"
New-Item -ItemType Directory -Path $scannerDir -Force | Out-Null
$stubExe = Join-Path $scannerDir "SonarScanner.MSBuild.exe"
if (-not (Test-Path $stubExe)) {
New-Item -ItemType File -Path $stubExe -Force | Out-Null
}
Write-Host "##vso[task.setvariable variable=SONARQUBE_SCANNER_MSBUILD_EXE]$stubExe"
Write-Host "##[warning]STUB: Created empty SonarScanner.MSBuild.exe at $stubExe"
Write-Host "##[section]STUB setup complete — 'Copy Sonar files' step will now succeed silently"
displayName: 'STUB - Create Sonar placeholders (RunAnalysis=false)'
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Sonar placeholder PowerShell block is duplicated across multiple activity pipelines. To reduce drift and make future updates safer, consider moving this into a shared template (e.g., Activities/.pipelines/steps/sonar.stub.yml) and referencing it from each pipeline (or wiring it into the local stage.start.yml default postBuild).

Suggested change
postBuild:
- powershell: |
Write-Host "##[section]STUB: Sonar analysis is disabled (RunAnalysis=false)"
Write-Host "##[warning]The following stubs are created only to satisfy the 'Copy Sonar files'"
Write-Host "##[warning]step in stage.build.yml@common, which always runs (condition: succeeded())."
Write-Host "##[warning]These stubs have no effect on analysis — the PublishSonar stage is"
Write-Host "##[warning]gated by RunAnalysis=false and will not run."
$sonarDir = Join-Path "$(Pipeline.Workspace)" ".sonarqube"
if (-not (Test-Path $sonarDir)) {
New-Item -ItemType Directory -Path $sonarDir | Out-Null
Write-Host "##[warning]STUB: Created placeholder .sonarqube dir at $sonarDir"
}
$scannerDir = Join-Path $sonarDir "bin"
New-Item -ItemType Directory -Path $scannerDir -Force | Out-Null
$stubExe = Join-Path $scannerDir "SonarScanner.MSBuild.exe"
if (-not (Test-Path $stubExe)) {
New-Item -ItemType File -Path $stubExe -Force | Out-Null
}
Write-Host "##vso[task.setvariable variable=SONARQUBE_SCANNER_MSBUILD_EXE]$stubExe"
Write-Host "##[warning]STUB: Created empty SonarScanner.MSBuild.exe at $stubExe"
Write-Host "##[section]STUB setup complete — 'Copy Sonar files' step will now succeed silently"
displayName: 'STUB - Create Sonar placeholders (RunAnalysis=false)'

Copilot uses AI. Check for mistakes.
Comment on lines +56 to +60
preBuild:
- ${{ parameters.preBuild }}
postBuild:
- ${{ parameters.postBuild }}
- ${{ parameters.additionalBuildJobs }}
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preBuild/postBuild are passed as a single list item (- ${{ parameters.preBuild }}), which produces a nested sequence. Azure Pipelines stepList parameters typically need to be passed directly (e.g., preBuild: ${{ parameters.preBuild }}) or expanded with an each loop; otherwise the template may fail to compile or the steps won't run.

Copilot uses AI. Check for mistakes.
Comment on lines +59 to +81
- powershell: |
Write-Host "##[section]STUB: Sonar analysis is disabled (RunAnalysis=false)"
Write-Host "##[warning]The following stubs are created only to satisfy the 'Copy Sonar files'"
Write-Host "##[warning]step in stage.build.yml@common, which always runs (condition: succeeded())."
Write-Host "##[warning]These stubs have no effect on analysis — the PublishSonar stage is"
Write-Host "##[warning]gated by RunAnalysis=false and will not run."

$sonarDir = Join-Path "$(Pipeline.Workspace)" ".sonarqube"
if (-not (Test-Path $sonarDir)) {
New-Item -ItemType Directory -Path $sonarDir | Out-Null
Write-Host "##[warning]STUB: Created placeholder .sonarqube dir at $sonarDir"
}

$scannerDir = Join-Path $sonarDir "bin"
New-Item -ItemType Directory -Path $scannerDir -Force | Out-Null
$stubExe = Join-Path $scannerDir "SonarScanner.MSBuild.exe"
if (-not (Test-Path $stubExe)) {
New-Item -ItemType File -Path $stubExe -Force | Out-Null
}
Write-Host "##vso[task.setvariable variable=SONARQUBE_SCANNER_MSBUILD_EXE]$stubExe"
Write-Host "##[warning]STUB: Created empty SonarScanner.MSBuild.exe at $stubExe"
Write-Host "##[section]STUB setup complete — 'Copy Sonar files' step will now succeed silently"
displayName: 'STUB - Create Sonar placeholders (RunAnalysis=false)'
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Sonar placeholder PowerShell block is duplicated across multiple activity pipelines. To reduce drift and make future updates safer, consider moving this into a shared template (e.g., Activities/.pipelines/steps/sonar.stub.yml) and referencing it from each pipeline (or wiring it into the local stage.start.yml default postBuild).

Suggested change
- powershell: |
Write-Host "##[section]STUB: Sonar analysis is disabled (RunAnalysis=false)"
Write-Host "##[warning]The following stubs are created only to satisfy the 'Copy Sonar files'"
Write-Host "##[warning]step in stage.build.yml@common, which always runs (condition: succeeded())."
Write-Host "##[warning]These stubs have no effect on analysis — the PublishSonar stage is"
Write-Host "##[warning]gated by RunAnalysis=false and will not run."
$sonarDir = Join-Path "$(Pipeline.Workspace)" ".sonarqube"
if (-not (Test-Path $sonarDir)) {
New-Item -ItemType Directory -Path $sonarDir | Out-Null
Write-Host "##[warning]STUB: Created placeholder .sonarqube dir at $sonarDir"
}
$scannerDir = Join-Path $sonarDir "bin"
New-Item -ItemType Directory -Path $scannerDir -Force | Out-Null
$stubExe = Join-Path $scannerDir "SonarScanner.MSBuild.exe"
if (-not (Test-Path $stubExe)) {
New-Item -ItemType File -Path $stubExe -Force | Out-Null
}
Write-Host "##vso[task.setvariable variable=SONARQUBE_SCANNER_MSBUILD_EXE]$stubExe"
Write-Host "##[warning]STUB: Created empty SonarScanner.MSBuild.exe at $stubExe"
Write-Host "##[section]STUB setup complete — 'Copy Sonar files' step will now succeed silently"
displayName: 'STUB - Create Sonar placeholders (RunAnalysis=false)'
- template: ..\.pipelines\steps\sonar.stub.yml

Copilot uses AI. Check for mistakes.
Comment on lines +54 to +76
- powershell: |
Write-Host "##[section]STUB: Sonar analysis is disabled (RunAnalysis=false)"
Write-Host "##[warning]The following stubs are created only to satisfy the 'Copy Sonar files'"
Write-Host "##[warning]step in stage.build.yml@common, which always runs (condition: succeeded())."
Write-Host "##[warning]These stubs have no effect on analysis — the PublishSonar stage is"
Write-Host "##[warning]gated by RunAnalysis=false and will not run."
$sonarDir = Join-Path "$(Pipeline.Workspace)" ".sonarqube"
if (-not (Test-Path $sonarDir)) {
New-Item -ItemType Directory -Path $sonarDir | Out-Null
Write-Host "##[warning]STUB: Created placeholder .sonarqube dir at $sonarDir"
}
$scannerDir = Join-Path $sonarDir "bin"
New-Item -ItemType Directory -Path $scannerDir -Force | Out-Null
$stubExe = Join-Path $scannerDir "SonarScanner.MSBuild.exe"
if (-not (Test-Path $stubExe)) {
New-Item -ItemType File -Path $stubExe -Force | Out-Null
}
Write-Host "##vso[task.setvariable variable=SONARQUBE_SCANNER_MSBUILD_EXE]$stubExe"
Write-Host "##[warning]STUB: Created empty SonarScanner.MSBuild.exe at $stubExe"
Write-Host "##[section]STUB setup complete — 'Copy Sonar files' step will now succeed silently"
displayName: 'STUB - Create Sonar placeholders (RunAnalysis=false)'
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Sonar placeholder PowerShell block is duplicated across multiple activity pipelines. To reduce drift and make future updates safer, consider moving this into a shared template (e.g., Activities/.pipelines/steps/sonar.stub.yml) and referencing it from each pipeline (or wiring it into the local stage.start.yml default postBuild).

Suggested change
- powershell: |
Write-Host "##[section]STUB: Sonar analysis is disabled (RunAnalysis=false)"
Write-Host "##[warning]The following stubs are created only to satisfy the 'Copy Sonar files'"
Write-Host "##[warning]step in stage.build.yml@common, which always runs (condition: succeeded())."
Write-Host "##[warning]These stubs have no effect on analysis — the PublishSonar stage is"
Write-Host "##[warning]gated by RunAnalysis=false and will not run."
$sonarDir = Join-Path "$(Pipeline.Workspace)" ".sonarqube"
if (-not (Test-Path $sonarDir)) {
New-Item -ItemType Directory -Path $sonarDir | Out-Null
Write-Host "##[warning]STUB: Created placeholder .sonarqube dir at $sonarDir"
}
$scannerDir = Join-Path $sonarDir "bin"
New-Item -ItemType Directory -Path $scannerDir -Force | Out-Null
$stubExe = Join-Path $scannerDir "SonarScanner.MSBuild.exe"
if (-not (Test-Path $stubExe)) {
New-Item -ItemType File -Path $stubExe -Force | Out-Null
}
Write-Host "##vso[task.setvariable variable=SONARQUBE_SCANNER_MSBUILD_EXE]$stubExe"
Write-Host "##[warning]STUB: Created empty SonarScanner.MSBuild.exe at $stubExe"
Write-Host "##[section]STUB setup complete — 'Copy Sonar files' step will now succeed silently"
displayName: 'STUB - Create Sonar placeholders (RunAnalysis=false)'
- template: ..\.pipelines\steps\sonar.stub.yml

Copilot uses AI. Check for mistakes.
adrianignat13 and others added 2 commits March 2, 2026 18:03
The test fixture used async void Dispose(), which xUnit doesn't await.
This left the JVM alive after tests, causing vstest.console.exe to hang
for ~1.5 hours until the pipeline job timed out.

Fix Dispose to run synchronously and kill orphaned java processes as a
safety net (JavaService.Kill() only kills the shell wrapper due to
UseShellExecute=true). Added a TODO on the production code explaining
the UseShellExecute issue.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 2, 2026

@adrianignat13 adrianignat13 merged commit b545764 into develop Mar 2, 2026
8 checks passed
@adrianignat13 adrianignat13 deleted the fix/cryptography_build_pipeline branch March 2, 2026 18:34
adrianignat13 added a commit that referenced this pull request Mar 2, 2026
The postBuild parameter passed to stage.build.yml@common contained a
template reference (sonar.stub.yml) from the source repo. Azure Pipelines
resolves template references inside @common templates against the common
repo, not the source repo, causing "Not Found" errors.

Inline the PowerShell steps directly in each pipeline's postBuild
parameter (reverting the extraction from PR #516 commit 3e04202) and
delete the now-unused sonar.stub.yml file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
adrianignat13 added a commit that referenced this pull request Mar 2, 2026
…#519)

The postBuild parameter passed to stage.build.yml@common contained a
template reference (sonar.stub.yml) from the source repo. Azure Pipelines
resolves template references inside @common templates against the common
repo, not the source repo, causing "Not Found" errors.

Inline the PowerShell steps directly in each pipeline's postBuild
parameter (reverting the extraction from PR #516 commit 3e04202) and
delete the now-unused sonar.stub.yml file.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants