IoT Catalyst DevOps - User GuideTable Of Contents
IntroductionIoT Catalyst DevOps Extension (just DevOps from now on) is the official VS Code extension released by the IoT Catalyst DevOps team. By using DevOps, users can achieve a really fast development loop without needing to leave VS Code. Here's a typical usage scenario:
Quick StartWe strongly recommend taking a look at our examples. Prerequisites
CompatibilityThe compatibility table between DevOps and the IoT Catalyst Hypervisor SDK is reported below.
ExamplesThe complete list of DevOps walkthroughs and examples is available here. General ConceptsHere are mentioned some concepts many commands rely on. Hypervisor PathSome commands require additional knowledge about the entities they are working with (for instance, the IoT Catalyst Studio URL). This knowledge is, when possible, extracted from the Hypervisor installed on the development machine. Therefore DevOps prompts the user for the Hypervisor installation path (refer to this command for more details). Container WorkspaceCommands which act on an IoT Catalyst Container or a Digital Thing require to be executed in a workspace that includes the Container folder. That's why, when executing a command X while not being in a Container Workspace, you may encounter the following warning message: To fix this, just launch the Select Container Folder command and then launch X again. IoT Catalyst Studio CredentialsSome commands which need to call the IoT Catalyst Studio API may prompt the user for a valid pair of IoT Catalyst username and password: Extension SettingsDevOps is customizable through Visual Studio Code Settings. Go to "File" > "Preferences" > "Settings", and then to the "Extensions" > "IoT Catalyst DevOps" section. Here are described the available settings. Auto SyncWhen developing a Digital Thing using the Code Manager provided by DevOps, you will notice a popup appearing every time you save changes to the Digital Thing artifacts (ie. the code or the Bill of Features): This is because, if you make manual changes, DevOps tries to keep the Bill of Features in sync with the Code and vice versa. Please do not be afraid of this alert, since it's just here to notify that someone else is taking care to keep all in sync for you! If you want to get rid of this alert, you can disable the warning message by setting the "Auto Sync" configuration to either On or Off. Hypervisor FolderYou can use this setting to tell DevOps which IoT Catalyst Hypervisor must be used while the extension is active. IDE FeaturesDevOps ships with a series of simplified GUIs which allow to design and debug a Digital Thing in a matter of clicks. Once you install the Extension, a new panel becomes available in the VSCode editor: the "IoT Catalyst DevOps" panel. Digital Thing Features (Code Manager)Automatic code generation for Digital Things (Python + XML Bill of Features) This graphical interface is activated when a IoT Catalyst Container is present inside the VSCode workspace. When active, it shows all the features defined in the Bill of Features of the Digital Thing instantiated by the Container. For example, the following image depicts a Digital Thing having a Data feature called "dato1" and an Event feature called "event1". You can leverage the contextual buttons to model the shape of your Digital Thing. Here are described typical operations. Adding a New FeatureDefine a new feature and automatically generate the Python boilerplate code along with a new entry in the .bof file. To a add a new feature, use the "Add Feature" button located to the right of the view title. You will be prompted for some information about the new feature. Here's an example of the workflow: Adding Function/Action ParametersUpdate a Function or Action feature definition by adding a parameter to it. When you have a feature of type "Function" or "Custom Action", you can add a maximum of 5 parameters to it via DevOps. Just locate the feature inside the treeview: here, locate its child node named "Parameters" and click the "Add Feature Parameter" button: Removing a FeatureRemove the feature definition from both the Digital Thing Python code and the .bof file. A feature can be removed by clicking its "Remove Feature" associated button: Removing Function/Action ParametersUpdate a feature definition by removing a parameter from its code and .bof file. You can remove Function/Action feature parameters as you would delete an argument from a normal Python function. Once you click save, the Code Manager will take care of synchronizing the changes in the code to the Bill Of Features. See Auto Sync for more information. Extension OutputYou can view the output logs generated by DevOps by clicking the "IoT Catalyst DevOps" item in the VSCode status bar. CommandsHere are described the commands provided by this extension. Connect to a Remote HostConnect via SSH to a Remote Host and open a VSCode window inside that host.
Select Hypervisor FolderLets you select the folder of a locally installed Hypervisor. Once selected, this information will be saved into the Visual Studio Code settings and the workspace will be reloaded. The prompt widget looks like the following: See here for more information. Select Container FolderLets you select a Container among the ones mounted on the selected Hypervisor, and opens the container folder in the VSCode workspace.
Create a new Digital ThingCreates a new empty Digital Thing and uploads it to the IoT Catalyst library.
Mount a new ContainerThis command creates a new Container starting from an existing Digital Thing and mounts it on the local Hypervisor.
Install Python DependencyLets you choose a Python package among the ones available on PyPi. Once selected, the package will be installed in the Python environment relative to the Container opened in the current Workspace.
Compile Digital Thing CodeThis command compiles the Python source files of the Digital Thing included in the Container Workspace, and puts the compilation artifacts in the Upload Digital Thing to IoT Catalyst LibraryCreate the distributable zip bundle for the Digital Thing included in the Container Workspace and upload it to the IoT Catalyst library.
Deploy Changes to IoT Catalyst LibraryDo the same as Upload Digital Thing to IoT Catalyst Library and also update the Bill of Features of the Container in the current workspace. This command is meant to be used when you either add or remove a feature from a Digital Thing instantiated on a container, and would like to apply the changes to that container without the need of remounting it. After this command completes, it is possibile to debug the Digital Thing Code using the updated container. Debug ContainerRestart the container in the current workspace in debug mode using the Python Debugger.
Open Local Container Details in IoT Catalyst StudioThis command will open a browser to the IoT Catalyst Studio Container details related to the Container in the current workspace. Known IssuesContainer fails to be unmounted if opened in VSCodeDo not unmount/update a container while its folder is opened in the Visual Studio Code workspace. Otherwise the hypervisor will encounter a Permission error while deleting the unmounted container folder. Terminal Default Profile in Windows EnvironmentMake sure that your VSCode Terminal Default Profile is "Command Prompt". Otherwise some commands (such as Upload Digital Thing to IoT Catalyst Library) would not work because they invoke cmd scripts under the hood. Please refer to this guide for more details. SSH Remote: Troubles while connectingIf you get stuck in a loop while Connecting to a Remote Host: enable TCP Port Forwarding on the remote host. Please refer to this guide for more details. SSH Remote: VSCode Terminal not loading .profileIf when you connect to a Remote Host and the Visual Studio Code Terminal is unable to recognize some system executables (eg. pyenv)
you may be able to fix it by deleting the Please refer to this thread for more details. Incompatible with WSLThe extension does not work if VSCode is opened inside WSL (Windows Subsystem for Linux), due to incompatibility issues related to launching system processes. Missing support for type hintsUsage of Python type hints inside the Digital Thing code is not allowed, as it clashes with the DevOps Code Manager implementation (as of August, 2023). For more informationEnjoy! |