Skip to content

Commit c8aa30d

Browse files
authored
Merge pull request #339 from microsoft/agents/copilot-setup-github-runners-instructions
Set up Copilot instructions for GitHub runners
2 parents 712caf9 + ef24daf commit c8aa30d

8 files changed

Lines changed: 607 additions & 19 deletions

File tree

‎.github/actions/build-guest-artifacts/action.yml‎

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
name: Build guest artifacts
22
description: Cache or build the pinned Linux kernel and guest images
33

4+
inputs:
5+
restore-only:
6+
description: >-
7+
Only restore cached artifacts; skip Docker builds, determinism checks,
8+
and cache saves for artifacts that miss the cache
9+
required: false
10+
default: "false"
11+
412
outputs:
513
kernel-cache-key:
614
description: Exact cache key for the Linux kernel artifacts
@@ -117,7 +125,7 @@ runs:
117125
enableCrossOsArchive: true
118126

119127
- name: Build Linux kernel (Docker)
120-
if: steps.cache-linux-kernel-zstd.outputs.cache-hit != 'true'
128+
if: inputs.restore-only != 'true' && steps.cache-linux-kernel-zstd.outputs.cache-hit != 'true'
121129
shell: bash
122130
run: >-
123131
docker build
@@ -127,7 +135,7 @@ runs:
127135
.
128136
129137
- name: Save Linux kernel (zstd)
130-
if: steps.cache-linux-kernel-zstd.outputs.cache-hit != 'true'
138+
if: inputs.restore-only != 'true' && steps.cache-linux-kernel-zstd.outputs.cache-hit != 'true'
131139
uses: actions/cache/save@v5
132140
with:
133141
path: |
@@ -138,7 +146,7 @@ runs:
138146
enableCrossOsArchive: true
139147

140148
- name: Build Alpine disk image (Docker)
141-
if: steps.cache-alpine-image-zstd.outputs.cache-hit != 'true'
149+
if: inputs.restore-only != 'true' && steps.cache-alpine-image-zstd.outputs.cache-hit != 'true'
142150
shell: bash
143151
run: >-
144152
docker build
@@ -148,7 +156,7 @@ runs:
148156
.
149157
150158
- name: Save Alpine disk image (zstd)
151-
if: steps.cache-alpine-image-zstd.outputs.cache-hit != 'true'
159+
if: inputs.restore-only != 'true' && steps.cache-alpine-image-zstd.outputs.cache-hit != 'true'
152160
uses: actions/cache/save@v5
153161
with:
154162
path: |
@@ -159,7 +167,7 @@ runs:
159167
enableCrossOsArchive: true
160168

161169
- name: Build Ubuntu initramfs (Docker)
162-
if: steps.cache-ubuntu-initramfs-zstd.outputs.cache-hit != 'true'
170+
if: inputs.restore-only != 'true' && steps.cache-ubuntu-initramfs-zstd.outputs.cache-hit != 'true'
163171
shell: bash
164172
run: >-
165173
docker build
@@ -170,8 +178,11 @@ runs:
170178
171179
- name: Verify Ubuntu artifact determinism (Docker)
172180
if: >-
173-
steps.cache-ubuntu-initramfs-zstd.outputs.cache-hit != 'true' ||
174-
steps.cache-ubuntu-distro-zstd.outputs.cache-hit != 'true'
181+
inputs.restore-only != 'true' &&
182+
(
183+
steps.cache-ubuntu-initramfs-zstd.outputs.cache-hit != 'true' ||
184+
steps.cache-ubuntu-distro-zstd.outputs.cache-hit != 'true'
185+
)
175186
shell: bash
176187
run: >-
177188
docker build
@@ -180,7 +191,7 @@ runs:
180191
.
181192
182193
- name: Save Ubuntu initramfs (zstd)
183-
if: steps.cache-ubuntu-initramfs-zstd.outputs.cache-hit != 'true'
194+
if: inputs.restore-only != 'true' && steps.cache-ubuntu-initramfs-zstd.outputs.cache-hit != 'true'
184195
uses: actions/cache/save@v5
185196
with:
186197
path: |
@@ -190,7 +201,7 @@ runs:
190201
enableCrossOsArchive: true
191202

192203
- name: Build Azure Linux initramfs (Docker)
193-
if: steps.cache-azurelinux-initramfs-zstd.outputs.cache-hit != 'true'
204+
if: inputs.restore-only != 'true' && steps.cache-azurelinux-initramfs-zstd.outputs.cache-hit != 'true'
194205
shell: bash
195206
env:
196207
AZURELINUX_IMAGE: ${{ steps.guest-versions.outputs.azurelinux-image }}
@@ -205,7 +216,7 @@ runs:
205216
.
206217
207218
- name: Save Azure Linux initramfs (zstd)
208-
if: steps.cache-azurelinux-initramfs-zstd.outputs.cache-hit != 'true'
219+
if: inputs.restore-only != 'true' && steps.cache-azurelinux-initramfs-zstd.outputs.cache-hit != 'true'
209220
uses: actions/cache/save@v5
210221
with:
211222
path: |
@@ -215,7 +226,7 @@ runs:
215226
enableCrossOsArchive: true
216227

