Skip to content

devenv: Add tmt and nushell#103

Open
cgwalters wants to merge 1 commit intobootc-dev:mainfrom
cgwalters:add-tmt
Open

devenv: Add tmt and nushell#103
cgwalters wants to merge 1 commit intobootc-dev:mainfrom
cgwalters:add-tmt

Conversation

@cgwalters
Copy link
Contributor

Prep for #55 among others.

Assisted-by: OpenCode (Sonnet 4.5)

@cgwalters cgwalters enabled auto-merge (squash) February 3, 2026 22:15
@gemini-code-assist
Copy link

Summary of Changes

Hello @cgwalters, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the development environment by incorporating nushell, a modern and powerful shell, and tmt, a robust testing framework. These additions aim to provide developers with more advanced tools for scripting and comprehensive test management, thereby improving overall productivity and the quality assurance process within the devcontainer. The changes also include updated documentation to reflect these new capabilities and ensure proper validation through dedicated self-tests.

Highlights

  • Nushell Integration: The modern shell, Nushell (nu), has been integrated into the development environment, including its installation and version management via fetch-tools.sh.
  • TMT Testing Framework: The tmt (Test Management Tool) framework has been added to the development environment, with its installation handled via pip3 for Debian-based containers and package manager for c10s.
  • Enhanced Devcontainer Documentation: The README.md has been updated to provide a clearer description of the devcontainer's purpose, explicitly listing included tools like nu and tmt.
  • Comprehensive Self-Tests: New self-tests have been introduced in devenv-selftest.sh to verify the correct installation and basic functionality of both nushell and tmt.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • devenv/Containerfile.c10s
    • Introduced nushellversion as a build argument.
    • Updated the fetch-tools.sh execution to pass the nushellversion.
  • devenv/Containerfile.debian
    • Introduced nushellversion as a build argument.
    • Updated the fetch-tools.sh execution to pass the nushellversion.
    • Added installation of tmt with provision-virtual using pip3.
  • devenv/README.md
    • Updated the description to clarify the goal of the devcontainer for tools like VSCode remote containers, Codespaces, and devpod.
    • Explicitly listed nu (nushell) and tmt as included tools.
  • devenv/devenv-init.sh
    • Improved script robustness by adding set -euo pipefail.
    • Modified the userns-setup call, removing exec.
  • devenv/devenv-selftest.sh
    • Added self-tests for nushell to verify its installation and basic functionality.
    • Added self-tests for tmt, including command existence, version check, and a minimal test plan setup and discovery.
  • devenv/fetch-tools.sh
    • Enforced the presence of nushellversion environment variable.
    • Implemented logic to fetch and install nushell binaries from GitHub releases, handling different architectures.
  • devenv/packages-c10s.txt
    • Added tmt to the list of packages for the c10s container.
  • devenv/packages-debian.txt
    • Added python3-pip to the list of packages for the debian container.
Activity
  • No specific activity (comments, reviews, etc.) was provided for this pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds tmt and nushell to the development environment containers, along with corresponding tests and documentation updates. However, it introduces several instances of insecure shell variable handling in build scripts and Containerfiles, specifically regarding unquoted build arguments and derived variables, which could lead to command injection. Additionally, there are opportunities to improve the robustness of shell scripts through better error handling and temporary resource cleanup.

