diff --git a/.github/workflows/e2e-standard-profile.yaml b/.github/workflows/e2e-standard-profile.yaml index dbb544683b2..db80cccca6c 100644 --- a/.github/workflows/e2e-standard-profile.yaml +++ b/.github/workflows/e2e-standard-profile.yaml @@ -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: diff --git a/test/e2e/support/standard-profile-workflow-boundary.test.ts b/test/e2e/support/standard-profile-workflow-boundary.test.ts index 74e32375bd8..c888bbe20ca 100644 --- a/test/e2e/support/standard-profile-workflow-boundary.test.ts +++ b/test/e2e/support/standard-profile-workflow-boundary.test.ts @@ -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> } } }; + 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>, 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> } } }; + 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" }, diff --git a/tools/e2e/standard-profile-workflow-boundary.mts b/tools/e2e/standard-profile-workflow-boundary.mts index c3799cf8734..7f21af6e141 100644 --- a/tools/e2e/standard-profile-workflow-boundary.mts +++ b/tools/e2e/standard-profile-workflow-boundary.mts @@ -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", @@ -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 != '' }}" || diff --git a/tools/e2e/workflow-boundary-policy.mts b/tools/e2e/workflow-boundary-policy.mts index 8c16ff97ef3..3968090669e 100644 --- a/tools/e2e/workflow-boundary-policy.mts +++ b/tools/e2e/workflow-boundary-policy.mts @@ -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",