217228
- name: Build Ubuntu distro layer (Docker)
218-
if: steps.cache-ubuntu-distro-zstd.outputs.cache-hit != 'true'
229+
if: inputs.restore-only != 'true' && steps.cache-ubuntu-distro-zstd.outputs.cache-hit != 'true'
219230
shell: bash
220231
run: >-
221232
docker build
@@ -225,7 +236,7 @@ runs:
225236
.
226237
227238
- name: Save Ubuntu distro layer (zstd)
228-
if: steps.cache-ubuntu-distro-zstd.outputs.cache-hit != 'true'
239+
if: inputs.restore-only != 'true' && steps.cache-ubuntu-distro-zstd.outputs.cache-hit != 'true'
229240
uses: actions/cache/save@v5
230241
with:
231242
path: |
@@ -238,6 +249,7 @@ runs:
238249
shell: bash
239250
run: |
240251
set -euo pipefail
252+
mkdir -p build
241253
rm -f build/ubuntu-smoke-scratch.ext4
242254
truncate --size 64M build/ubuntu-smoke-scratch.ext4
243255
mkfs.ext4 -q -F -m 0 \

‎.github/copilot-instructions.md‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,45 @@
4040
`nvx-debug`, or `nvx-benchmark`. Never expose `.nvx-hosts.json` or authentication
4141
material.
4242

43+
## Copilot Cloud Agent Sessions
44+
45+
- Sessions started from GitHub, such as from an issue, a pull request, or the
46+
agents panel, run on a GitHub-hosted Ubuntu runner that
47+
[copilot-setup-steps](./workflows/copilot-setup-steps.yml) prepares. It
48+
initializes `openvmm/`; installs `requirements-dev.txt` into a Python virtual
49+
environment on `PATH`, Rust stable with the OpenVMM test targets, the
50+
`aci_edge_sandboxes` toolchains, cargo-nextest, and the native guest build
51+
prerequisites; grants `/dev/kvm` access; pulls the pinned shell linter images;
52+
and stages the pinned Linux and Ubuntu Base archives in `.cache/downloads`.
53+
When CI has cached them for the checked-out inputs, it also restores the guest
54+
artifacts into `build/` and the KVM OpenVMM binary into
55+
`openvmm/target/release/openvmm`. `NVX_COPILOT_SETUP` is `complete` when every
56+
setup step succeeded; otherwise it is `incomplete` and `NVX_COPILOT_SETUP_FAILED`
57+
lists the failed step IDs from that workflow.
58+
- The session ends 59 minutes after it starts, setup included, on 4 vCPUs. Run the
59+
narrowest affected check first. Rebuild OpenVMM, which takes about 5 minutes and
60+
4 GB, only when the `openvmm` gitlink changed or the cached binary is missing,
61+
and guest artifacts only when their inputs changed. Leave `test-openvmm-unit`,
62+
`test-openvmm`, `build-guest --guest all`, `verify-guest-determinism`, and
63+
`benchmark` to CI.
64+
- Build trees are large. Check `df -h .` before a build, keep one OpenVMM build
65+
profile at a time, and delete trees you no longer need with `cargo clean` or
66+
`docker builder prune -af`. The setup disables incremental compilation and
67+
limits Cargo debug info to line tables to save space.
68+
- The agent firewall allows GitHub, crates.io, rustup, PyPI, npm, Docker Hub, MCR,
69+
and the Debian, Ubuntu, and Alpine package archives. It blocks other hosts, such
70+
as `cdn.kernel.org` and `cdimage.ubuntu.com`, even inside containers, so
71+
Docker-based `build-guest` cannot download Linux. Rebuild guest artifacts
72+
natively from the staged archives with
73+
`python3 scripts/nvx.py build-guest --native`, which takes about 5 minutes,
74+
adding `--guest ubuntu` for the Ubuntu guest. Do not retry blocked downloads;
75+
rely on CI for inputs that remain blocked.
76+
- With KVM access, run affected microVM scenarios with
77+
`python3 scripts/nvx.py test-microvm --backend kvm --scenario NAME`, passing only
78+
the `--processors` counts the change needs, and `aci_edge_sandboxes` backend
79+
changes with `python3 scripts/nvx.py test-aci-edge-sandboxes --backend kvm`.
80+
MSHV and WHP are never available there.
81+
4382
## Pull Requests And CI
4483

4584
- Ask whether a pull request should be Draft or Ready before creating it. Draft
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "Copilot Code Review Setup Steps"
2+
3+
# Copilot code review uses this file instead of copilot-setup-steps.yml.
4+
# Reviews read code without building it, so this environment only checks out
5+
# the repository and installs the gh-aw MCP server used by .github/mcp.json.
6+
on:
7+
workflow_dispatch:
8+
push:
9+
paths:
10+
- .github/workflows/copilot-code-review.yml
11+
12+
permissions:
13+
contents: read
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
# Copilot only recognizes a job with this exact name, even in this file.
21+
copilot-setup-steps:
22+
name: Copilot Code Review Setup Steps
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
30+
with:
31+
persist-credentials: false
32+
33+
- name: Install gh-aw extension
34+
uses: github/gh-aw-actions/setup-cli@5e508589e03a7757a7e05b26e834292f5445bfb6 # v0.88.7
35+
with:
36+
version: v0.88.7

0 commit comments

Comments
 (0)