-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add contract partial based instruction generation #1101
Changes from all commits
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,76 @@ | ||
import { Contract } from '../types/contract'; | ||
|
||
// Hardcoded host OS contract, this should be moved to the Yocto build process with meta-balena. | ||
// Here for initial implementatin and testing purposes | ||
const BalenaOS: Contract = { | ||
name: 'balenaOS', | ||
slug: 'balenaos', | ||
type: 'sw.os', | ||
description: 'Balena OS', | ||
partials: { | ||
image: [`{{#each deviceType.partials.instructions}}{{{this}}} {{/each}}`], | ||
internalFlash: [ | ||
`{{#each deviceType.partials.connectDevice}}{{{this}}} {{/each}}`, | ||
`Write the {{name}} file you downloaded to the {{deviceType.name}}. We recommend using <a href="http://www.etcher.io/">Etcher</a>.`, | ||
`Wait for writing of {{name}} to complete.`, | ||
`{{#each deviceType.partials.disconnectDevice}}{{{this}}} {{/each}}`, | ||
`{{{deviceType.partials.bootDevice}}} to boot the device.`, | ||
], | ||
externalFlash: [ | ||
`Insert the {{deviceType.data.media.altBoot.[0]}} to the host machine.`, | ||
`Write the {{name}} file you downloaded to the {{deviceType.data.media.altBoot.[0]}}. We recommend using <a href="http://www.etcher.io/">Etcher</a>.`, | ||
`Wait for writing of {{name}} to complete.`, | ||
`Remove the {{deviceType.data.media.altBoot.[0]}} from the host machine.`, | ||
`Insert the freshly flashed {{deviceType.data.media.altBoot.[0]}} into the {{deviceType.name}}.`, | ||
`<strong role="alert">Warning!</strong> This will also completely erase internal storage medium, so please make a backup first.`, | ||
`{{#each deviceType.partials.bootDeviceExternal}}{{{this}}} {{/each}}`, | ||
`Wait for the {{deviceType.name}} to finish flashing and shutdown. {{#if deviceType.partials.flashIndicator}}Please wait until {{deviceType.partials.flashIndicator}}.{{/if}}`, | ||
`Remove the {{deviceType.data.media.altBoot.[0]}} from the {{deviceType.name}}.`, | ||
`{{#each deviceType.partials.bootDeviceInternal}}{{{this}}} {{/each}}`, | ||
`{{{deviceType.partials.bootDevice}}} to boot the device.`, | ||
], | ||
externalBoot: [ | ||
`Insert the {{deviceType.data.media.defaultBoot}} to the host machine.`, | ||
`Write the {{name}} file you downloaded to the {{deviceType.data.media.defaultBoot}}. We recommend using <a href="http://www.etcher.io/">Etcher</a>.`, | ||
`Wait for writing of {{name}} to complete.`, | ||
`Remove the {{deviceType.data.media.defaultBoot}} from the host machine.`, | ||
`Insert the freshly flashed {{deviceType.data.media.defaultBoot}} into the {{deviceType.name}}.`, | ||
`{{{deviceType.partials.bootDevice}}} to boot the device.`, | ||
], | ||
jetsonFlash: [ | ||
`Put the device in recovery mode and connect to the host computer via USB`, | ||
`{{#if deviceType.partials.jetsonNotes}}{{#each deviceType.partials.jetsonNotes}}{{{this}}} {{/each}}{{/if}}`, | ||
`Unzip the {{name}} image and use the Jetson Flash tool to flash the {{deviceType.name}} found at <a href="https://github.com/balena-os/jetson-flash">https://github.com/balena-os/jetson-flash</a>.`, | ||
`Wait for writing of {{name}} to complete.`, | ||
`{{{deviceType.partials.bootDevice}}} to boot the device.`, | ||
], | ||
edisonFlash: { | ||
Linux: [ | ||
`{{#each deviceType.partials.Linux.flashDependencies}}{{{this}}} {{/each}}`, | ||
`Unplug the {{deviceType.name}} from your system`, | ||
`Unzip the downloaded {{name}} file`, | ||
`{{#each deviceType.partials.Linux.flashInstructions}}{{{this}}} {{/each}}`, | ||
`Plug the {{deviceType.name}} as per the instructions on your terminal.`, | ||
`You can check the progress of the provisioning on your terminal.`, | ||
], | ||
MacOS: [ | ||
`{{#each deviceType.partials.MacOS.flashDependencies}}{{{this}}} {{/each}}`, | ||
`Unplug the {{deviceType.name}} from your system`, | ||
`Unzip the downloaded {{name}} file`, | ||
`{{#each deviceType.partials.MacOS.flashInstructions}}{{{this}}} {{/each}}`, | ||
`Plug the {{deviceType.name}} as per the instructions on your terminal.`, | ||
`You can check the progress of the provisioning on your terminal.`, | ||
], | ||
Windows: [ | ||
`{{#each deviceType.partials.Windows.flashDependencies}}{{{this}}} {{/each}}`, | ||
`Unplug the {{deviceType.name}} from your system`, | ||
`Unzip the downloaded {{name}} file`, | ||
`{{#each deviceType.partials.Windows.flashInstructions}}{{{this}}} {{/each}}`, | ||
`Plug the {{deviceType.name}} as per the instructions on your terminal.`, | ||
`You can check the progress of the provisioning on your terminal.`, | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
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. Both 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. Hm, each of these partials are supported installation methods of the operating system and are not necessarily device specific. Any device that supports using the jetson flash tool should be allowed to get these instructions. These are just Balena OS's way of saying, "I support being installed with the jetson flash tool, and this is how. It doesn't provide any information that is specific to a device type. If that makes sense. Basically it's the BalenaOS's part in the flash process of telling the user "how to handle the file that I am giving you. 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. Jetson is a device family, no other vendor will use Jetson tools. And the same goes for edison. Why would a contract for the RaspberryPi need to mention other vendors like Jetson or edison? In my view this corresponds to a |
||
export { BalenaOS }; |
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.
@mehalter the partials above should go into the existing balenaOS contract in https://github.com/balena-io/contracts/blob/master/contracts/sw.os/balenaos/contract.json.
This is already used by the OS build scripts so when added the contract will be deployed with the OS release.
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.
Awesome, I'll get this moved over. Is this accessible through the API as well?
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.
@mehalter it's deployed with the OS release. For example if you do:
You will get something like:
As you see at the moment the contract is very basic, but once you add the instructions they will appear there.