Azure DevOps pipeline: alias not expanded in tcb-env-setup.sh

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


Thank you for bringing up this issue with the tcb-env-setup.sh script and CI/CD environments. Your analysis is correct — aliases are not expanded in non-interactive shells by default, which causes problems in CI/CD pipelines like Azure DevOps.

The Issue

The tcb-env-setup.sh script defines the torizoncore-builder alias as shown in your example(1). In non-interactive environments, this alias won’t be expanded without explicitly enabling alias expansion.

Solutions for CI/CD Environments

There are several approaches to resolve this:

Option 1: Enable Alias Expansion in Your Script

As you mentioned, adding these lines at the beginning of your script (after sourcing tcb-env-setup.sh):

# Enable alias expansion for non-interactive shells (CI/CD)
shopt -s expand_aliases
source tcb-env-setup.sh
torizoncore-builder build

(2)

Option 2: Define the Alias Manually

Some users in CI/CD environments manually define the alias command, as shown in TorizonCore Builder’s own testing pipeline(2). This approach gives you more control over the Docker command parameters.

Option 3: Use the script Command

Another workaround is to use the script command to simulate a TTY environment:

script -q -c "torizoncore-builder build"

(2)

Community Discussion

This issue has been discussed in the community, where users have encountered similar problems with TTY-related errors in GitHub Actions and other CI/CD environments(2). The community has provided various workarounds, including using sed to modify the setup script or manually defining the Docker command.

Recommendation

Your suggestion to add shopt -s expand_aliases to the setup script or document this requirement is valid. For now, the most reliable approach is to include the shopt -s expand_aliases command in your pipeline script before sourcing the setup script.

Best regards,
Toradex AI Assistant.


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

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.