-
Notifications
You must be signed in to change notification settings - Fork 3k
ci(e2e): select post-reboot recovery for status #7828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
833ae4b
ci(e2e): select post-reboot recovery for status
jyaunches 627840b
merge(main): refresh trusted E2E controller
jyaunches 713676e
fix(e2e): validate trusted target case branches
jyaunches 1f2b89e
fix(e2e): reject duplicate trusted target cases
jyaunches 3576f30
fix(e2e): validate complete trusted target case
jyaunches e7bb0df
fix(e2e): bind trusted matrix output
jyaunches 1be699e
test(e2e): prove trusted matrix override rejection
jyaunches 0ba0027
merge(main): refresh trusted E2E controller
jyaunches f437bc0
merge: resolve conflicts with main
github-actions[bot] b70b864
merge(main): refresh trusted E2E controller
jyaunches File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
test/e2e/support/trusted-target-routing-workflow-boundary.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import { describe, expect, it } from "vitest"; | ||
| import { validateE2eWorkflow } from "../../../tools/e2e/workflow-boundary.mts"; | ||
| import { readWorkflow } from "../../helpers/e2e-workflow-contract"; | ||
| import { requireFixture } from "./require-fixture"; | ||
|
|
||
| type ControllerWorkflow = { | ||
| jobs: Record<string, { steps: Array<{ id?: string; run?: string }> }>; | ||
| }; | ||
|
|
||
| const EXPECTED_ERROR = "trusted controller matrix must pin typed target runner to ubuntu-latest"; | ||
| const TRUSTED_MAPPING = | ||
| '{"id":"ubuntu-repo-docker-post-reboot-recovery","runner":"ubuntu-latest","label":"ubuntu-repo-docker-post-reboot-recovery"}'; | ||
|
|
||
| function fixture() { | ||
| const workflow = readWorkflow() as ControllerWorkflow; | ||
| const controllerMatrix = workflow.jobs["generate-matrix"]!.steps.find( | ||
| (step) => step.id === "controller_matrix", | ||
| )!; | ||
| return { controllerMatrix, workflow }; | ||
| } | ||
|
|
||
| describe("trusted E2E target routing boundary (#7824)", () => { | ||
| it("rejects trusted target mappings outside their exact case branch", () => { | ||
| const { controllerMatrix, workflow } = fixture(); | ||
| expect(validateE2eWorkflow(workflow)).not.toContain(EXPECTED_ERROR); | ||
| requireFixture( | ||
| controllerMatrix.run?.includes(TRUSTED_MAPPING), | ||
| "trusted target fixture mapping is missing", | ||
| ); | ||
|
|
||
| controllerMatrix.run = controllerMatrix | ||
| .run!.replace(TRUSTED_MAPPING, TRUSTED_MAPPING.replace("ubuntu-latest", "self-hosted")) | ||
| .concat(`\n# ${TRUSTED_MAPPING}\n`); | ||
|
|
||
| expect(validateE2eWorkflow(workflow)).toContain(EXPECTED_ERROR); | ||
| }); | ||
|
|
||
| it("rejects a dead approved case block before unsafe target routing", () => { | ||
| const { controllerMatrix, workflow } = fixture(); | ||
| const run = controllerMatrix.run!; | ||
| const caseStart = run.indexOf('case "${TARGETS}" in'); | ||
| const caseEnd = run.indexOf("\nesac", caseStart) + "\nesac".length; | ||
| requireFixture(caseStart >= 0, "trusted target fixture case is missing"); | ||
| requireFixture(caseEnd > caseStart, "trusted target fixture case terminator is missing"); | ||
| const deadApprovedCase = run.slice(caseStart, caseEnd); | ||
| const unsafeRouting = run.replace( | ||
| TRUSTED_MAPPING, | ||
| TRUSTED_MAPPING.replace("ubuntu-latest", "self-hosted"), | ||
| ); | ||
| controllerMatrix.run = `${deadApprovedCase}\n${unsafeRouting}`; | ||
|
|
||
| expect(validateE2eWorkflow(workflow)).toContain(EXPECTED_ERROR); | ||
| }); | ||
|
|
||
| it("rejects an executable wildcard before approved target routing", () => { | ||
| const { controllerMatrix, workflow } = fixture(); | ||
| const caseStart = 'case "${TARGETS}" in'; | ||
| const unsafeWildcard = [ | ||
| "*)", | ||
| 'matrix=\'[{"id":"untrusted","runner":"self-hosted","label":"untrusted"}]\'', | ||
| ";;", | ||
| ].join("\n"); | ||
| requireFixture( | ||
| controllerMatrix.run?.includes(caseStart), | ||
| "trusted target fixture case is missing", | ||
| ); | ||
|
|
||
| controllerMatrix.run = controllerMatrix.run!.replace( | ||
| caseStart, | ||
| `${caseStart}\n${unsafeWildcard}`, | ||
| ); | ||
|
|
||
| expect(validateE2eWorkflow(workflow)).toContain(EXPECTED_ERROR); | ||
| }); | ||
|
|
||
| it("rejects a matrix override after approved target routing", () => { | ||
| const { controllerMatrix, workflow } = fixture(); | ||
| expect(validateE2eWorkflow(workflow)).not.toContain(EXPECTED_ERROR); | ||
| const output = `printf 'matrix=%s\\n' "\${matrix}" >> "\${GITHUB_OUTPUT}"`; | ||
| requireFixture( | ||
| controllerMatrix.run?.includes(output), | ||
| "trusted target fixture output is missing", | ||
| ); | ||
| const unsafeOverride = | ||
| 'matrix=\'[{"id":"untrusted","runner":"self-hosted","label":"untrusted"}]\''; | ||
| controllerMatrix.run = controllerMatrix.run!.replace(output, `${unsafeOverride}\n${output}`); | ||
|
|
||
| expect(validateE2eWorkflow(workflow)).toContain(EXPECTED_ERROR); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.