]> git.corax.cc Git - foundry/commitdiff
spec: Add JSON Schemas for foundry IPC messages
authorMatthias Kruk <m@m10k.eu>
Sun, 4 Jul 2021 09:09:41 +0000 (18:09 +0900)
committerMatthias Kruk <m@m10k.eu>
Sun, 4 Jul 2021 09:09:41 +0000 (18:09 +0900)
To make foundry more flexible and scalable, the next release will
implement a messaging-based IPC approach using JSON objects.
This commit adds JSON schemas for all message types that will be
used by foundry.

spec/build.json [new file with mode: 0644]
spec/buildrequest.json [new file with mode: 0644]
spec/commit.json [new file with mode: 0644]
spec/dist.json [new file with mode: 0644]
spec/distrequest.json [new file with mode: 0644]
spec/merge.json [new file with mode: 0644]
spec/mergerequest.json [new file with mode: 0644]
spec/sign.json [new file with mode: 0644]
spec/signrequest.json [new file with mode: 0644]
spec/test.json [new file with mode: 0644]
spec/testrequest.json [new file with mode: 0644]

diff --git a/spec/build.json b/spec/build.json
new file mode 100644 (file)
index 0000000..bcbb1c7
--- /dev/null
@@ -0,0 +1,73 @@
+{
+    "$schema": "https://json-schema.org/draft/2020-12/schema",
+    "$id": "https://m10k.eu/foundry/build.json",
+    "title": "Foundry Build Notification",
+    "type": "object",
+
+    "properties": {
+       "tid": {
+           "description": "Unique identifier of this transaction",
+           "type": "string"
+       },
+
+       "repository": {
+           "description": "The repository that sources were taken from",
+           "type": "string",
+           "pattern": "^(https|file)://.*$"
+       },
+
+       "branch": {
+           "description": "The branch that the sources were taken from",
+           "type": "string"
+       },
+
+       "commit": {
+           "description": "The commit that uniquely identifies the built sources",
+           "type": "string",
+           "pattern": "^[0-9a-fA-F]+$"
+       },
+
+       "artifacts": {
+           "description": "The files resulting from the build",
+           "type": "array",
+           "items": {
+               "type": "#/$defs/artifact"
+           },
+           "minItems": 1
+       },
+
+       "logs": {
+           "description": "Logfiles from the build",
+           "type": "array",
+           "items": {
+               "type": "string"
+           },
+           "minItems": 1
+       }
+    },
+
+    "required": [
+       "repository",
+       "branch",
+       "commit",
+       "artifacts",
+       "logs"
+    ],
+
+    "$defs": {
+       "artifact": {
+           "type": "object",
+           "properties": {
+               "uri": {
+                   "description": "URI of the artifact",
+                   "type": "string"
+               },
+               "checksum": {
+                   "description": "Hex-encoded sha512 checksum of the artifact",
+                   "type": "string",
+                   "pattern": "^[0-9a-fA-F]{128}$"
+               }
+           }
+       }
+    }
+}
diff --git a/spec/buildrequest.json b/spec/buildrequest.json
new file mode 100644 (file)
index 0000000..b0b2c01
--- /dev/null
@@ -0,0 +1,36 @@
+{
+    "$schema": "https://json-schema.org/draft/2020-12/schema",
+    "$id":     "https://m10k.eu/foundry/msg.buildrequest.json",
+    "title":   "Foundry BuildRequest Message",
+    "type":    "object",
+
+    "properties": {
+       "tid": {
+           "description": "Unique identifier of this transaction",
+           "type": "string"
+       },
+
+       "repository": {
+           "description": "URL of the repository where the code to be built is located",
+           "type": "string"
+       },
+
+       "branch": {
+           "description": "Name of the branch that contains the commit to be built",
+           "type": "string"
+       },
+
+       "commit": {
+           "description": "Commit that is to be built",
+           "type": "string",
+           "pattern": "^[0-9a-fA-F]+$"
+       }
+    },
+
+    "required": [
+       "tid",
+       "repository",
+       "branch",
+       "commit"
+    ]
+}
diff --git a/spec/commit.json b/spec/commit.json
new file mode 100644 (file)
index 0000000..19acebb
--- /dev/null
@@ -0,0 +1,36 @@
+{
+    "$schema": "https://json-schema.org/draft/2020-12/schema",
+    "$id": "https://m10k.eu/foundry/commit.json",
+    "title": "Foundry Commit Notification",
+    "type": "object",
+
+    "properties": {
+       "repository": {
+           "description": "The URL of the repository the commit was detected at",
+           "type": "string",
+           "pattern": "^(https|file)://.*$"
+       },
+
+       "branch": {
+           "description": "The name of the branch the commit was detected on",
+           "type": "string"
+       },
+
+       "commit": {
+           "description": "The hash of the detected commit",
+           "type": "string",
+           "pattern": "^[0-9a-fA-F]+$"
+       },
+
+       "timestamp": {
+           "description": "The unix timestamp of the time the change was detected",
+           "type": "integer"
+       }
+    },
+
+    "required": [
+       "repository",
+       "commit",
+       "branch"
+    ]
+}
diff --git a/spec/dist.json b/spec/dist.json
new file mode 100644 (file)
index 0000000..fd53957
--- /dev/null
@@ -0,0 +1,51 @@
+{
+    "$schema": "https://json-schema.org/draft/2020-12/schema",
+    "$id":     "https://m10k.eu/foundry/msg.dist.json",
+    "title":   "Foundry Dist Notification",
+    "type":    "object",
+
+    "properties": {
+       "tid": {
+           "description": "Unique identifier of this transaction",
+           "type": "string"
+       },
+
+       "artifacts": {
+           "description": "Artifacts that were published",
+           "type": "array",
+           "items": {
+               "type": "#/$defs/artifact"
+           }
+           "minItems": 1
+       },
+
+       "repository": {
+           "description": "The repository where the artifacts were published",
+           "type": "string"
+       }
+    },
+
+    "required": [
+       "tid",
+       "artifacts",
+       "repository"
+    ],
+
+    "$defs": {
+       "artifact": {
+           "type": "object",
+           "properties": {
+               "uri": {
+                   "description": "URI of the artifact",
+                   "type": "string"
+               },
+
+               "checksum": {
+                   "description": "hex-encoded sha512 hash of the artifact",
+                   "type": "string",
+                   "pattern": "^[0-9a-fA-F]{128}$"
+               }
+           }
+       }
+    }
+}
diff --git a/spec/distrequest.json b/spec/distrequest.json
new file mode 100644 (file)
index 0000000..7013a0e
--- /dev/null
@@ -0,0 +1,45 @@
+{
+    "$schema": "https://json-schema.org/draft/2020-12/schema",
+    "$id": "https://m10k.eu/foundry/msg.distrequest.json",
+    "title": "Foundry DistRequest Message",
+    "type": "object",
+
+    "properties": {
+       "tid": {
+           "description": "Unique identifier of this transaction",
+           "type": "string"
+       },
+
+       "repository": {
+           "description": "URL of the source tree the artifacts were built from",
+           "type": "string"
+       },
+
+       "branch": {
+           "description": "Name of the branch the artifacts were built from",
+           "type": "string"
+       },
+
+       "commit": {
+           "description": "Commit the artifacts were built from",
+           "type": "string"
+       },
+
+       "artifacts": {
+           "description": "List of artifacts built from the source tree",
+           "type": "array",
+           "items": {
+               "type": "string"
+           },
+           "minItems": 1
+       }
+    },
+
+    "required": [
+       "tid",
+       "repository",
+       "branch",
+       "commit",
+       "artifacts"
+    ]
+}
diff --git a/spec/merge.json b/spec/merge.json
new file mode 100644 (file)
index 0000000..5f9b67e
--- /dev/null
@@ -0,0 +1,47 @@
+{
+    "$schema": "https://json-schema.org/draft/2020-12/schema",
+    "$id": "https://m10k.eu/foundry/msg.merge.json",
+    "title": "Foundry Merge Notification",
+    "type": "object",
+
+    "properties": {
+       "tid": {
+           "description": "Unique identifier of this transaction",
+           "type": "string"
+       },
+
+       "repository": {
+           "description": "URL of the repository where the merge was done",
+           "type": "string"
+       },
+
+       "source-branch": {
+           "description": "Name of the branch that was merged",
+           "type": "string"
+       },
+
+       "destination-branch": {
+           "description": "Name of the branch that was merged into",
+           "type": "string"
+       },
+
+       "status": {
+           "description": "Indicates merge success (zero) or failure (non-zero)",
+           "type": "integer"
+       },
+
+       "log": {
+           "description": "URI of the merge log",
+           "type": "string"
+       }
+    },
+
+    "required": [
+       "tid",
+       "repository",
+       "source-branch",
+       "destination-branch",
+       "status",
+       "log"
+    ]
+}
diff --git a/spec/mergerequest.json b/spec/mergerequest.json
new file mode 100644 (file)
index 0000000..378e070
--- /dev/null
@@ -0,0 +1,35 @@
+{
+    "$schema": "https://json-schema.org/draft/2020-12/schema",
+    "$id":     "https://m10k.eu/foundry/msg.mergerequest.json",
+    "title":   "Foundry MergeRequst Message",
+    "type":    "object",
+
+    "properties": {
+       "tid": {
+           "description": "Unique identifier of this transaction",
+           "type": "string"
+       },
+
+       "repository": {
+           "description": "URL of the repository containing the code to be tested",
+           "type": "string"
+       },
+
+       "source-branch": {
+           "description": "Name of the source for the merge operation",
+           "type": "string"
+       },
+
+       "destination-branch": {
+           "description": "Name of the destination for the merge operation",
+           "type": "string"
+       }
+    },
+
+    "required": [
+       "tid",
+       "repository",
+       "source-branch",
+       "destination-branch"
+    ]
+}
diff --git a/spec/sign.json b/spec/sign.json
new file mode 100644 (file)
index 0000000..b141280
--- /dev/null
@@ -0,0 +1,51 @@
+{
+    "$schema": "https://json-schema.org/draft/2020-12/schema",
+    "$id":     "https://m10k.eu/foundry/msg.sign.json",
+    "title":   "Foundry Sign Notification",
+    "type":    "object",
+
+    "properties": {
+       "tid": {
+           "description": "Unique identifier of this transaction",
+           "type": "string"
+       },
+
+       "artifacts": {
+           "description": "The files that have been signed",
+           "type": "array",
+           "items": {
+               "type": "#/$defs/artifact"
+           },
+           "minItems": 1
+       },
+
+       "key": {
+           "description": "The key that was used for signing",
+           "type": "string"
+       }
+    },
+
+    "required": [
+       "tid",
+       "artifacts",
+       "key"
+    ],
+
+    "$defs": {
+       "artifact": {
+           "type": "object",
+           "properties": {
+               "uri": {
+                   "description": "URI of the artifact",
+                   "type": "string"
+               },
+
+               "checksum": {
+                   "description": "hex-encoded sha512 hash of the artifact",
+                   "type": "string",
+                   "pattern": "^[0-9a-fA-F]{128}$"
+               }
+           }
+       }
+    }
+}
diff --git a/spec/signrequest.json b/spec/signrequest.json
new file mode 100644 (file)
index 0000000..440218a
--- /dev/null
@@ -0,0 +1,50 @@
+{
+    "$schema": "https://json-schema.org/draft/2020-12/schema",
+    "$id":     "https://m10k.eu/foundry/msg.signrequest.json",
+    "title":   "Foundry SignRequest Message",
+    "type":    "object",
+
+    "properties": {
+       "tid": {
+           "description": "Unique identifier of this transaction",
+           "type": "string"
+       },
+
+       "artifacts": {
+           "description": "The artifacts to be signed",
+           "type": "array",
+           "items": {
+               "type": "#/$defs/artifact"
+           },
+           "minItems": 1
+       }
+    },
+
+    "required": [
+       "tid",
+       "artifacts"
+    ],
+
+    "$defs": {
+       "artifact": {
+           "type": "object",
+
+           "properties": {
+               "uri": {
+                   "description": "URI of the artifact",
+                   "type": "string"
+               },
+               "checksum": {
+                   "description": "hex-encoded sha512 checksum of the artifact",
+                   "type": "string",
+                   "pattern": "^[0-9a-fA-F]{128}$"
+               }
+           },
+
+           "required": [
+               "uri",
+               "checksum"
+           }
+       }
+    }
+}
diff --git a/spec/test.json b/spec/test.json
new file mode 100644 (file)
index 0000000..d6ad14e
--- /dev/null
@@ -0,0 +1,51 @@
+{
+    "$schema": "https://json-schema.org/draft/2020-12/schema",
+    "$id": "https://m10k.eu/foundry/msg.test.json",
+    "title": "Foundry Test Notification",
+    "type": "object",
+
+    "properties": {
+       "tid": {
+           "description": "Unique identifier of this transaction",
+           "type": "string"
+       },
+
+       "repository": {
+           "description": "URL of the source tree that was tested",
+           "type": "string"
+       },
+
+       "branch": {
+           "description": "Name of the branch that was tested",
+           "type": "string"
+       },
+
+       "commit": {
+           "description": "The commit that was tested",
+           "type": "string"
+       },
+
+       "result": {
+           "description": "Result of the test (zero = success, non-zero = failure)",
+           "type": "integer"
+       },
+
+       "logs": {
+           "description": "Log files generated during the test",
+           "type": "array",
+           "items": {
+               "type": "string"
+           },
+           "minItems": 1
+       }
+    },
+
+    "required": [
+       "tid",
+       "repository",
+       "branch",
+       "commit",
+       "result",
+       "logs"
+    ]
+}
diff --git a/spec/testrequest.json b/spec/testrequest.json
new file mode 100644 (file)
index 0000000..88a2a3a
--- /dev/null
@@ -0,0 +1,36 @@
+{
+    "$schema": "https://json-schema.org/draft/2020-12/schema",
+    "$id": "https://m10k.eu/foundry/msg.testrequest.json",
+    "title": "Foundry TestRequest Message",
+    "type": "object",
+
+    "properties": {
+       "tid": {
+           "description": "Unique identifier of this transaction",
+           "type": "string"
+       },
+
+       "repository": {
+           "description": "URL of the repository containing the code to be tested",
+           "type": "string"
+       },
+
+       "branch": {
+           "description": "Name of the branch containing the commit to be tested",
+           "type": "string"
+       },
+
+       "commit": {
+           "description": "Commit that is to be tested",
+           "type": "string",
+           "pattern": "^[0-9a-fA-F]+$"
+       }
+    },
+
+    "required": [
+       "tid",
+       "repository",
+       "branch",
+       "commit"
+    ]
+}