Skip to content
Open
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
3 changes: 3 additions & 0 deletions .github/workflows/e2e-standard-profile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,9 @@ jobs:
with:
packages: ${{ inputs.host_packages }}

- name: Set up the pinned v1 protoc
uses: NVIDIA/NemoClaw/.github/actions/setup-v1-protoc@c474038df67fcb22182298ac9a696c81e63f0ee2

- name: Download reviewed OpenShell SDK archive
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
Expand Down
66 changes: 66 additions & 0 deletions test/e2e/support/standard-profile-workflow-boundary.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,72 @@ describe("standard E2E execution profile", () => {
}
});

it.each([
{ field: "uses", value: "./.github/actions/setup-v1-protoc" },
{ field: "uses", value: "NVIDIA/NemoClaw/.github/actions/setup-v1-protoc@main" },
{
field: "uses",
value:
"NVIDIA/NemoClaw/.github/actions/setup-v1-protoc@0000000000000000000000000000000000000000",
},
{ field: "if", value: "${{ false }}" },
{ field: "env", value: { BASH_ENV: "scripts/unreviewed.sh" } },
{ field: "with", value: { version: "latest" } },
{ field: "continue-on-error", value: true },
{ field: "run", value: "bash .github/actions/setup-v1-protoc/install.sh" },
])("rejects an unreviewed protoc setup: $field $value", ({ field, value }) => {
const profile = YAML.parse(
fs.readFileSync(path.join(REPO_ROOT, ".github/workflows/e2e-standard-profile.yaml"), "utf8"),
) as { jobs: { run: { steps: Array<Record<string, unknown>> } } };
const steps = profile.jobs.run.steps;
const index = steps.findIndex((step) => step.name === "Set up the pinned v1 protoc");
steps[index][field] = value;
const directory = fs.mkdtempSync(path.join(os.tmpdir(), "e2e-protoc-boundary-"));
try {
const profilePath = path.join(directory, "profile.yaml");
fs.writeFileSync(profilePath, YAML.stringify(profile));
expect(validateStandardProfileWorkflowBoundary(readWorkflow(), profilePath)).toContain(
"standard E2E profile must install the pinned v1 protoc with the reviewed action",
);
} finally {
fs.rmSync(directory, { recursive: true, force: true });
}
});

it.each<[string, (steps: Array<Record<string, unknown>>, index: number) => void]>([
[
"missing",
(steps, index) => {
steps.splice(index, 1);
},
],
[
"late",
(steps, index) => {
steps.push(...steps.splice(index, 1));
},
],
])("rejects %s protoc setup", (_scenario, mutate) => {
const profile = YAML.parse(
fs.readFileSync(path.join(REPO_ROOT, ".github/workflows/e2e-standard-profile.yaml"), "utf8"),
) as { jobs: { run: { steps: Array<Record<string, unknown>> } } };
const steps = profile.jobs.run.steps;
mutate(
steps,
steps.findIndex((step) => step.name === "Set up the pinned v1 protoc"),
);
const directory = fs.mkdtempSync(path.join(os.tmpdir(), "e2e-protoc-order-"));
try {
const profilePath = path.join(directory, "profile.yaml");
fs.writeFileSync(profilePath, YAML.stringify(profile));
expect(validateStandardProfileWorkflowBoundary(readWorkflow(), profilePath)).toContain(
"standard E2E profile must keep its reviewed step set and order",
);
} finally {
fs.rmSync(directory, { recursive: true, force: true });
}
});

it.each([
{ field: "uses", value: "actions/setup-python@v7" },
{ field: "if", value: "true" },
Expand Down
11 changes: 11 additions & 0 deletions tools/e2e/standard-profile-workflow-boundary.mts
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ function validateProfileWorkflow(errors: string[], profile: WorkflowRecord): voi
undefined,
"Authenticate to Docker Hub",
"Install target host dependencies",
"Set up the pinned v1 protoc",
"Download reviewed OpenShell SDK archive",
"Prepare E2E workspace",
"Install reviewed OpenShell SDK archive without package credentials",
Expand Down Expand Up @@ -529,6 +530,16 @@ function validateProfileWorkflow(errors: string[], profile: WorkflowRecord): voi

const prepare = requireStep(errors, workflowSteps, "Prepare E2E workspace");

const protoc = requireStep(errors, workflowSteps, "Set up the pinned v1 protoc");
if (
!isDeepStrictEqual(protoc, {
name: "Set up the pinned v1 protoc",
uses: E2E_ACTION_PROVENANCE.v1Protoc.reference,
})
) {
errors.push("standard E2E profile must install the pinned v1 protoc with the reviewed action");
}

const hostDependencies = requireStep(errors, workflowSteps, "Install target host dependencies");
if (
hostDependencies?.if !== "${{ inputs.host_packages != '' }}" ||
Expand Down
4 changes: 4 additions & 0 deletions tools/e2e/workflow-boundary-policy.mts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ export const E2E_ACTION_PROVENANCE = {
actionSha256: "8b7bf4bdb793ddd27aa9bab2e38157e91f0401148f6ba684acb516fc75e8d367",
scriptSha256: "4e5ce850c28f309b97695d61e11bcf1f154eae2b1d58c9697a3f49631c76abb4",
},
v1Protoc: {
reference:
"NVIDIA/NemoClaw/.github/actions/setup-v1-protoc@c474038df67fcb22182298ac9a696c81e63f0ee2",
},
hostDependencies: {
reference:
"NVIDIA/NemoClaw/.github/actions/host-dependency-setup@e85857e2a7bfb2af01241ecbce5947ee774c1280",
Expand Down
Loading