Run tcb-build task in CI with variable substituition

Based on the documentation, torizoncore-builder build supports variable substitution in tcbuild. yaml.
Variables can be set through –set ASSIGNMENT command line option to torizoncore-builder build.

In my CI pipeline I don’t call torizoncore-builder build directly, but I leverage on tcb-build task as provided by Toradex.
How can I have variable substitution working in this case?
I mean, I can create env variable on the agent that runs the pipeline (and the task), but I can I pass these variables to torizoncore-builder?

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello! Great question regarding variable substitution in the context of CI pipelines using the tcb-build task.

Currently, variable substitution in torizoncore-builder via the --set command-line option is documented only for direct invocation of torizoncore-builder build . As per the official documentation, you can substitute variables in your tcbuild.yaml like this:

output:
  easy-installer:
    local: torizon-core-docker-colibri-imx6-with-containers
    name: "${IMAGE_NAME-Default image name}"
    description: "${IMAGE_DESC?Please provide a description for this image}"

With the CLI command:

torizoncore-builder build --set IMAGE_NAME="My Image" --set IMAGE_DESC="CI build example"

(Reference)
(Reference)

However, the tcb-build task is a higher-level automation (often in CI/CD tools or Torizon Cloud CI), and as of the published documentation, there’s no mention of a built-in mechanism to pass variable assignments directly through it (such as a --set equivalent).

Typical ways in such cases:

  • If tcb-build is a wrapper, check if it forwards any additional arguments to torizoncore-builder build . You could try passing --set arguments after a – (double dash) if your CI system supports it (e.g., tcb-build … – --set IMAGE_NAME=“My Image” … ), but confirm how your task interprets arguments.
  • Setting environment variables alone may not work for substitution unless specifically supported in the tcbuild.yaml or by tcb-build .
  • If tcb-build lacks direct support, a common workaround is to template your tcbuild.yaml as part of your pipeline, replacing variables via shell scripting or a configuration management tool before running tcb-build .

Summary:
As of the current documentation, there’s no explicit, documented support for passing variable assignments to the underlying torizoncore-builder build via the tcb-build task. You may need to use preprocessing on your pipeline agent to inject variables directly into your tcbuild.yaml .

You can find further information here in the documentation:

Best regards,
Toradex AI Assistant.

Greetings @vix,

For the time-being I don’t believe there is a way or mechanism to do so with VSCode. One would probably need to manually edit the tcb-build task definition in the tasks.json and add the variable assignments to the build command.

Best Regards,
Jeremias

This is what I did (as a workaround).
Can toradex consider a future improvement to handle this need is a “native” way (i.e., withotu having to manually edit tcb-build task)?

Can toradex consider a future improvement to handle this need is a “native” way

Sure I can pass this on to our team internally.

Best Regards,
Jeremias