Skip to content

setup: integrate reusable runner setup and Azure VMSS bootstrap - #522

Open
Enrique Saurez (esaurez) wants to merge 11 commits into
devfrom
copilot/nvx-ci-azure-bootstrap
Open

Enrique Saurez (esaurez) wants to merge 11 commits into
devfrom
copilot/nvx-ci-azure-bootstrap

Conversation

@esaurez

Copy link
Copy Markdown
Contributor

Summary

  • Extend provider-neutral Linux and Windows runner setup with validated additional labels while retaining the required platform/backend labels. Accept an otherwise fresh Windows runner directory containing only a prewarmed _work directory.
  • Isolate VMSS identity checks, managed-disk and host preparation, reboot continuation, and managed-identity/Key Vault registration in scripts/setup/azure/. One example configuration per OS documents the Azure-specific inputs.
  • Build deterministic, hash-verified Azure guest packages from the repository's authoritative runner setup scripts and adjacent tool manifest. Reject mismatched Rust toolchains, unsafe configurations, and custom data over Azure's decoded size limit. Packaging does not modify Azure resources or GitHub runners.
  • Cover the adapters with offline configuration, package, identity, and installer tests, and wire Python, shell, and PowerShell checks into the existing CI actions.

Copilot AI balanced review requested due to automatic review settings October 12, 2026 23:35

Copilot AI left a comment

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.

🟡 Changes recommended

Linux jobs can access bootstrap credentials through IMDS, and Windows NVMe selection can target the wrong managed disk.

5 open findings
What changed in this PR

Integrates reusable runner setup with deterministic Azure VMSS bootstrap packages for Linux and Windows.

Changes:

  • Adds validated runner labels and Windows prewarmed-directory support.
  • Adds Azure identity, disk, reboot, registration, and packaging adapters.
  • Extends offline tests and CI validation.
File Description
scripts/​test_tool_versions.py Tests runner labels and Windows directory handling.
scripts/​test_setup_azure.py Tests Azure configuration and packaging.
scripts/​test_nvx_tools.py Covers Azure setup change classification.
scripts/​setup/​setup-windows-whp.ps1 Supports extra labels and prewarmed _work.
scripts/​setup/​setup-linux-runner.sh Supports extra runner labels.
scripts/​setup/​README.md Documents reusable runner setup.
scripts/​setup/​azure/​windows/​vmss-bootstrap.ps1 Configures Windows VMSS host access.
scripts/​setup/​azure/​windows/​setup-data-disk.ps1 Prepares Windows managed disks.
scripts/​setup/​azure/​windows/​install-package.ps1 Verifies and installs bootstrap packages.
scripts/​setup/​azure/​windows/​config.example.json Provides Windows VMSS example configuration.
scripts/​setup/​azure/​windows/​bootstrap-runner.ps1 Registers and resumes Windows runners.
scripts/​setup/​azure/​requirements.txt Pins the packaging dependency.
scripts/​setup/​azure/​README.md Documents Azure provisioning.
scripts/​setup/​azure/​linux/​verify-mshv.sh Verifies MSHV host readiness.
scripts/​setup/​azure/​linux/​setup-mshv.sh Prepares Azure Linux MSHV boot.
scripts/​setup/​azure/​linux/​setup-data-disk.sh Prepares Linux managed disks.
scripts/​setup/​azure/​linux/​config.example.json Provides Linux VMSS example configuration.
scripts/​setup/​azure/​linux/​bootstrap-runner.sh Registers Linux VMSS runners.
scripts/​setup/​azure/​build_package.py Builds deterministic Azure payloads.
requirements-dev.txt Includes Azure packaging requirements.
.github/​actions/​validate-nvx/​action.yml Runs Azure tests on both platforms.
.github/​actions/​check-quality/​action.yml Checks new shell and PowerShell scripts.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/setup/azure/linux/bootstrap-runner.sh
Comment thread scripts/setup/azure/windows/setup-data-disk.ps1 Outdated
Comment thread scripts/setup/azure/build_package.py
Comment thread scripts/setup/azure/build_package.py
Comment thread scripts/setup/azure/windows/bootstrap-runner.ps1 Outdated
Comment thread scripts/setup/azure/windows/vmss-bootstrap.ps1 Outdated
Copilot AI balanced review requested due to automatic review settings October 13, 2026 03:50

Copilot AI left a comment

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.

🟡 Changes recommended

A stale Windows disk completion marker can allow runner registration before reboot-based disk setup finishes.

1 open finding
5 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Add offline tests for Network Service firewall rule enforcement

