Skip to content

feat(cli): support Containerfile and custom files in sandbox create - #2453

Open
tirthpatel90 wants to merge 2 commits into
NVIDIA:mainfrom
tirthpatel90:fix/allow-containerfile-in-sandbox-create
Open

feat(cli): support Containerfile and custom files in sandbox create #2453
tirthpatel90 wants to merge 2 commits into
NVIDIA:mainfrom
tirthpatel90:fix/allow-containerfile-in-sandbox-create

Conversation

@tirthpatel90

Copy link
Copy Markdown

Fixes #2420

Summary

Updates the --from path resolution logic in openshell-cli to treat any existing valid file path as a container build file, removing rigid Dockerfile name restrictions.

Changes

  • Updated file resolution in resolve_from to accept any existing file passed to --from without requiring a Dockerfile name convention.
  • Updated directory resolution to fall back to Containerfile if Dockerfile is absent.
  • Updated filename_looks_like_dockerfile to include containerfile and .containerfile.
  • Updated error messages to include Containerfile.

@copy-pr-bot

copy-pr-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

All contributors have signed the DCO ✍️ ✅
Posted by the DCO Assistant Lite bot.

@tirthpatel90

Copy link
Copy Markdown
Author

I have read the DCO document and I hereby sign the DCO.

@tirthpatel90

Copy link
Copy Markdown
Author

Friendly bump @drew @mrunalp!

The DCO sign-off and vouch checks are all green. Could you please trigger /ok to test when you get a chance so the CI checks can run? Thanks!

@drew

drew commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

/ok to test 5af1972

@drew drew 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.

gator-agent

PR Review Status

Validation: PR #2453 is project-valid because it is a small, focused CLI behavior change that directly implements linked issue #2420 for openshell sandbox create --from accepting Containerfile and custom build-file paths.
Head SHA: 5af19727c875106a2bb53ef6ad0a9bbffa990a97

Review findings:

  • Two blocking correctness issues need author changes: the patch currently has a compile-breaking string literal and relative directory builds can pass the wrong Dockerfile path to the build context.
  • User-facing docs/help should also be updated for the changed --from behavior.
  • Please add focused resolver coverage for ./Containerfile, arbitrary existing build-file names, directory fallback to Containerfile, and relative directory --from ./dir canonical context handling.

Docs: Missing for this direct CLI UX change. At least CLI help and the existing sandbox/agent CLI references still describe Dockerfile-only behavior.

Next state: gator:in-review

