Skip to content

feat(cli): add features publish command#263

Merged
skevetter merged 3 commits into
mainfrom
feat/features-publish-command
May 12, 2026
Merged

feat(cli): add features publish command#263
skevetter merged 3 commits into
mainfrom
feat/features-publish-command

Conversation

@skevetter

@skevetter skevetter commented May 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Implements the features publish command per the devcontainer specification
  • Publishes packaged devcontainer features to OCI registries
  • Follows existing OCI publishing patterns from templates publish
  • Includes unit tests and e2e tests

Summary by CodeRabbit

  • New Features
    • Added a publish command to package and push dev container features to OCI registries with support for custom registries and namespaces
    • Command outputs feature metadata including ID, version, and published reference in JSON format

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c6c69fa2-a514-4400-9cb7-e4aeb7eacf6b

📥 Commits

Reviewing files that changed from the base of the PR and between d074633 and c686aae.

📒 Files selected for processing (4)
  • cmd/features/publish.go
  • cmd/features/publish_test.go
  • cmd/features/root.go
  • e2e/tests/features/features_publish.go

📝 Walkthrough

Walkthrough

Adds a features publish command that validates a dev container feature directory, builds a single-layer OCI image from its contents, and pushes it to a registry. The command resolves paths, parses metadata, constructs OCI references, authenticates via keychain, and outputs published feature details as JSON.

Changes

Publish Feature Command

Layer / File(s) Summary
Command Definition & Flags
cmd/features/publish.go
Defines PublishFlags struct. NewPublishCmd registers the cobra command with --target (required), --registry (default ghcr.io), and --namespace flags. Sets runPublish as the command handler.
Data Types & Output
cmd/features/publish.go
publishedFeatureMetadata struct marshals the JSON output containing feature id, version, and published ref.
Publish Orchestration
cmd/features/publish.go
runPublish orchestrates the end-to-end workflow: resolves and validates the target directory, parses feature metadata, derives version (default latest), builds the OCI reference, constructs the image, pushes to registry with keychain auth, and outputs JSON metadata to stdout.
Helper Functions
cmd/features/publish.go
validatePublishTarget checks the target is a directory with valid devcontainer-feature.json containing a required id. buildPublishReference formats the OCI reference. parsePublishRef converts the reference string to a name.Reference. buildFeatureImage creates a single-layer OCI image from the directory contents.
Root Command Integration
cmd/features/root.go
Registers the publish subcommand in the features root command.
Unit Tests
cmd/features/publish_test.go
Tests command flag defaults and registration; validates --target required annotation; verifies reference formatting with/without namespace; tests validatePublishTarget error and success cases; validates image layer construction; and tests reference parsing.
End-to-End Tests
e2e/tests/features/features_publish.go
Ginkgo suite with in-memory OCI registry server. Tests successful publish with/without namespace, default version assignment, error cases for missing targets and metadata, and JSON output verification. Includes createFeatureDir helper for test setup.

Sequence Diagram

sequenceDiagram
  participant cmd as Publish Command
  participant fs as File System
  participant parser as Feature Parser
  participant builder as Image Builder
  participant registry as OCI Registry
  cmd->>fs: Resolve & validate target directory
  fs-->>cmd: Target path validated
  cmd->>parser: Parse devcontainer-feature.json
  parser-->>cmd: Feature config (id, version)
  cmd->>cmd: Construct OCI reference
  cmd->>builder: Build image from directory
  builder-->>cmd: OCI image with tar layer
  cmd->>registry: Authenticate & push image
  registry-->>cmd: Publish successful
  cmd->>cmd: Output JSON metadata
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'feat(cli): add features publish command' directly and clearly summarizes the main change: adding a new publish command for features.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@netlify

netlify Bot commented May 11, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit c686aae
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a0269e33b8c80000879b0a6

@skevetter
skevetter force-pushed the feat/features-publish-command branch from 9d21a37 to 041a9a8 Compare May 11, 2026 23:02
skevetter added 2 commits May 11, 2026 18:07
The flagTarget constant was already declared in features_package_cmd.go
within the same package, causing a typecheck lint failure.
…ests

Fixes goconst lint errors for ghcr.io, 1.0.0, and node strings.
@skevetter
skevetter enabled auto-merge (squash) May 12, 2026 07:17
@skevetter
skevetter merged commit 3bc64ed into main May 12, 2026
99 of 100 checks passed
@skevetter
skevetter deleted the feat/features-publish-command branch May 12, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant