[Experiment] Test dotnet build inside gh-aw agent container#24
[Experiment] Test dotnet build inside gh-aw agent container#24PureWeen wants to merge 15 commits into
Conversation
Tests whether the gh-aw agent sandbox can run dotnet build. Expected results: - api.nuget.org may be blocked by AWF firewall (now allowlisted via 'dotnet' network) - dotnet CLI may or may not be installed in the container - TOKEN env vars are visible to subprocesses (via --env-all) Changes: - Add pull_request_target trigger for auto-runs on test file changes - Add bash tools (dotnet, pwsh, gh, etc.) to agent - Add dotnet network allowlist (nuget.org, dotnet.microsoft.com, etc.) - Add build experiment section to agent prompt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
- Switch from HostApp (needs android workload) to Core.UnitTests (net10.0 only) - Add curl, sed, awk, mkdir, cp to bash tool allowlist - Add workload list check to experiment Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
- Remove env/TOKEN check (triggered security scanner) - Remove curl test (blocked at tool level) - Add Part A: dotnet new console + build (no workloads needed) - Add Part B: test NuGet network via dotnet restore - Add Part C: try dotnet workload install maui-android - Add Part D: if workloads work, build Core.UnitTests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
- Copy /usr/share/dotnet to /tmp/dotnet-local (writable) - Set DOTNET_ROOT to writable copy - Try dotnet workload install maui-android - If successful, build Core.UnitTests with workloads available Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
- Add 'Provision .NET SDK with MAUI workloads' step that runs ./build.sh --target=dotnet and --target=dotnet-local-workloads on the runner BEFORE the agent container starts - .dotnet/ directory is in workspace (mounted into container) - Agent uses .dotnet/dotnet instead of system dotnet - Simplified experiment: restore, build, test Core.UnitTests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
- Use 'dotnet cake --target=dotnet-local-workloads' instead of 'build.sh --target=dotnet-local-workloads' (Arcade doesn't know Cake targets) - Verify packs/ directory is populated after install - Agent uses system dotnet with DOTNET_ROOT pointing to .dotnet/ (can't execute .dotnet/dotnet due to container noexec) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…oad install - Run 'dotnet tool restore' first to get dotnet-cake - Run 'dotnet cake --target=dotnet' to provision .dotnet/ SDK - Run '.dotnet/dotnet workload install maui-android' directly (bypasses broken Cake dotnet-local-workloads target) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
HostApp restore succeeded but build failed because Microsoft.Maui.BuildTasks.slnf was not compiled. Add it to provisioning. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
…tion Gradle wrapper failed because ~/.gradle/ is not writable in the agent container. Set GRADLE_USER_HOME to workspace .gradle-home/. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove pre-agent provisioning step entirely. The agent now: 1. dotnet tool restore (get dotnet-cake) 2. dotnet cake --target=dotnet (download SDK to .dotnet/) 3. DOTNET_ROOT=.dotnet/ + dotnet workload install maui-android 4. dotnet build Microsoft.Maui.BuildTasks.slnf 5. GRADLE_USER_HOME=.gradle-home/ + dotnet build HostApp Testing whether the entire chain works inside the container. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
- Add services.gradle.org and downloads.gradle.org - Use dotnet cake --target=dotnet-local-workloads (works in sandbox) instead of dotnet workload install (blocked by read-only /usr/share) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
09debfa to
a2cc4a4
Compare
This comment has been minimized.
This comment has been minimized.
java ecosystem identifier didn't cover services.gradle.org. Also add releaseassets.githubusercontent.com (flagged by firewall). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
AWF squid proxy blocks Gradle CONNECT tunneling even with services.gradle.org allowlisted. Work around by downloading Gradle 8.13 zip in a steps: block (no proxy) and caching at .gradle-home/ which is mounted into the container. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🧪 Build Experiment ResultsAll steps completed. Here are the full results from the MAUI build chain experiment inside the gh-aw agent container: Step A: Provision SDK inside the containerA1: Restore dotnet tools ✅ A2: Download local SDK via Cake ✅ A3: Set DOTNET_ROOT ✅
Step B: Install workloads via CakeB1: Install workloads via Cake ✅ B2: Verify packs ✅ Step C: Build MAUI infrastructureC1: Verify Gradle cache ✅ C2: Build MSBuild tasks ✅ (after fix — see note below)
Step D: Build HostAppD1: Find HostApp ✅ D2: Restore HostApp ✅ D3: Build HostApp for Android (net10.0-android, Debug) ✅ Summary
🎉 The entire MAUI build chain works inside the gh-aw agent container. Key requirements for reliable builds:
Caution Security scanning requires review for Evaluate PR Tests DetailsPotential security threats were detected in the agent output. The workflow output should be reviewed before merging. Review the workflow run logs for details. Warning The following domains were blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "aka.ms"
- "releaseassets.githubusercontent.com"See Network Configuration for more information.
|
Replace Cake-based SDK provisioning (runs repo code) with dotnet-install.sh from Microsoft CDN (no repo code executed). Security improvement: steps: block now only runs trusted external tools — dotnet-install.sh, dotnet workload install, curl for Gradle. The only repo data read is global.json's version string (passive). All build commands (BuildTasks, HostApp) still run inside the sandboxed agent container where GITHUB_TOKEN is scrubbed. Changes: - Download SDK via dotnet-install.sh (Microsoft CDN) - Install maui-android workload via dotnet workload install - Compute Gradle hash dir dynamically (base36 of MD5(url)) - Place Gradle zip + .ok marker in correct wrapper cache path - Simplify agent prompt: just verify + build (no provisioning) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/review |
|
❌ Expert Code Review failed. Please review the logs for details. |
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Experiment
Tests whether the gh-aw agent sandbox can run
dotnet build. Expected results:api.nuget.orgis blocked by AWF firewall → restore fails (now allowlisted viadotnetnetwork group)dotnetCLI may or may not be installed in the container--env-all)This is a throwaway experiment PR — do not merge into dotnet/maui.
What we're verifying
dotnetnetwork allowlist)dotnetCLI is available in the agent imagedotnet restoreanddotnet buildcan runChanges
pull_request_targettrigger for auto-runs on test file changesdotnet,pwsh,gh, etc.) to agent containerdotnetnetwork allowlist (nuget.org, dotnet.microsoft.com, etc.)Based on dotnet#34762