Skip to content

Shell API and CLI: Add option for staging additional runtime targets #2147

Open
nathanwilliams-ct wants to merge 2 commits into
apache:masterfrom
nathanwilliams-ct:nathan/shell-multi
Open

Shell API and CLI: Add option for staging additional runtime targets #2147
nathanwilliams-ct wants to merge 2 commits into
apache:masterfrom
nathanwilliams-ct:nathan/shell-multi

Conversation

@nathanwilliams-ct

@nathanwilliams-ct nathanwilliams-ct commented Jul 6, 2026

Copy link
Copy Markdown

This enables users to add additional functionality such as debug tooling in the shell sandbox,
without needing to modify the target element. This is achived through introducing a new option to
shell.

All existing API and UX is maintained, to not break existing scripts. An alternative design was
considered, to have the additional elements as positional arguments similar to the existing element,
but this would need manual parsing to handle the cases where -- is present and not
present, splitting based on a .bst suffix. This UX could be re-visited in future.

Example usage:
bst shell --with base.bst example.bst -- cat example.txt
Where:

  • example.bst is a simple import element with no dependencies that imports a file called example.txt
  • base.bst provides a basic alpine sysroot with a standard set of unix tooling (sh, df, cat etc).

Changes:

  • Introduces test_with_other_targets integration test to the shell test suite.
  • Adds --with cli option to the shell subcommand and updates it's documentation.
    • option can be used multiple times by caller, providing a list of targets.
  • Extends the shell top level calling interface in Buildstream core to accept a list of
    other_targets
    • This is where the targets are loaded into elements and checked to make sure they are present
  • Extends the shell element implementation to accept a list of other targets
    • This is where the other elements are staged and integrated into the sandbox

towards: #422

This enables users to add additional functionality such as debug tooling in the shell sandbox,
without needing to modify the target element. This is achived through introducing a new option to
shell.

All existing API and UX is maintained, to not break existing scripts. An alternative design was
considered, to have the additional elements as positional arguments similar to the existing element,
but this would need manual parsing to handle the cases where `--` is present and not
present, splitting based on a `.bst` suffix. This UX could be re-visited in future.

Example usage:
  bst shell --with base.bst example.bst -- cat example.txt
Where:
- example.bst is a simple import element with no dependencies that imports a file called example.txt
- base.bst provides a basic alpine sysroot with a standard set of unix tooling (sh, df, cat etc).

Changes:
- Introduces `test_with_other_targets` integration test to the shell test suite.
- Adds `--with` cli option to the shell subcommand and updates it's documentation.
  - option can be used multiple times by caller, providing a list of targets.
- Extends the shell top level calling interface in Buildstream core to accept a list of
other_targets
  - This is where the targets are loaded into elements and checked to make sure they are present
- Extends the shell element implementation to accept a list of other targets
  - This is where the other elements are staged and integrated into the sandbox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant