Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/quality-gates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -362,3 +362,40 @@ jobs:
throw 'MAML help was not served on a case-sensitive filesystem.'
}
Write-Host 'All commands served full help from MAML.'

# The static analysis is the one part of the module a Linux host can use: it needs the
# file and nothing else. This step keeps that true. The script type is inferred from
# folder names, so the fixtures use the layouts the suite template describes, with the
# separators this host writes; the harness and the log readers stay Windows-only.
- name: Analyze scripts on Linux

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Placed in the help job rather than a job of its own because it is the same Ubuntu runner with the module already importable, and a separate job would add a runner for a 10-second check. Two fixtures rather than one so the folder-based inference is exercised: the Publish-Module rehearsal already covers the remediation case on Windows, and the Win32 folder is the path where a separator difference would show. Asserting on the IslAssumedContext message is what proves the type came from the folder and not from a default.

shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
Import-Module ./IntuneScriptLab.psd1 -Force

$root = Join-Path ([System.IO.Path]::GetTempPath()) "isl-linux-$([guid]::NewGuid().ToString('N'))"
$remediation = Join-Path $root 'Remediations/Widget'
$win32 = Join-Path $root 'Win32/Widget'
New-Item -ItemType Directory -Path $remediation, $win32 -Force | Out-Null
# return before exit 1: the remediation never runs (IslExitCodeIssue, Error)
Set-Content -Path (Join-Path $remediation 'Detect.ps1') -Value "if (Test-Path /tmp/x) { return 'ok' }`nexit 1"
# exit 0 with nothing on stdout: the app is never detected (IslOutputIssue, Error)
Set-Content -Path (Join-Path $win32 'Detect.ps1') -Value "if (Test-Path /tmp/x) { exit 0 }`nexit 1"

$findings = @(Test-IntuneScript -Path $root)
$findings | Format-Table Severity, RuleName, Line, @{ n = 'Script'; e = { Split-Path (Split-Path $_.ScriptPath) -Leaf } } -AutoSize | Out-String | Write-Host

$failed = @()
$exit = @($findings | Where-Object { $_.RuleName -eq 'IslExitCodeIssue' -and $_.Severity -eq 'Error' -and $_.ScriptPath -like '*Remediations*' })
if (-not $exit) { $failed += 'the return-before-exit detection was not reported' }
$output = @($findings | Where-Object { $_.RuleName -eq 'IslOutputIssue' -and $_.Severity -eq 'Error' -and $_.ScriptPath -like '*Win32*' })
if (-not $output) { $failed += 'the silent Win32 detection was not reported' }
$context = @($findings | Where-Object { $_.RuleName -eq 'IslAssumedContext' -and $_.Message -like '*Win32Detection*' })
if (-not $context) { $failed += 'the Win32 folder did not set the script type' }
Remove-Item -Path $root -Recurse -Force

if ($failed) {
$failed | ForEach-Object { Write-Host "FAILED: $_" }
throw 'Test-IntuneScript did not analyze the fixtures on Linux.'
}
Write-Host 'Test-IntuneScript analyzed both fixtures on Linux with the expected findings.'
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ release notes.

### Changed

- The `help` job in `quality-gates.yml`, the one that runs on Linux, also analyzes a folder of two
fixture scripts with `Test-IntuneScript` and fails unless the return-before-exit detection and the
silent Win32 detection are reported with the script type taken from the folder names. The static
analysis needs only the file, and that is now tested where it is claimed.
- `Validation/Findings.md` records an enrollment of the Windows 11 Home ARM64 device: in 75 minutes
and 11 syncs the service never sent the Intune Management Extension, so the agent's behaviour on
ARM64 stays a host survey until a Pro or Enterprise ARM64 device is available. The LAPS
Expand Down
4 changes: 3 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ backslash entry names (build zips entry by entry with forward slashes).

The harness launches `powershell.exe` hosts by architecture, reads the registry and registers
scheduled tasks, so the suites run on Windows only: the `desktop` job under 5.1 and the `arm64`
job on Windows on ARM. The `help` job proves the module imports on Linux; nothing else there runs.
job on Windows on ARM. The `help` job proves the module imports on Linux and that
`Test-IntuneScript` analyzes a folder there, with the script type inferred from forward-slash
paths; no suite and no harness run there.

### Variable names are case-insensitive, and nested functions have their own `$PSBoundParameters`

Expand Down
Loading