*) echo "nushell unavailable for $arch"; return 0 ;;
esac
target=nu-${nushellversion#v}-${nuarch}-unknown-linux-gnu.tar.gz
/bin/time -f '%E %C' curl -fLO https://github.com/nushell/nushell/releases/download/$nushellversion/$target

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The variables $nushellversion and $target are used unquoted in the curl command, which is a security vulnerability that can lead to command injection if these variables contain shell metacharacters. It's crucial to quote these variables to ensure secure handling and prevent word splitting, even if they currently derive from hardcoded defaults. This also aligns with the general best practice of quoting variables containing paths.

Suggested change
/bin/time -f '%E %C' curl -fLO https://github.com/nushell/nushell/releases/download/$nushellversion/$target
/bin/time -f '%E %C' curl -fLO "https://github.com/nushell/nushell/releases/download/${nushellversion}/${target}"

ARG nushellversion=v0.101.0
COPY fetch-tools.sh /run/src/
RUN bcvkversion=$bcvkversion scorecardversion=$scorecardversion /run/src/fetch-tools.sh
RUN bcvkversion=$bcvkversion scorecardversion=$scorecardversion nushellversion=$nushellversion /run/src/fetch-tools.sh

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The build arguments are passed to the shell script without quoting. If any of these variables (which can be overridden at build time) contain shell metacharacters or spaces, it could lead to command injection or word splitting issues during the container build process. Always quote variables in shell commands to ensure they are handled as a single argument.

RUN bcvkversion="$bcvkversion" scorecardversion="$scorecardversion" nushellversion="$nushellversion" /run/src/fetch-tools.sh

ARG nushellversion=v0.101.0
COPY fetch-tools.sh /run/src/
RUN bcvkversion=$bcvkversion scorecardversion=$scorecardversion /run/src/fetch-tools.sh
RUN bcvkversion=$bcvkversion scorecardversion=$scorecardversion nushellversion=$nushellversion /run/src/fetch-tools.sh

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The build arguments are passed to the shell script without quoting. If any of these variables (which can be overridden at build time) contain shell metacharacters or spaces, it could lead to command injection or word splitting issues during the container build process. Always quote variables in shell commands to ensure they are handled as a single argument.

RUN bcvkversion="$bcvkversion" scorecardversion="$scorecardversion" nushellversion="$nushellversion" /run/src/fetch-tools.sh

esac
target=nu-${nushellversion#v}-${nuarch}-unknown-linux-gnu.tar.gz
/bin/time -f '%E %C' curl -fLO https://github.com/nushell/nushell/releases/download/$nushellversion/$target
tar xvzf $target

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The variable $target is used unquoted in the tar command. This can lead to unexpected behavior or command injection if the variable contains shell metacharacters or spaces.

Suggested change
tar xvzf $target
tar xvzf "$target"

tar xvzf $target
# The extracted directory has the same name as the archive without .tar.gz
extracted_dir=nu-${nushellversion#v}-${nuarch}-unknown-linux-gnu
mv $extracted_dir/nu /usr/local/bin/nu

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The variable $extracted_dir is used unquoted in the mv command. This can lead to unexpected behavior or command injection if the variable contains shell metacharacters or spaces.

Suggested change
mv $extracted_dir/nu /usr/local/bin/nu
mv "$extracted_dir/nu" /usr/local/bin/nu

Comment on lines +68 to +100
tmpdir=$(mktemp -d)
(
cd "$tmpdir"
# Create basic fmf metadata directory and file
mkdir -p .fmf
echo "1" > .fmf/version

# Create a minimal test
mkdir -p tests
cat > tests/basic.fmf <<EOF
summary: Basic validation test
test: echo "tmt test validation passed"
duration: 5s
EOF

# Create a minimal plan
mkdir -p plans
cat > plans/basic.fmf <<EOF
summary: Basic validation plan
discover:
how: fmf
execute:
how: local
EOF

# Test tmt functionality
echo "Testing tmt plan discovery..."
tmt plan ls
echo "Testing tmt test discovery..."
tmt test ls
echo "Basic tmt validation complete"
)
rm -rf "$tmpdir"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The temporary directory created for the tmt test is not cleaned up if any command within the subshell fails. Because set -e is active, the script will exit immediately on error, and the rm -rf command on line 100 will not be executed. Using a trap ensures the cleanup is always performed when the script exits.

tmpdir=$(mktemp -d)
trap 'rm -rf -- "$tmpdir"' EXIT
(
    cd "$tmpdir"
    # Create basic fmf metadata directory and file
    mkdir -p .fmf
    echo "1" > .fmf/version
    
    # Create a minimal test
    mkdir -p tests
    cat > tests/basic.fmf <<EOF
summary: Basic validation test
test: echo "tmt test validation passed"
duration: 5s
EOF
    
    # Create a minimal plan
    mkdir -p plans
    cat > plans/basic.fmf <<EOF
summary: Basic validation plan
discover:
    how: fmf
execute:
    how: local
EOF
    
    # Test tmt functionality
    echo "Testing tmt plan discovery..."
    tmt plan ls
    echo "Testing tmt test discovery..."
    tmt test ls
    echo "Basic tmt validation complete"
)

- Add tmt testing framework to CentOS Stream 10 (via EPEL) and Debian (via pip3)
- Add nushell modern shell to both environments via binary installation
- Include comprehensive test coverage and error handling
- Configure renovate for nushell version management
- Fix nushell version format (use 0.110.0 not v0.101.0)

Addresses requirements from bootc-dev#55.

Assisted-by: OpenCode (Sonnet 4.5)
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