Workspace - Tasks
Introduction
This article explains the automation tasks provided by the Torizon IDE Extension, available in the VS Code Task Runner menu. Other specific tasks can be provided by the templates and are described in their respective documentation.
This documentation describes all the inputs that the tasks require. If a task is not asking for an input, it means that the input has its value already stored in the .vscode/settings.json
.
Execute a Task
To execute a tasks click on the item from TASK RUNNER
drop menu list from the VS Code Explorer activity bar:
If you want to change the value of the input, you can change it in the .vscode/settings.json
file or by cleaning the value in the .vscode/settings.json
, then run the task again.
Check the Workspace Settings documentation for more information.
Build and Test Release Container Images
The run-container-torizon-release-<arch>
task will:
- Build the application based on the production
Dockerfile
. - Push the container to the local registry (localhost:5002).
- Pull the container on the board.
- Run the application on the board, showing the output on the VSCode terminal. Learn more on the Build and Test Release Container Images article.
Add Debian Packages to the Dockerfiles
The apply-torizon-packages
task, which is automatically triggered whenever another task builds a container image, adds packages specified in the torizonPackages.json
file automatically to the Dockerfile
, Dockerfile.debug
, and Dockerfile.sdk
files. For more details, check this section of the Add Packages, Libraries, Tools and Files article.
Prepare your Application Container for Production
The create-production-image
task performs this action.
Learn more on the Prepare your Application Container for Production article.
Build and Push Applications to Torizon Cloud
The tcb-platform-publish
task performs this action.
Learn more on the Build and Push Applications to Torizon Cloud article.
Configure the Project to Run CI Pipelines
The fill-pipeline-settings
task performs this action.
Learn more on the Configure Projects to Run CI Pipelines article.
Update the Project Based on template
The try-update-template
task updates the project with the latest updates from the template.
Learn more on the Updating Project from Template article.
Update a Fleet with Latest Published Version
Use the platform-update-fleet
task.
This task will trigger the update of the fleet in the Torizon Cloud with the latest version of the application published to the platform.
Inputs are needed to complete the task and are asked in the start of the task:
Torizon Cloud Fleet name to update
: This is the name of the fleet that will receive the update trigger. You can create and get the fleet name from the Torizon Cloud.Torizon Cloud API v2 Client ID
: the Torizon Cloud API v2 Client ID to use to authenticate in the Torizon Cloud API v2. You can get it creating a new API Client in the Torizon Cloud. Check the Creating a New Torizon Cloud API v2 Client documentation for more information.Torizon Cloud API v2 Client Secret
: the Torizon Cloud API v2 Client Secret to use to authenticate in the Torizon Cloud API v2. You can get it creating a new API Client in the Torizon Cloud. Check the Creating a New Torizon Cloud API v2 Client documentation for more information. This value will be stored as a secret in the VS Code vault.
Check Host Machine Dependencies Required by the Project
The check-deps
task runs automatically when a new project is created in VS Code and checks if any dependencies are missing on the host machine, such as SDKs.
Also, some projects require dependencies to be installed via installation scripts. An example is the dotnet-sdk-*
package for .NET templates, which requires a script to ensure that packages originate from Microsoft's source, avoiding package conflicts with Linux's repositories.
If any dependencies or configurations are missing, check-deps
displays a message on the terminal asking if the user wants to install them. Note that required dependencies are installed on the development machine, not inside containers.
If the user accepts, the task tries to install pending dependency packages via apt
and execute the pending dependency installation scripts.
Pay attention to the terminal tab, your root password may be required.
If the task execution finishes successfully, a .conf/.depok
file is created. That ensures the task only runs again if manually triggered by the user (through the TASK RUNNER
tab).
Required dependencies are defined in the .conf/deps.json
file and have the following format:
{
"packages": [
"openssh-client",
"sshpass"
],
"installDepsScripts": [
".conf/installDepsScripts/installDotnetSDK8.sh"
]
}
The packages
property contains the Debian packages to be installed, while installDepsScripts
contains the path of dependency installation scripts to be executed. Scripts can be any executable type, such as Bash (.sh) scripts, PowerShell (.ps1) scripts, or even binary files. You can add packages and scripts according to your needs.
Stop and Remove Containers
By default both debug and release pipelines only stops and removes the application's container. If you want to stop and remove all containers on the board you can use the containers-cleanup
task. Also, you can stop and/or remove only the containers that you want on the Docker tab on VSCode (the Docker icon on the left side of VSCode).
Show Project documentation
The show-project-documentation
task opens the template documentation (.doc/README.md
) in a new tab. It shows it using the VS Code markdown preview.
The documentation only appears the first time a project is opened on a development machine. After that, a .conf/.docok
file is created, ensuring the task only runs again if manually triggered by the user (through the TASK RUNNER
tab).