Skip to content

refactor: cross-platform build script compatibility (CUT-5128)#741

Open
junioralmeida-82 wants to merge 18 commits into
v3.2.1_pwshModulefrom
feature/CUT-5128-build-script-compatibility
Open

refactor: cross-platform build script compatibility (CUT-5128)#741
junioralmeida-82 wants to merge 18 commits into
v3.2.1_pwshModulefrom
feature/CUT-5128-build-script-compatibility

Conversation

@junioralmeida-82
Copy link
Copy Markdown
Contributor

@junioralmeida-82 junioralmeida-82 commented May 14, 2026

Description
Refactored the PowerShell build system in the support repository to ensure full cross-platform compatibility (macOS, Linux, and Windows).

Issues
CUT-5128 - Refactor build scripts for cross-platform support.

What does this solve?
Replaces manual path concatenations with Join-Path to handle different path separators (/ vs ) automatically.

Standardizes variable initialization when dot-sourcing Get-Config.ps1 to prevent "Null Argument" errors on non-Windows environments.

Modernizes the build orchestrator for better stability across different PowerShell versions (5.1 and 7+).

Is there anything particularly tricky?
Safety Bypass: As discussed with @joeworkman, the git push command in Invoke-GitCommit.ps1 has been commented out to prevent accidental commits during the build process until a separate deploy card is addressed.

How should this be tested?
Run the build script from the root of the repository:
pwsh ./PowerShell/Deploy/Build-Module.ps1 -ReleaseType Patch

Verify that all paths in the terminal logs resolve correctly according to the Host OS.

Check if the module manifest (.psd1) and ModuleChangelog.md are updated correctly.

Screenshots
Captura de Tela 2026-05-14 às 16 05 43

Captura de Tela 2026-05-14 às 16 06 03 Captura de Tela 2026-05-14 às 16 07 05

Note

Medium Risk
Build/deploy pipeline behavior changes (path resolution, additional build steps, and disabling git commit/push) could affect CI/release automation if assumptions about working directory, generated artifacts, or git publishing still exist.

Overview
Refactors the PowerShell module build pipeline to be cross-platform by standardizing path construction with Join-Path and explicitly passing config parameters when dot-sourcing Get-Config.ps1.

Build-Module.ps1 now also orchestrates additional post-build steps (SDK endpoint sync, help generation, and Pester test file generation) with existence checks, and Invoke-GitCommit.ps1 has its git commit/push calls commented out to prevent accidental publishes during testing.

Bumps module/help version to 3.1.1, updates the manifest metadata/formatting, adds deployment docs (PowerShell/Deploy/README.md), and records the release in ModuleChangelog.md.

Reviewed by Cursor Bugbot for commit afc94a0. Bugbot is set up for automated code reviews on this repo. Configure here.

@junioralmeida-82 junioralmeida-82 self-assigned this May 14, 2026
@junioralmeida-82 junioralmeida-82 requested a review from a team as a code owner May 14, 2026 19:11
@junioralmeida-82 junioralmeida-82 added enhancement PowerShell Module Release for JumpCloud PowerShell Module patch labels May 14, 2026
Comment thread PowerShell/Deploy/Build-Module.ps1 Outdated
Comment thread PowerShell/ModuleChangelog.md Outdated
Invoke-Git -Arguments:('commit -m ' + '"' + $CommitMessage + '";')
Invoke-Git -Arguments:('push origin ' + 'master' + ';')
#Invoke-Git -Arguments:('commit -m ' + '"' + $CommitMessage + '";')
#Invoke-Git -Arguments:('push origin ' + 'master' + ';')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Git commit and push permanently disabled in build

Medium Severity

Both git commit and git push commands are commented out, making Invoke-GitCommit a no-op that stages files and shows status but never commits or pushes. While the PR notes this is temporary "until a separate deploy card is addressed," shipping this to the main branch means any CI/CD pipeline depending on this function will silently fail to publish changes.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6048ec3. Configure here.

Comment thread PowerShell/JumpCloud Module/JumpCloud.psd1 Outdated
Copy link
Copy Markdown
Contributor

