Skip to content

feat(labctl): add images download command#39

Merged
jmgilman merged 3 commits intomasterfrom
feat/labctl-images-download
Dec 29, 2025
Merged

feat(labctl): add images download command#39
jmgilman merged 3 commits intomasterfrom
feat/labctl-images-download

Conversation

@jmgilman
Copy link
Collaborator

Summary

  • Adds new labctl images download command that downloads an image from the manifest to a local file
  • Separates download from upload to support testing with the exact version being published
  • Updates VyOS build workflow to use labctl instead of inline curl/grep

Changes

  • tools/labctl/internal/config/manifest.go: Add FindImageByName() method
  • tools/labctl/cmd/images/download.go: New download command with JSON output
  • tools/labctl/cmd/images/download_test.go: Comprehensive tests
  • .github/workflows/vyos-build.yml: Use labctl for VyOS ISO download

New Command Usage

labctl images download --name vyos-stream --manifest images/images.yaml --output /tmp/vyos.iso

Output (JSON to stdout):

{
  "path": "/tmp/vyos.iso",
  "checksum": "sha256:abc123...",
  "size": 123456789,
  "name": "vyos-stream"
}

Test plan

  • just all passes in tools/labctl (format, lint, vet, test)
  • VyOS Integration Tests workflow runs successfully with new changes

🤖 Generated with Claude Code

jmgilman and others added 3 commits December 28, 2025 11:24
Adds a new `labctl images download` command that downloads an image from
the manifest to a local file. This separates the download step from
upload, enabling CI workflows to download, test, and then upload.

Changes:
- Add FindImageByName() method to ImageManifest for lookup by name
- Create download.go command with JSON output for CI integration
- Update vyos-build.yml to use labctl instead of inline curl/grep

The new command:
- Looks up image by name in manifest
- Downloads from source URL
- Verifies checksum (source and decompressed if applicable)
- Outputs JSON with path, checksum, size, name

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add pre-upload hooks to the image sync process that gate publishing.
Images must pass their configured hooks before being uploaded to e2.

Key changes:
- Add hooks schema to manifest (preUpload hooks with name, command, timeout)
- Add hook result caching in e2 to skip re-testing unchanged images
- Add hook executor that runs commands and caches results
- Add --no-upload flag for PR testing (runs everything except upload)
- Add --skip-hooks flag to bypass hook execution when needed
- Remove vyos-build.yml (consolidated into images-sync.yml)
- Update workflow to run full sync --no-upload on PRs

This enables a pattern where testing gates publishing:
1. Download image and verify checksum
2. Run pre-upload hooks (e.g., VyOS integration tests)
3. Cache hook results keyed by image checksum
4. Upload to e2 only if hooks pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Stream hook stdout/stderr in real-time with a "  │ " prefix to
distinguish hook output from labctl's own output. This provides
better visibility into hook execution progress.

Example output:
  Running hook "vyos-integration-test"...
  │ Building container from ISO...
  │ Deploying containerlab topology...
  │ Running pytest tests...
  │ 5 passed in 45.2s
  Hook "vyos-integration-test": passed (2m30s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jmgilman jmgilman merged commit efab7ee into master Dec 29, 2025
2 checks passed
@jmgilman jmgilman deleted the feat/labctl-images-download branch December 29, 2025 01:33
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