-
Notifications
You must be signed in to change notification settings - Fork 30
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
Added schema and contracts for blueprints. #28
base: new-contract-schema
Are you sure you want to change the base?
Changes from all commits
648fdda
a2a222a
d89eaf8
b4f10f6
11cf69c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"slug": "device-instructions", | ||
"type": "sw.blueprint", | ||
"version": "1", | ||
"componentVersion": "1", | ||
"aliases": [], | ||
"tags": [], | ||
|
||
"data": { | ||
"selector": { | ||
"sw.os": "1", | ||
"sw.image-writer": "1", | ||
"hw.device-type": "1", | ||
"sw.platform": "1" | ||
}, | ||
"output": { | ||
"filename": "README.txt", | ||
"type": "doc.instructions.device", | ||
"slug": "{{children.sw.platform.slug}}-{{children.hw.device-type.slug}}:{{children.sw.os.slug}}-{{children.sw.os.version}}:{{children.sw.image-writer.slug}}", | ||
"template": [ | ||
{ | ||
"name": "instructions", | ||
"data": "1. {{import partial=\"download\" combination=\"sw.os\"}} 2. {{import partial=\"download\" combination=\"sw.image-writer\"}}. {{import partial=\"flash\" combination=\"sw.image-writer+hw.device-type\"}}. 3. {{import partial=\"insert-install-media\" combination=\"hw.device-type\"}}. {{import partial=\"prepare-network\" combination=\"hw.device-type\"}}. {{import partial=\"boot-external\" combination=\"hw.device-type\"}} {{#hw.device-type.storage.internal}} 4. The device should appear on you dashboard in a configuring state. {{import partial=\"description-of-internal-process\" combination=\"sw.image-writer\"}}. {{import partial=\"visual-appearance-when-off\" combination=\"hw.device-type\"}} 5. {{import partial=\"remove-install-media\" combination=\"hw.device-type\"}}. {{import partial=\"boot-internal\" combination=\"hw.device-type\"}} {{/hw.device-type.storage.internal}} 6. Your device should appear here in the IDLE state in 30 seconds or so. Have fun! **Troubleshooting:** If, upon boot, the device LED is blinking in groups of four, it is an indication that the device cannot connect to the internet. Please ensure the network adapter is functional. {{#compare hw.device-type.media.installation \"!==\" \"dfu\"}} **Pro tip:** You can repeat the initialisation steps for any amount of {{hw.device-type.name}}'s you have available, using the same {{hw.device-type.media.installation}}. {{/compare}}" | ||
} | ||
] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"slug": "docker-images-base", | ||
"type": "sw.blueprint", | ||
"version": "1", | ||
"componentVersion": "1", | ||
"aliases": [], | ||
"tags": [], | ||
|
||
"data": { | ||
"selector": { | ||
"sw.os": "1", | ||
"sw.arch": "1", | ||
"sw.blob": "1+" | ||
}, | ||
"output": { | ||
"filename": "Dockerfile", | ||
"type": "sw.docker-image.base", | ||
"slug": "{{children.sw.arch.slug}}-{{children.sw.os.slug}}:{{children.sw.os.version}}", | ||
"requires": [ | ||
{ | ||
"type": "hw.device-type", | ||
"arch": "{{children.sw.arch.slug}}" | ||
} | ||
], | ||
"template": [ | ||
{ | ||
"name": "docker-images", | ||
"data": "{{import partial=\"from\" combination=\"sw.os+sw.arch\"}}\nLABEL io.resin.architecture=\"{{sw.arch.slug}}\"\n{{import partial=\"os-config\" combination=\"sw.os+sw.arch\"}}\n{{#sw.blob.qemu}} {{import partial=\"qemu\" combination=\"sw.os+sw.arch\"}} {{/sw.blob.qemu}}\n{{import partial=\"base-dependencies\" combination=\"sw.os+sw.arch\"}}\nCOPY {{sw.blob.resin-xbuild.assets.bin.main}} /usr/bin/\nRUN ln -s {{sw.blob.resin-xbuild.assets.bin.main}} /usr/bin/cross-build-start \\\n && ln -s {{sw.blob.resin-xbuild.assets.bin.main}} /usr/bin/cross-build-end\n\nENV TINI_VERSION {{sw.blob.tini.version}}\nRUN chmod +x {{sw.blob.tini.assets.bin.main}} \\\n && mv {{sw.blob.tini.assets.bin.main}} /sbin/tini\n\n{{import partial=\"init-system\" combination=\"sw.os+sw.arch\"}}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ugh :P Lets aim to convert contracts to YAML sometime soon :P |
||
} | ||
] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"slug": "docker-images-device-type", | ||
"type": "sw.blueprint", | ||
"version": "1", | ||
"componentVersion": "1", | ||
"aliases": [], | ||
"tags": [], | ||
|
||
"data": { | ||
"selector": { | ||
"hw.device-type": "1", | ||
"sw.docker-image.base": "1" | ||
}, | ||
"output": { | ||
"filename": "Dockerfile", | ||
"type": "sw.docker-image.device-type", | ||
"slug": "{{children.hw.device-type.slug}}-{{children.sw.docker-image.base.children.sw.os.slug}}:{{children.hw.device-type.version}}-{{children.sw.docker-image.base.children.sw.os.version}}", | ||
"template": [ | ||
{ | ||
"name": "docker-images", | ||
"data": "FROM resin/{{sw.docker-image.base.slug}}\nLABEL io.resin.device-type=\"{{hw.device-type.slug}}\"\n{{import partial=\"distro-config\" combination=\"sw.os+hw.device-type\"}}\n{{import partial=\"dependencies\" combination=\"sw.os+hw.device-type\"}}" | ||
} | ||
] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"$id": "sw.blueprint.json", | ||
"type": "object", | ||
"definitions": {}, | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"properties": { | ||
"data": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
"type": "object", | ||
"properties": { | ||
"selector": { | ||
"$id": "/properties/selector", | ||
"type": "object", | ||
"patternProperties": { | ||
"^.*$": { | ||
"anyOf": [ | ||
{ | ||
"type": "string", | ||
}, | ||
{ | ||
"type": "array", | ||
"additionalItems": false, | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"output": { | ||
"$id": "/properties/output", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"allOf": [ | ||
{ | ||
"$ref": "contract.json#/definitions/partialContract" | ||
}, | ||
{ | ||
"properties": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you're missing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Which I took to intend that output may contain any top-level field that appears in a contract, should it be restricted to a subset of those props? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, you're right. Nevermind |
||
"filename": { | ||
"$id": "/properties/output/properties/filename", | ||
"type": "string", | ||
"pattern": "^(\\.\\.\/|[a-zA-Z0-9_/\\\\-])*\\.[a-zA-Z0-9]+$" | ||
}, | ||
"template": { | ||
"$id": "/properties/output/properties/template", | ||
"type": "array", | ||
"additionalItems": false, | ||
"items": { | ||
"$id": "/properties/output/properties/template/items", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you mark these properties as required? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
"name": { | ||
"$id": "/properties/output/properties/template/items/properties/name", | ||
"type": "string" | ||
}, | ||
"data": { | ||
"$id": "/properties/output/properties/template/items/properties/data", | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ "name", "data" ] | ||
} | ||
} | ||
}, | ||
"required": [ "properties", "template" ] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for this blank line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly to split up the generic contract props with the ones that are specific to the blueprint type, we can drop it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guys, could you point me to some description of these general properties? Specifically, slug, type, aliases, and tags. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@roman-mazur
slug
: A human readable unique identifier. Both the id and the slug are considered to be primary keys of an elementtype
: The type of entity a contract defines, such asuser
,message
,repository
, etc. The properties you must define in the contract depend on the type of entityaliases
: Alternative slugs for the element. You can fetch an element by slug using any of the aliases, but the one inslug
is the canonical one. For example, if you describe the raspberry pi 3, its canonical slug may beraspberrypi3
but we also put the following aliases[ rpi3, raspberry-pi3 ]
tags
: An array of free form strings that you attach to the contract. Can be anything and the way they are used are context-specific. For example we use#pendinguserresponse
to categorise support threads when doing support