You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added --env, --use-fallback-shell, and --workdir flags to toolbox run command
Added three new options to the toolbox run command to enable Ptyxis to use toolbox(1) instead of directly invoking podman exec:
--env KEY=VALUE: Repeatable flag to pass environment variables into the container exec session. Uses StringArrayVar to avoid splitting on commas.
--use-fallback-shell: Boolean flag that enables fallback-to-bash behavior (trying /bin/bash -l, then /bin/sh -l) when the specified command is not found. Also added /bin/sh -l as a second entry in runFallbackCommands.
--workdir DIR: String flag to override the working directory used inside the container. Validates that the value is an absolute path.
Files modified:
src/cmd/run.go: Added fields to runFlags struct, registered new flags, added workdir validation, updated runCommand signature with extraEnviron parameter, appended extra environ vars.
src/cmd/enter.go: Updated runCommand call to pass nil for the new extraEnviron parameter.
doc/toolbox-run.1.md: Added documentation for all three new options in SYNOPSIS and OPTIONS sections.
test/system/104-run.bats: Added 5 test cases covering --env, multiple --env, --workdir, invalid --workdir, and --use-fallback-shell.
NEWS: Added 0.4 section documenting the three new enhancements.
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request enhances the 'toolbox run' command by adding the '--env', '--workdir', and '--use-fallback-shell' options. These additions allow users to set environment variables, specify an absolute working directory, and fall back to standard shells if a command is missing within the container. The PR includes necessary updates to the man pages, command logic, and system tests. I have no feedback to provide.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2184
Summary
Added --env, --use-fallback-shell, and --workdir flags to toolbox run command
Added three new options to the toolbox run command to enable Ptyxis to use toolbox(1) instead of directly invoking podman exec:
--env KEY=VALUE: Repeatable flag to pass environment variables into the container exec session. Uses StringArrayVar to avoid splitting on commas.
--use-fallback-shell: Boolean flag that enables fallback-to-bash behavior (trying /bin/bash -l, then /bin/sh -l) when the specified command is not found. Also added /bin/sh -l as a second entry in runFallbackCommands.
--workdir DIR: String flag to override the working directory used inside the container. Validates that the value is an absolute path.
Files modified:
References
Test Results
Generated using Claude AI by Maintainer Buddy