Skip to content

Improve sdcm.exe handling in signing scripts - #75

Merged
Ben Carpenter (Ben-Carpenter) merged 3 commits into
mainfrom
fix/signing-scripts-sdcm-path-and-errors
Nov 12, 2026
Merged

Ben Carpenter (Ben-Carpenter) merged 3 commits into
mainfrom
fix/signing-scripts-sdcm-path-and-errors

Conversation

@Ben-Carpenter

Copy link
Copy Markdown
Collaborator

Summary

Improves how the PowerShell signing scripts (Attestation.ps1, HLKx.ps1, ShippingLabel.ps1) locate and run sdcm.exe.

Changes

  • Find sdcm.exe in the script's own directory, so the scripts behave the same no matter which folder they're run from.
  • Stop with a clear message if sdcm.exe is not found.
  • Check the exit code after each sdcm.exe call and stop on failure, so later steps (commit, wait, download) don't run after an earlier step has failed.
  • ShippingLabel.ps1: add an optional -ProductName parameter. It defaults to ProductId and fixes a reference to a variable that was never defined.
  • Add Scripts/Tests/SdcmPath.Tests.ps1.

Behavior notes

  • The scripts now exit with a non-zero code when sdcm.exe fails.
  • Re-running a download when the output .signed.zip already exists now fails instead of reporting success. sdcm.exe -download does not overwrite an existing file. The scripts now reports this as a failure instead of printing Done. Remove or rename the existing .signed.zip before re-running.

Testing

powershell -File Scripts\Tests\SdcmPath.Tests.ps1. All tests pass.

…ectory

Signing scripts now locate sdcm.exe relative to the script directory ($PSScriptRoot) and exit with a clear error if it is not found. Adds tests for running from another working directory and for a missing executable.
Previously sdcm.exe failures were ignored, so a failed upload/commit/wait continued to later steps and could report Done. Check LASTEXITCODE after each call, exit with sdcm's code, and add a test for failure propagation.
The shipping label JSON referenced an undefined $ProductName, which fails under StrictMode. Add it as an optional parameter defaulting to ProductId and remove the known-issue skip from tests.
@Ben-Carpenter
Ben Carpenter (Ben-Carpenter) merged commit c7c6fd3 into main Nov 12, 2026
5 checks passed
@Ben-Carpenter
Ben Carpenter (Ben-Carpenter) deleted the fix/signing-scripts-sdcm-path-and-errors branch November 12, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants