Skip to content

feat(astera): put SBGrid on $PATH when /programs is mounted - #362

Open
manzuoni-astera wants to merge 1 commit into
diff-use:mainfrom
manzuoni-astera:michaelanzuoni/sbgrid-shell-init
Open

feat(astera): put SBGrid on $PATH when /programs is mounted#362
manzuoni-astera wants to merge 1 commit into
diff-use:mainfrom
manzuoni-astera:michaelanzuoni/sbgrid-shell-init

Conversation

@manzuoni-astera

@manzuoni-astera manzuoni-astera commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Astera now installs the SBGrid collection once on a shared sbgrid-programs PVC, which the actl catalog auto-mounts read-only at /programs for every diffuse profile. The mount arrives regardless of image — but on this image a scientist still had to run three manual steps before phenix worked:

apt-get update && apt-get install -y tcsh bsdextrautils
ln -sfn /mnt/sbgrid-programs /programs
source /programs/sbgrid.shrc

The symlink goes away on the actl side. This PR removes the other two, so --image sampleworks lands you in a shell where phenix just works.

Why tcsh is not optional

/programs/sbgrid.shrc aborts with "requires the C shell" when /bin/csh is missing and sets up nothing at all — the entire collection stays invisible. bsdextrautils provides column(1), which SBGrid's sbgrid-obsolete helper shells out to on every title lookup. Both added to the existing verification loop.

The shell init

Follows the existing ext-shell pattern (/etc/profile.d/ + install-*-shell-hooks.sh). Guarded so it cannot break shells with no collection: /programs is created empty in the image, so a non-diffuse workspace or a --no-mount run is a clean no-op.

The || true is load-bearing — sbgrid.shrc runs commands that return non-zero benignly, so sourcing it under set -e kills the shell. Verified on a live pod; it's why my first attempt at this failed.

Verified

Against the real collection, on the current image, with the PVC mounted read-only exactly as the catalog will:

  • interactive shell resolves phenix.molprobity with no setup, and scores 1CRN correctly (MolProbity 0.56, 0.00% Ramachandran outliers)
  • bash -lc 'phenix.version' works for non-interactive callers
  • pixi unaffected (0.71.2) — the analysis env and SBGrid coexist
  • absent mount is a clean no-op under both plain and set -e shells
  • SBGRID_NO_AUTOINIT=1 opts out

Note

This brings phenix and the ~3,200 other SBGrid commands. tortoize is not an SBGrid title and still comes from pixi run -e analysis.

Depends on Astera-org/asteractl#138 + #139 for the /programs mount; harmless to merge before them (no mount → no-op).

Summary by CodeRabbit

  • New Features

    • Added Astera image support for shell utilities and standard command-line tools.
    • Added automatic SBGrid shell initialization for Bash and Zsh environments.
    • Added support for creating and using the /programs directory when available.
  • Bug Fixes

    • Prevented duplicate shell startup entries and reduced initialization failures from disrupting shell startup.

Astera installs the SBGrid collection once on a shared `sbgrid-programs`
PVC, which the actl catalog auto-mounts read-only at /programs for every
diffuse profile. The mount arrives regardless of image, but scientists on
this image still had to run three manual steps before phenix worked.

Two of those steps were the image's fault. `tcsh` is a hard requirement,
not a convenience: /programs/sbgrid.shrc aborts with "requires the C
shell" when /bin/csh is missing and sets up nothing at all, so the entire
collection stays invisible. `bsdextrautils` provides column(1), which
SBGrid's sbgrid-obsolete helper shells out to on every title lookup.
Both are added to the verification loop.

The third was the missing shell init, added here following the existing
ext-shell pattern. It is guarded so it cannot break shells that have no
collection: /programs is created empty in the image, so a non-diffuse
workspace or a --no-mount run simply no-ops.

The `|| true` is load-bearing. sbgrid.shrc runs commands that return
non-zero benignly, so sourcing it under `set -e` kills the shell —
verified on a live pod, and the reason my first attempt at this failed.

