-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/image-and-job-status
- Loading branch information
Showing
25 changed files
with
271 additions
and
105 deletions.
There are no files selected for viewing
This file contains 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
6 changes: 4 additions & 2 deletions
6
orchestrator/packages/api/src/__mocks__/grader-image-build-request.ts
This file contains 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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import { GraderImageBuildRequest } from "@codegrade-orca/common"; | ||
|
||
export const defaultGraderImageBuildRequest: GraderImageBuildRequest = { | ||
dockerfileContents: `FROM hello-world:latest`, | ||
dockerfileSHASum: "generated-sha-sum", | ||
dockerfile_contents: `FROM hello-world:latest`, | ||
dockerfile_sha_sum: "generated-sha-sum", | ||
response_url: "http://example.com/response", | ||
build_key: "{\"grader_id\": 1}" | ||
}; |
This file contains 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 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
27 changes: 25 additions & 2 deletions
27
orchestrator/packages/common/src/types/image-build-service.ts
This file contains 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 |
---|---|---|
@@ -1,4 +1,27 @@ | ||
export interface GraderImageBuildResult { | ||
was_successful: boolean, | ||
logs: Array<ImageBuildLog> | ||
} | ||
|
||
export type ImageBuildStep = "Write request contents to Dockerfile." | | ||
"Run docker build on Dockerfile." | | ||
"Save image to .tgz file." | | ||
"Remove Dockerfile."; | ||
|
||
export interface ImageBuildLog { | ||
step: ImageBuildStep, | ||
output?: string, | ||
error?: string | ||
} | ||
|
||
export const isImageBuildResult = (o: unknown): o is GraderImageBuildResult => { | ||
if (typeof o !== "object" || o === null) return false; | ||
return Object.keys(o).length == 2 && ["was_successful", "logs"].every((k) => k in o); | ||
} | ||
|
||
export interface GraderImageBuildRequest { | ||
dockerfileContents: string; | ||
dockerfileSHASum: string; | ||
dockerfile_contents: string, | ||
dockerfile_sha_sum: string, | ||
response_url: string, | ||
build_key: string, | ||
} |
This file contains 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./grading-queue"; | ||
export * from "./image-build-service"; | ||
export * from "./job-result"; |
This file contains 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,14 @@ | ||
export interface GradingJobResult { | ||
shell_responses: Array<GradingScriptCommandResponse>, | ||
errors: Array<string>, | ||
output?: string | ||
} | ||
|
||
interface GradingScriptCommandResponse { | ||
cmd: string | Array<string>, | ||
stdout: string, | ||
stderr: string, | ||
did_timeout: boolean, | ||
is_error: boolean, | ||
status_code: number | ||
} |
6 changes: 4 additions & 2 deletions
6
orchestrator/packages/common/src/validations/__mocks__/grader-image-build-request.ts
This file contains 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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import { GraderImageBuildRequest } from "../../types/image-build-service"; | ||
|
||
export const defaultGraderImageBuildRequest: GraderImageBuildRequest = { | ||
dockerfileContents: `FROM hello-world:latest`, | ||
dockerfileSHASum: "generated-sha-sum", | ||
dockerfile_contents: `FROM hello-world:latest`, | ||
dockerfile_sha_sum: "generated-sha-sum", | ||
response_url: "http://example.com/response", | ||
build_key: "{\"grader_id\": 1}" | ||
}; |
This file contains 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 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 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 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 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 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 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
11 changes: 6 additions & 5 deletions
11
orchestrator/packages/db/src/server-operations/enqueue-image-build.ts
This file contains 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 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 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.