@jworkmanjc jworkmanjc left a comment

Choose a reason for hiding this comment

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

The Acceptance Criteria for the card could be more clear but in general I want the Build-Module script to call all of the required build functions:
Get-Config / dependencies → Build-Module →SdkSync/jcapiToSupportSync.ps1 → Build-HelpFiles → Build-PesterTestFiles → BuildNuspecFromPsd1.

Right now the build script is only updating the Module Manifest (.psd1) file so this card can not be marked complete yet.

My aim is to have developers perform work in the module, then run ./Build-Module.ps1 -ReleaseType patch and have that function call perform the work it's doing today and run:
SdkSync/jcapiToSupportSync.ps1
Build-HelpFiles
Build-PesterTestFiles
BuildNuspecFromPsd1

These scripts need to be included in Build-Module in order to mark this work ready for review. The SDK functions can be updated outside of this this repository, when we cut a new release it's important to keep these functions that we autogenerate in sync with our latest powershell release.

Help Files should be generated if we are developing so having the build-module function call build-helpfiles would be important here.

Pester tests are generated automatically if a developer runs Build-PesterTestFiles, these have been forgotten previously so in my opinion they should just be included in the build-module script.

BuildNuspecFromPsd1 this is probably out of scope looking at this now but we did have it in the card. I think CI processes this and we really don't need to build this into the module.

Comment thread PowerShell/Deploy/Build-Module.ps1
& $BuildHelpPath -ModuleName $ModuleName -ModulePath $ModuleFolder

# 4. Return the terminal to exactly where it was before.
Set-Location -Path $PreviousLocation
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Set-Location not restored if help script throws

Low Severity

The working directory is changed via Set-Location before calling & $BuildHelpPath, and restored afterward on line 90. If the help script throws a terminating error, Set-Location -Path $PreviousLocation is skipped, leaving the process in the "Docs" directory. Subsequent operations like Build-PesterTestFiles.ps1 would then execute from an unexpected location. A try/finally block would ensure the location is always restored.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 07d64af. Configure here.

Comment thread PowerShell/Deploy/Build-Module.ps1
Comment thread PowerShell/Deploy/Build-Module.ps1 Outdated
# EndRegion Updating module change log No newline at end of file
# EndRegion Updating module change log

# ====================================================================
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can remove AI generated content here

Comment thread PowerShell/Deploy/Build-Module.ps1
Comment thread PowerShell/Deploy/Build-Module.ps1
Comment thread PowerShell/Deploy/Build-Module.ps1 Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

Reviewed by Cursor Bugbot for commit afc94a0. Configure here.

Invoke-Git -Arguments:('commit -m ' + '"' + $CommitMessage + '";')
Invoke-Git -Arguments:('push origin ' + 'master' + ';')
#Invoke-Git -Arguments:('commit -m ' + '"' + $CommitMessage + '";')
#Invoke-Git -Arguments:('push origin ' + 'master' + ';')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

git add -A still stages files despite disabled commit

Medium Severity

Invoke-GitCommit still executes git add -A (staging all files), git config user.email, and git config user.name even though commit and push are commented out. When called from Build-WikiPages.ps1, this modifies the developer's local git config to "CircleCI" values and stages their entire working tree — real side effects that conflict with the stated goal of safe local testing. If the intent is to bypass git operations, the staging and config commands need to be disabled too.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit afc94a0. Configure here.

@jworkmanjc jworkmanjc changed the base branch from master to v3.1.1_pwshModule May 20, 2026 21:54
Copy link
Copy Markdown
Contributor

@jworkmanjc jworkmanjc left a comment

Choose a reason for hiding this comment

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

I'm good with these changes for now, I changed the target branch to v3.1.1_pwshModule

Otherwise approved

@jworkmanjc jworkmanjc requested a review from gweinjc May 27, 2026 14:19
@jworkmanjc jworkmanjc changed the base branch from v3.1.1_pwshModule to v3.2.1_pwshModule May 28, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch PowerShell Module Release for JumpCloud PowerShell Module

Development

Successfully merging this pull request may close these issues.

2 participants