scripts/​setup/​azure/​windows/​bootstrap-runner.ps1:86

This function is the security boundary preventing Network Service jobs from reaching IMDS, but the offline Windows tests never execute it; they only extract Get-RunnerName and Get-ExtraRunnerLabels. Add mocked coverage for rule creation and for rejecting a wrong principal, address, direction, action, or disabled rule so a firewall regression cannot pass CI.

Low severity Correct unsupported enableSsh guidance in failure advice

scripts/​setup/​azure/​windows/​vmss-bootstrap.ps1:151

The failure advice points operators to enableSsh=false, but this adapter has no such parameter or configuration field and always runs the OpenSSH setup before the packaged installer. Recommend only an actionable option supported here, such as selecting an image with OpenSSH capability support.

🧠 Review effort: Balanced

Comment thread scripts/setup/azure/windows/setup-data-disk.ps1
@esaurez
Enrique Saurez (esaurez) force-pushed the copilot/nvx-ci-azure-bootstrap branch from 0d29f3b to f55234b Compare October 16, 2026 21:39
Copilot AI balanced review requested due to automatic review settings October 16, 2026 21:39

Copilot AI left a comment

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.

Comment thread scripts/setup/azure/build_package.py Outdated
Comment thread scripts/setup/azure/windows/install-package.ps1
Comment thread scripts/setup/azure/build_package.py Outdated
Comment thread scripts/setup/azure/linux/bootstrap-runner.sh Outdated
Comment thread scripts/setup/azure/linux/bootstrap-runner.sh
Comment thread scripts/setup/azure/linux/setup-data-disk.sh
Comment thread scripts/setup/azure/linux/setup-mshv.sh Outdated
Copilot AI balanced review requested due to automatic review settings October 16, 2026 21:58

Copilot AI left a comment

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.

🟡 Changes recommended

Firewall validation and mounted-disk identity checks leave unresolved security and correctness risks.

9 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Verify mounted device identity after first mount

scripts/​setup/​azure/​linux/​setup-data-disk.sh:247

The first-mount path skips the device-identity check above. Attached disks restored from the same snapshot can share a PARTUUID or UUID, so mounting through the generated fstab entry can select a disk other than the configured LUN and still report success. Compare the mounted device's MAJ:MIN with TARGETDEV after mounting too, before bootstrap uses the volume.

Review effort: Balanced

Comment thread scripts/setup/azure/windows/bootstrap-runner.ps1 Outdated
Copilot AI balanced review requested due to automatic review settings October 16, 2026 23:19

Copilot AI left a comment

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.

Comment thread scripts/setup/azure/build_package.py Outdated
Comment thread scripts/setup/azure/linux/block-runner-metadata.sh Outdated
Comment thread scripts/setup/azure/build_package.py Outdated
Comment thread scripts/setup/azure/build_package.py

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.

A significant portion of this file is written in python. Why not simply write the entire file in python?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It can be Python directly. The payload generator already installs python3 and orders bootstrap after cloud-final.service. It embeds all guest files in one cloud-init payload, so additional helper files do not require separate downloads. Neither distribution nor interpreter bootstrapping requires this Bash wrapper. A direct Python controller can handle configuration, identity, HTTP/token requests, reboot coordination, and runner orchestration while retaining the existing OS-specific Bash helpers. That structural conversion remains a separate, deferred refactor; the current correctness fixes do not change the controller language.

Comment thread scripts/setup/azure/linux/verify-mshv.sh Outdated

Copilot AI left a comment

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.

Comment thread scripts/setup/azure/linux/setup-data-disk.sh
Comment thread scripts/setup/azure/windows/bootstrap-runner.ps1 Outdated
Comment thread scripts/setup/azure/build_package.py Outdated
Comment thread scripts/setup/azure/build_package.py
@esaurez
Enrique Saurez (esaurez) force-pushed the copilot/nvx-ci-azure-bootstrap branch from a9bafc8 to 9398471 Compare October 19, 2026 17:16
Copilot AI balanced review requested due to automatic review settings October 19, 2026 17:16

Copilot AI left a comment

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.

Comment thread scripts/setup/azure/build_package.py
Comment thread scripts/setup/azure/build_package.py
Copilot AI balanced review requested due to automatic review settings October 19, 2026 17:52

Copilot AI left a comment

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.

Comment thread scripts/setup/azure/windows/setup-data-disk.ps1 Outdated
Comment thread scripts/setup/azure/windows/setup-data-disk.ps1
Comment thread scripts/setup/azure/windows/setup-data-disk.ps1

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.

LGTM

