Skip to content

build.ps1: switch packaging output from .pkg to .msi#1

Open
rodchristiansen wants to merge 2 commits intomainfrom
fix/cimipkg-msi-output
Open

build.ps1: switch packaging output from .pkg to .msi#1
rodchristiansen wants to merge 2 commits intomainfrom
fix/cimipkg-msi-output

Conversation

@rodchristiansen
Copy link
Copy Markdown
Contributor

Summary

The new cimipkg (2026.04.09+) defaults to .msi output instead of .pkg.
Update build.ps1 to match so packaging produces MSIs consistent with the
rest of the Cimian toolchain.

Changes

  • -Pkg switch renamed to -Msi
  • Output glob ManageUsers-*.pkgManageUsers-*.msi
  • Log messages, variable names, and staging path all reflect .msi
  • Header comment and example command updated

build-info.yaml is unchanged — cimipkg reads the same template and just
produces a different output format based on its own defaults.

Test plan

  • .\build.ps1 -Msi from a clean checkout — builds binaries and produces
    signed ManageUsers-{arch}-{version}.msi files in build/.
  • Verified script parses cleanly via
    [System.Management.Automation.Language.Parser]::ParseFile.

The new cimipkg (2026.04.09+) defaults to .msi output instead of .pkg.
Update build.ps1 to match: rename the -Pkg switch to -Msi, update the
output glob from ManageUsers-*.pkg to ManageUsers-*.msi, and rename
log messages, variables, and staging paths to reflect the change.

build-info.yaml is unchanged — cimipkg reads the same template and
just produces a different output format based on its own defaults.
Copilot AI review requested due to automatic review settings April 9, 2026 17:57
Copy link
Copy Markdown

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

Updates the ManageUsers build script to align with the updated cimipkg default output format by producing .msi packages instead of .pkg, keeping packaging artifacts consistent with the rest of the Cimian toolchain.

Changes:

  • Renamed packaging switch from -Pkg to -Msi and updated related log output.
  • Updated packaging artifact globbing/renaming from ManageUsers-*.pkg to ManageUsers-*.msi.
  • Renamed staging variables/paths to reflect MSI output.

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

@@ -20,7 +20,7 @@ param(
[switch]$AllowUnsigned,
[switch]$ListCerts,
[string]$FindCertSubject,
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

Renaming the switch from -Pkg to -Msi is a breaking change for any existing automation invoking this script. Consider adding an alias (e.g., [Alias('Pkg')]) or supporting both switches (with one deprecated) to preserve backward compatibility while still steering users to -Msi.

Suggested change
[string]$FindCertSubject,
[string]$FindCertSubject,
[Alias('Pkg')]

Copilot uses AI. Check for mistakes.
Comment on lines 368 to +372
$buildInfoFile = Join-Path $RootDir 'build-info.yaml'
$buildInfoTemplate = Get-Content -Path $buildInfoFile -Raw
$payloadDir = Join-Path $RootDir 'payload'
$pkgStaging = Join-Path $env:TEMP "manageusers_pkg_$(Get-Date -Format 'yyyyMMddHHmmss')"
New-Item -ItemType Directory -Path $pkgStaging -Force | Out-Null
$msiStaging = Join-Path $env:TEMP "manageusers_msi_$(Get-Date -Format 'yyyyMMddHHmmss')"
New-Item -ItemType Directory -Path $msiStaging -Force | Out-Null
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

This block mutates build-info.yaml and creates staging/payload directories, but cleanup/restoration only happens at the end of the happy path. If any command throws (e.g., Set-Content/Copy-Item/Rename-Item/Move-Item), the repo can be left with a stamped build-info.yaml and leftover temp/payload folders. Wrap the packaging section in a try/finally to always restore build-info.yaml and remove $payloadDir / $msiStaging.

Copilot uses AI. Check for mistakes.
Preserve backward compat and tighten cleanup semantics.

- Add [Alias('Pkg')] on the -Msi switch so existing automation calling
  the script with -Pkg keeps working. cimipkg 2026.04.09+ produces .msi
  output regardless; the alias is purely for CLI ergonomics.
- Wrap the packaging loop in try/finally so build-info.yaml is restored
  and the temp payload / staging dirs are removed even if a mid-loop
  Set-Content / Copy-Item / Rename-Item / Move-Item throws. Previously,
  a mid-loop failure could leave the repo with a stamped build-info.yaml
  and stale temp folders.
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.

2 participants