Comment thread crates/openshell-cli/src/run.rs Outdated
return Err(miette::miette!(
"local --from path does not exist: {}\n\
Use an existing Dockerfile, a directory containing Dockerfile, or a container image reference.",
"Use an existing Dockerfile/Containerfile, a directory containing Dockerfile/Containerfile, or a container image reference.",

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.

gator-agent

Critical: This diagnostic is syntactically invalid Rust because the continued string is interrupted by a new quote before Use. The crate will not compile as written. Keep this as one continued string, for example:

return Err(miette::miette!(
    "local --from path does not exist: {}\n\
     Use an existing Dockerfile/Containerfile, a directory containing Dockerfile/Containerfile, or a container image reference.",
    path.display()
));

Comment thread crates/openshell-cli/src/run.rs Outdated
.wrap_err_with(|| format!("failed to resolve path: {}", path.display()))?;
let dockerfile = context.join("Dockerfile");
return Ok(ResolvedSource::Dockerfile {
dockerfile,

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.

gator-agent

Critical: dockerfile comes from path.join(...) while context is canonicalized below. For common relative inputs such as --from ./my-sandbox-dir, build_image() cannot strip the canonical context prefix and sends ./my-sandbox-dir/Containerfile as a Dockerfile path inside a tar rooted at the context directory. Canonicalize the context first, then select context.join("Dockerfile") or context.join("Containerfile") so the Dockerfile path is under the canonical build context.

@drew drew added the gator:in-review Gator is reviewing or awaiting PR review feedback label Jul 28, 2026
Signed-off-by: Tirth Patel <tirthpatel5393@gmail.com>
@tirthpatel90
tirthpatel90 force-pushed the fix/allow-containerfile-in-sandbox-create branch from 5af1972 to 55ac016 Compare July 28, 2026 07:07

@drew drew 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.

gator-agent

PR Review Status

Validation: PR #2453 remains project-valid because it is a small, focused CLI behavior change that implements linked issue #2420 for openshell sandbox create --from accepting Containerfile and arbitrary existing build-file paths.
Head SHA: 55ac016819dfc26707a6651d13899235b723f716

Review findings:

  • The prior compile-breaking diagnostic string and relative-directory build context issue are resolved in this head.
  • User-facing help/docs still need to be updated for this direct CLI UX change. crates/openshell-cli/src/main.rs and docs/sandboxes/manage-sandboxes.mdx still describe Dockerfile-only local build-file behavior; navigation does not appear to need changes.
  • The new resolver coverage should assert the selected build file and canonical context, including a relative-directory case, so the prior canonicalization bug stays covered.

Docs: Missing for this direct CLI UX change.

Next state: gator:in-review

Comment thread crates/openshell-cli/src/run.rs Outdated
assert!(matches!(res, super::ResolvedSource::Dockerfile { .. }));

// Test directory containing Containerfile fallback
let _dir_res = resolve_from(temp.path().to_str().unwrap()).unwrap();

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.

gator-agent

Warning: This new resolver test only checks that the result is a build source, so it would miss regressions in which build file is selected or whether the context is canonicalized. Please assert the exact dockerfile and context for the Containerfile directory fallback, and add a relative-directory case to lock the prior canonicalization bug closed.

@drew

drew commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

/ok to test 55ac016

@drew drew 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.

gator-agent

PR Review Status

Validation: PR #2453 remains project-valid as a focused CLI UX change implementing linked issue #2420 for openshell sandbox create --from with Containerfile and arbitrary existing build-file paths.
Head SHA: a7251dfbc0e529ee0fb2bb7beaf1dd53db808918

Review findings:

  • The earlier compile error, canonical relative-directory context bug, and exact-path coverage request are resolved in this head.
  • One test-isolation issue remains: the new relative-path test changes the process-wide current directory while Rust tests may run concurrently.
  • The CLI behavior maintenance map points to .agents/skills/openshell-cli/SKILL.md, whose BYOC workflow and quick reference still describe --from as Dockerfile-only. Please update them for arbitrary existing build files and the Dockerfile/Containerfile directory fallback.

Docs: CLI help and docs/sandboxes/manage-sandboxes.mdx now cover the user-facing behavior. Existing folder navigation already includes the page, so docs/index.yml does not need a change.

Next state: gator:in-review

.expect("failed to write project Containerfile");

let old_cwd = std::env::current_dir().expect("failed to get current directory");
std::env::set_current_dir(temp.path()).expect("failed to change current directory");

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.

gator-agent

Warning: set_current_dir changes process-global state while Rust tests run concurrently, so unrelated relative-path tests can fail; a panic before restoration also leaves the CWD pointing into a deleted temp directory. Keep the CWD unchanged—for example, create the temp directory under current_dir, derive a relative project path with strip_prefix, and pass that path to resolve_from.

@drew drew added gator:blocked Gator is blocked by process or repository gates and removed gator:in-review Gator is reviewing or awaiting PR review feedback labels Jul 30, 2026
@drew

drew commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

/ok to test a7251df

@drew drew added gator:in-review Gator is reviewing or awaiting PR review feedback gator:blocked Gator is blocked by process or repository gates and removed gator:blocked Gator is blocked by process or repository gates gator:in-review Gator is reviewing or awaiting PR review feedback labels Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gator:blocked Gator is blocked by process or repository gates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Containerfile named files for sandbox creation.

2 participants