TorizonCore Builder with Github Actions

Hello there

I am using the TorizonCore Builder in a GitHub actions pipeline to build my custom Torizon OS. I run a bash script like this:

shopt -s expand_aliases  # This is needed so that the alias for `torizoncore-builder` works inside this script
source tcb-env-setup.sh -a remote
torizoncore-builder build

However, it fails in the build step with the following error: the input device is not a TTY.
I read online that this comes from the -it flag of the docker run command that torizoncore-builder uses.

How can I use the TorizonCore Builder in my GitHub actions pipeline without modifying the tcb-env-setup.sh script?

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello there,

The error you’re encountering, “the input device is not a TTY,” typically occurs because the torizoncore-builder tool uses Docker with the -it flag, which expects an interactive terminal. In a CI/CD environment like GitHub Actions, this can cause issues since the environment doesn’t provide a TTY by default.

To resolve this without modifying the tcb-env-setup.sh script, you can adjust how the Docker container is run within the GitHub Actions environment. Here are a couple of approaches you can consider:

  1. Modify the Docker Run Command: If you have control over the Docker command execution, you can remove the -it flag. This might involve creating a custom script or wrapper that calls the torizoncore-builder without the interactive flags.

  2. Use the script Command: You can use the script command to simulate a TTY. This command is often used to create a typescript of a terminal session, but it can also be used to provide a pseudo-TTY. You can wrap your torizoncore-builder command like this:

    script -q -c "torizoncore-builder build"
    

By implementing one of these solutions, you should be able to run the TorizonCore Builder in your GitHub Actions pipeline without encountering the TTY error. This approach allows you to maintain the integrity of the tcb-env-setup.sh script while adapting the environment to meet the tool’s requirements.

Best regards,
Toradex AI Assistant.

Please, also check if these links can help you solve your problem:

[TorizonCoreBuilder] Dropped capabilities while building image.

Greetings @i.staehli,

We use TorizonCore Builder in CI/CD pipelines for testing purposes as well. In our case we just manually define the alias command ourselves as shown here: torizoncore-builder/.github/workflows/pr-tests.yml at bullseye · torizon/torizoncore-builder · GitHub

Otherwise if you continue to use the setup scrip, you can’t really remove the -it flag without modifying the alias which is in the script. I’ve seen other users use sed to remove the -it flag from the setup script, then run it.

Best Regards,
Jeremias