Copilot AI balanced review requested due to automatic review settings October 19, 2026 19:25
Enrique Saurez and others added 8 commits October 19, 2026 12:27
Keep the required CI labels while allowing extra pool labels. Accept the Windows work directory populated by runner prewarm without accepting a partial runner installation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Persist and verify the Linux runner metadata block, require an exact Windows NVMe LUN, reject invalid bootstrap inputs and stale package outputs, and use generic runner names.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Invalidate stale disk completion before recording a pending reboot. Cover Windows disk bootstrap gating and metadata firewall enforcement with offline mocks, and replace unsupported OpenSSH recovery advice.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Provision distribution-appropriate disk tools, preserve mount ownership before fstab updates, and verify newly mounted devices and effective Dom0 defaults. Tighten Windows bootstrap ownership, scratch-path validation, and metadata firewall scope. Avoid restarting registered Linux runners and disable completed provisioning.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Install only MSHV boot components and remove unrelated runtime checks. Preserve metadata protection during serialized rule replacement, reject unsafe Windows ancestor and trailing-period paths, and pin ZIP creator metadata across platforms.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Require a full-device zero comparison before initializing unmarked Linux disks. Validate running firewall services, effective profiles, and the enforced ActiveStore rule before registration. Reject the reserved Linux job account as administrator and canonicalize packaged PowerShell newlines.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reject reserved DOS path components and use host-neutral gzip headers. Verify complete RAW disks with bounded-memory compiled reads, preserve unowned empty GPT layouts, and align continuation timeouts with full-device verification. Retain the supported Format-Volume Partition parameter.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@esaurez
Enrique Saurez (esaurez) force-pushed the copilot/nvx-ci-azure-bootstrap branch from 9a58c3b to a3ee366 Compare October 19, 2026 19:31

Copilot AI left a comment

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.

Comment thread scripts/setup/azure/build_package.py
Copilot AI balanced review requested due to automatic review settings October 19, 2026 19:32

Copilot AI left a comment

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.

Resolve omitted and null benchmark scratch paths on the configured managed data drive before validation. Package the explicit validated path, retain existing overlap rules and invalid-value rejection, and cover default collisions and packaged configuration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 19:48

Copilot AI left a comment

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.

🔵 Needs a closer look

Privileged disk preparation, credential isolation, and reboot handling need isolated Azure validation and human review, including the unresolved extension timeout risk.

6 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Move long-running bootstrap out of Custom Script Extension timeout

scripts/​setup/​azure/​windows/​install-package.ps1:76

This synchronous call keeps initial bootstrap inside Windows Custom Script Extension, including the full-device RAW-disk scan and prerequisite installation. The extension has a 90-minute execution limit, so provisioning that exceeds it is reported as failed despite the continuation task's four-hour budget. Registering an AtStartup task does not move the current invocation outside that limit. Stage bootstrap in an independent SYSTEM scheduled task and start it immediately, allowing the extension to return after successful handoff. Keep bootstrap completion and failure reporting separate from extension staging.

1 resolved since last review

Review effort: Balanced

Keep package verification and staging inside the extension, but hand initial bootstrap to the persistent four-hour SYSTEM task. Preserve reboot and retry behavior, separate staging from completion, and log/rethrow bootstrap failures. Mock all scheduled-task operations and cover handoff/configuration/metadata failures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Link the built fake OpenVMM on Unix so parallel child launches cannot inherit writable copies and fail with ETXTBSY. Keep Windows copying, golden recordings, test parallelism, and production launch behavior unchanged. Add a deterministic executable-linkage regression.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 21:06
@esaurez

Enrique Saurez (esaurez) commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Addressed the extension-timeout finding from the latest review in 06b90fc: the extension now verifies/stages the package and starts the persistent SYSTEM task without waiting for bootstrap. The startup trigger, four-hour budget, and retries are preserved. Staging acknowledgement is separate from final readiness; bootstrap logs errors, emits a failure marker, and rethrows failures.

e4e1420 fixes the Linux CI failure in the CLI replay fixture: Unix roots now link the built fake OpenVMM instead of creating writable copies while other test threads launch children, eliminating that ETXTBSY exposure. Production launch behavior, Windows copies, parallelism, and recorded expectations are unchanged.

The repaired Linux CLI target (13 tests), Rust lint configurations, Azure package suite, and native Windows mocked cases pass locally. As of 14:11 PDT, CI run 39324816007 has passed the Linux/Windows Rust checks, Linux/Windows CLI checks, and lint/type/format. The overall matrix is still in progress with no failed jobs.

Copilot AI left a comment

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.

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