Skip to content

Feat: New "Images" view Tab for finding, download, building and importing into Node Template Natively - #155

Closed
dathtd119 wants to merge 8 commits into
srl-labs:mainfrom
dathtd119:feat/images-view
Closed

dathtd119 wants to merge 8 commits into
srl-labs:mainfrom
dathtd119:feat/images-view

Conversation

@dathtd119

@dathtd119 dathtd119 commented Nov 11, 2026 •

Copy link
Copy Markdown

Closes #156

Hi CLAB team, thanks so much for your works on this clab app, after sometimes wondering around with this, I come with the updates for the Web, which is used climg (my personal clone ishare2 cli for containerlab)

Summary

Adds an Images entry to the workspace rail, under Overview. It opens a document view for managing VM images on the local lab host:

  • search an image index (LabHub) by name, kind and vendor, with details per entry;
  • pull an image (download + vrnetlab build) or upload a local qcow2 and build it;
  • a jobs panel: pull/build jobs run one at a time by default, the rest wait in a FIFO queue, all cancellable, progress and log tail shown;
  • Node Templates: built images become Lab Palette templates automatically; templates the user edited are marked "customized" and their edited fields are kept on rebuild;
  • a health card (docker, make, vrnetlab checkout, /dev/kvm).

The work is done by climg, an external Python CLI (pipx install git+https://github.com/dathtd119/climg). The server runs it as a fixed absolute-path program with a versioned JSON contract (climg --version reports contract 1). The app never builds a shell command line.

Off by default. Nothing changes unless WEB_LOCAL_CLIMG_PATH is set, and the view only exists for the local (WEB_LOCAL_LABS) endpoint.

Security

With local labs there is no sign-in, so anyone who can open the app can pull, upload and build images and edit Node Templates. This is the same trust level local labs already have. Mitigations:

  • climg runs as WEB_LOCAL_CLIMG_USER, or as the app's own user. It never runs as root: uid 0 is refused.
  • climg gets a minimal, explicit environment.
  • Arguments are validated, and options always come before --.
  • Uploads stream to disk with a size cap.
  • Lab passwords are redacted from climg output.

Documented in docs/reference/app-settings.md (Images).

Settings

Variable Default Meaning
WEB_LOCAL_CLIMG_PATH unset: Images off Absolute path of climg; the only program run for Images
WEB_LOCAL_CLIMG_CONFIG unset CLIMG_CONFIG passed to climg (absolute path)
WEB_LOCAL_CLIMG_STATE unset CLIMG_STATE passed to climg (absolute path)
WEB_LOCAL_CLIMG_USER app's own user uid:gid to run climg as; required when the app runs as root; uid 0 refused
WEB_LOCAL_CLIMG_HOME run-as user's home HOME for climg (absolute path)
WEB_LOCAL_IMAGES_UPLOAD_MAX 20G Maximum upload size
WEB_LOCAL_IMAGES_MAX_RUNNING 1 Concurrent pull/build jobs (hard cap 4)
WEB_LOCAL_IMAGES_MAX_QUEUED 20 Waiting jobs; beyond it the server answers 429

How to try it

  1. pipx install git+https://github.com/dathtd119/climg (Yes currently it is relying on my own package to use, I can let you guys handle this climg)
  2. climg init (points climg at a vrnetlab checkout and an image folder)
  3. export WEB_LOCAL_LABS=true WEB_LOCAL_CLIMG_PATH="$(command -v climg)"
  4. Start the web app as usual (or scripts/run-images-container.sh for the container variant).
  5. Open Images in the rail, search for vios, and pull it. The image appears in the Lab Palette as a Node Template.

Testing

  • pnpm typecheck: exit 0. pnpm lint: exit 0, knip clean.
  • packages/app-server test:unit: 221 tests, 217 pass, 0 fail, 4 skipped. The skipped tests are root-only ownership tests; run them with bash packages/app-server/scripts/run-root-tests.sh (Docker, 4/4).
  • packages/clab-ui test:unit: 1028/1028.
  • From earlier runs of the same code:
    • standalone-runtime 133/133;
    • UI-harness Images spec, all pass;
    • live e2e against a real climg: search, upload, cancel, template remove/re-add, a real LabHub pull and a real upload+build;
    • search results match climg search --json across 7 queries;
    • the container variant is healthy, with job files owned by the run-as user.
  • Pre-existing failure, unrelated and also present on main (2e3fbe6): test-kit "reports its runtime, and offers nothing the runtime lacks" (captureStream on docker, packages/test-kit/src/contracts/labBackend.ts:216). It fails whenever the host's containerlab has the capture command.

Screenshots

image image

Known limitations / follow-ups

  • After a session expires, only the search list shows the error; a reload recovers.
  • In the container, /dev/kvm shows a warning unless the run-as group can access it; uid:gid cannot add supplementary groups.
  • Search text is not kept when leaving the view.
  • Vendor interface names in templates follow containerlab's per-kind alias support; kinds without aliases keep eth{n}.

Open questions for maintainers

  1. Is a feature that drives an external CLI acceptable in core, or would you prefer it behind a plugin/extension point?
  2. Is the rail placement under Overview right?
  3. Is the opt-in Dockerfile.images + script acceptable in this repo, or should it live outside it?

Routes under /api/runtime/images run climg as a fixed absolute-path program
under a configured non-root user. They cover search, show, pull/build/add
jobs with a FIFO queue, streaming upload, Node Template sync and health.
The feature is off unless WEB_LOCAL_CLIMG_PATH is set and is only enabled
for the local endpoint.
Search, details, pull, upload, build, a jobs panel with the queue, a health
card and Node Template management, in the existing workspace style.
@FloSch62

Copy link
Copy Markdown
Member

Closing reason: #156 (comment)

@FloSch62 FloSch62 closed this Nov 12, 2026
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.

Feature request: New "Images" view to find, build and import vrnetlab images as Node Templates"

2 participants