-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds API Specification for DT Runner and updates shell scripts
- Add OpenAPI specification for DT Runner - Updates git-hooks to check against runner as well - Adds more yarn test commands to runner
- Loading branch information
1 parent
d31da4a
commit 2fe0344
Showing
6 changed files
with
152 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
#!/usr/bin/env sh | ||
|
||
TOP_DIR="$(pwd)" | ||
export TOP_DIR | ||
|
||
if git diff --cached --name-only | grep "^client/" >/dev/null; then | ||
cd client || exit | ||
yarn install | ||
yarn format && yarn syntax | ||
else | ||
printf "No changes in the client directory. Skipping pre-commit hook." | ||
printf "No changes in the client directory. Skipping pre-commit hook.\n\n" | ||
fi | ||
|
||
cd "$TOP_DIR" || exit | ||
if git diff --cached --name-only | grep "^servers/execution/runner/" >/dev/null; then | ||
cd "servers/execution/runner" || exit | ||
yarn install | ||
yarn format && yarn syntax | ||
else | ||
printf "No changes in the servers/execution/runner directory. Skipping pre-commit hook.\n\n" | ||
fi |
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,11 +1,22 @@ | ||
#!/usr/bin/env sh | ||
|
||
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) | ||
TOP_DIR="$(pwd)" | ||
export TOP_DIR | ||
|
||
if git diff --name-only origin/"$BRANCH_NAME"...HEAD | grep "^client/" >/dev/null; then | ||
cd client || exit | ||
yarn install | ||
yarn jest . --coverage=false | ||
else | ||
echo "No changes in the client directory. Skipping pre-push hook." | ||
printf "No changes in the client directory. Skipping pre-push hook.\n\n" | ||
fi | ||
|
||
cd "$TOP_DIR" || exit | ||
if git diff --name-only origin/"$BRANCH_NAME"...HEAD | grep "^servers/execution/runner/" >/dev/null; then | ||
cd "servers/execution/runner" || exit | ||
yarn install | ||
yarn test:nocov | ||
else | ||
printf "No changes in the servers/execution/runner/ directory. Skipping pre-push hook.\n\n" | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
openapi: '3.0.2' | ||
info: | ||
title: Digital Twin Runner API | ||
version: '0.0.1' | ||
contact: | ||
name: Prasad Talasila | ||
url: https://github.com/INTO-CPS-Association/DTaaS | ||
license: | ||
name: The INTO-CPS Association | ||
url: https://into-cps.org | ||
description: | | ||
The Digital Twin (DT) Runner is a component of Digital Twin as a Service (DTaaS) software. The DT Runner component is responsible for managing the execution of one digital twin. | ||
This document describes the API for the DT Runner. | ||
servers: | ||
- url: https://api.server.test/v0.0.1 | ||
paths: | ||
/controller/status: | ||
get: | ||
description: 'Check the status of the Digital Twin Runner. This is a heartbeat check.' | ||
responses: | ||
'200': | ||
description: Aliv-e | ||
'404': | ||
description: 'Service is unavailable' | ||
|
||
/controller/logs: | ||
get: | ||
description: 'Fetch the logs of Digital Twin Runner.' | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
example: | | ||
'[20:20:10] Request received' | ||
'404': | ||
description: 'Service is unavailable' | ||
|
||
/controller/terminate: | ||
get: | ||
description: 'Stop the Digital Twin managed by Digital Twin Runner and exit.' | ||
responses: | ||
'200': | ||
description: Shutting down | ||
'404': | ||
description: 'Service is unavailable' | ||
|
||
/dt/lifecycle/phase/list: | ||
get: | ||
description: | | ||
'Fetch the list of lifecycle phases supported by the digital twin. These lifecycles are given as configuration information to the Digital Twin Runner.' | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/Phases" | ||
|
||
/dt/lifecycle/phase/{phaseName}: | ||
post: | ||
description: | | ||
'Change to the lifecycle phase indicated in the request URL' | ||
parameters: | ||
- in: path | ||
name: phaseName | ||
schema: | ||
type: string | ||
required: true | ||
description: Phase name of digital twin | ||
responses: | ||
'200': | ||
description: OK | ||
|
||
/dt/lifecycle/phase/history: | ||
get: | ||
description: | | ||
'Get the history of phase change requests made to the digital twin.' | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
type: string | ||
example: ["execute", "evolve"] | ||
|
||
components: | ||
schemas: | ||
Phase: | ||
type: object | ||
properties: | ||
phaseName: | ||
type: string | ||
example: execute | ||
description: | ||
type: string | ||
example: "execute the digital twin" | ||
Phases: | ||
type: array | ||
items: | ||
$ref: "#/components/schemas/Phase" | ||
example: | | ||
[{phaseName: configure, description: "set configuration of digital twin"}, {phaseName: execute, description: "execute the digital twin"}] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ build/ | |
dist/ | ||
node_modules/ | ||
script/ | ||
src/types.ts | ||
src/types.ts |