Verified against the real collection on the current image with the PVC
mounted read-only: an interactive shell resolves phenix.molprobity with
no setup and scores 1CRN correctly, `bash -lc` works for non-interactive
callers, pixi is unaffected, an absent mount is a clean no-op under both
plain and `set -e` shells, and SBGRID_NO_AUTOINIT=1 opts out.

Note this brings phenix and the rest of SBGrid; tortoize is not an
SBGrid title and still comes from `pixi run -e analysis`.
Copilot AI lite review requested due to automatic review settings August 6, 2026 16:49
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7259bc71-12de-40a0-97a4-e6de34e8bfdb

📥 Commits

Reviewing files that changed from the base of the PR and between d69b062 and 304b11d.

📒 Files selected for processing (3)
  • Dockerfile.astera
  • docker/astera/install-sbgrid-shell-hooks.sh
  • docker/astera/sbgrid-shell.sh

📝 Walkthrough

Walkthrough

The Astera image now installs additional shell utilities, validates their commands, creates /programs, and configures guarded SBGrid initialization for Bash and Zsh startup.

Changes

Astera SBGrid shell integration

Layer / File(s) Summary
Astera image setup
Dockerfile.astera
The image installs bsdextrautils and tcsh, validates column and csh, creates /programs, installs the SBGrid profile, and runs the shell-hook installer.
Guarded shell initialization
docker/astera/install-sbgrid-shell-hooks.sh, docker/astera/sbgrid-shell.sh
The installer adds idempotent Bash and Zsh startup hooks. The profile initializes /programs/sbgrid.shrc once unless disabled or already initialized.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AsteraImage
  participant ShellHookInstaller
  participant ShellStartup
  participant SBGridProfile
  participant SBGridCollection

  AsteraImage->>ShellHookInstaller: install startup hooks
  ShellHookInstaller->>ShellStartup: append guarded source command
  ShellStartup->>SBGridProfile: source profile
  SBGridProfile->>SBGridCollection: source /programs/sbgrid.shrc when mounted
Loading

Suggested reviewers: mag-astera

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: making SBGrid available on PATH when /programs is mounted.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds automatic, guarded SBGrid shell initialization in the Astera image when the shared /programs PVC is mounted, while keeping behavior a no-op when it isn’t.

Changes:

  • Add a guarded /etc/profile.d hook to source /programs/sbgrid.shrc only when present.
  • Add an installer script to wire the hook into bash/zsh startup files idempotently.
  • Update Dockerfile.astera to install required packages (bsdextrautils, tcsh) and install the new shell hooks.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
docker/astera/sbgrid-shell.sh Adds guarded SBGrid initialization sourced at shell startup when /programs/sbgrid.shrc exists.
docker/astera/install-sbgrid-shell-hooks.sh Appends an idempotent source line into common bash/zsh rc/profile files.
Dockerfile.astera Installs dependencies, ensures /programs exists, and installs/runs the SBGrid hook wiring.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

profile_comment="# Sampleworks: put SBGrid on \$PATH when /programs is mounted."
profile_line="[ -r ${profile_script} ] && . ${profile_script}"

touch /root/.bashrc /home/dev/.bashrc

profile_script="/etc/profile.d/sbgrid-shell.sh"
profile_comment="# Sampleworks: put SBGrid on \$PATH when /programs is mounted."
profile_line="[ -r ${profile_script} ] && . ${profile_script}"
# under `set -e` and would take the whole shell with it. It is also chatty
# on first run and writes into $HOME. Neither should be able to break shell
# startup, hence the redirect and the `|| true`.
. /programs/sbgrid.shrc >/dev/null 2>&1 || true
# under `set -e` and would take the whole shell with it. It is also chatty
# on first run and writes into $HOME. Neither should be able to break shell
# startup, hence the redirect and the `|| true`.
. /programs/sbgrid.shrc >/dev/null 2>&1 || true

@marcuscollins marcuscollins left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. I'm not sure what's going on with the tests and scans. I triggered them to run again, maybe it was transient. Please don't merge if they are still failing, but other wise go ahead.

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.

4 participants