artifact

package
v0.1.0-preview.9.rc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2025 License: MIT Imports: 18 Imported by: 0

README

OCI Artifact Package

This package provides functionality for creating and managing OCI (Open Container Initiative) artifacts specifically designed for EigenRuntime specifications. It uses the oras-go library to create standards-compliant OCI artifacts with custom media types.

Overview

The artifact package enables DevKit to package EigenRuntime specifications as OCI artifacts, making them distributable through standard container registries like Docker Hub, GitHub Container Registry (GHCR), Amazon ECR, and others.

Key Features

  • Standards-Compliant OCI Artifacts: Creates artifacts that fully comply with the OCI specification
  • Custom Media Types: Supports EigenRuntime-specific media types for configs and layers
  • Registry Authentication: Integrates with Docker credential helpers for seamless authentication
  • In-Memory Construction: Uses memory stores for efficient artifact building before pushing

Architecture

OCI Artifact Structure

The package creates OCI artifacts with the following manifest structure:

{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "artifactType": "application/vnd.eigenruntime.manifest.v1",
  "config": {
    "mediaType": "application/vnd.eigenruntime.manifest.config.v1+json",
    "digest": "sha256:<config-digest>",
    "size": <config-size>
  },
  "layers": [{
    "mediaType": "text/yaml",
    "digest": "sha256:<runtime-spec-digest>",
    "size": <spec-size>
  }],
  "annotations": {
    "org.opencontainers.image.source": "https://github.com/Layr-Labs/devkit-cli",
    "org.opencontainers.image.description": "EigenRuntime specification for <name>",
    "org.opencontainers.image.created": "<timestamp>",
    "io.eigenruntime.spec.version": "v1"
  }
}
Config Blob Format

The config blob contains metadata about the EigenRuntime specification:

{
  "formatVersion": "1.0",
  "eigenRuntimeAPIVersion": "v1",
  "kind": "template-type",
  "avsName": "<avs-name>",
  "validationSchema": "https://eigenruntime.io/schemas/template-type/v1/manifest.json",
  "metadata": {
    "createdAt": "2024-01-01T00:00:00Z",
    "releaseVersion": "<release-version>",
    "devkitVersion": "<devkit-version>"
  }
}

Authentication

The package automatically uses Docker's credential helpers for authentication through auth.DefaultClient. This means:

  1. It will use credentials from ~/.docker/config.json
  2. It supports Docker credential helpers (e.g., docker-credential-desktop, docker-credential-ecr-login)
  3. No manual credential configuration is needed if you're already logged in via docker login
  4. The DOCKER_CONFIG environment variable is respected if set

To authenticate with a registry, simply use docker login before running DevKit:

docker login ghcr.io
# or
docker login <your-registry>

Troubleshooting

Inspecting OCI Artifacts

Important: Don't use docker pull to inspect OCI artifacts, as Docker may transform the manifest for compatibility. Instead, use:

Using oras CLI:
# Fetch the manifest
oras manifest fetch ghcr.io/myorg/my-avs:opset-0-v1

# Pull the artifact locally
oras pull ghcr.io/myorg/my-avs:opset-0-v1
Using crane CLI:
# View the manifest
crane manifest ghcr.io/myorg/my-avs:opset-0-v1 | jq .

# Export the artifact
crane export ghcr.io/myorg/my-avs:opset-0-v1 - | tar -tv

These tools preserve the original OCI artifact structure, including the artifactType field and proper media types.

Registry Compatibility

All major registries support OCI artifacts with artifactType. However, some registry web UIs may display artifacts differently than their actual stored format:

Verifying Your Artifact

To see the actual OCI artifact manifest stored in the registry:

# Use oras to inspect the manifest
oras manifest fetch ghcr.io/myorg/my-avs:tag | jq .

# Or use crane
crane manifest ghcr.io/myorg/my-avs:tag | jq .

# Even docker shows the correct manifest
docker manifest inspect ghcr.io/myorg/my-avs:tag | jq .
{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "artifactType": "application/vnd.eigenruntime.manifest.v1",
  "config": {
    "mediaType": "application/vnd.eigenruntime.manifest.config.v1+json",
    "digest": "sha256:...",
    "size": 323
  },
  "layers": [{
    "mediaType": "text/yaml",
    "digest": "sha256:...",
    "size": 663
  }],
  "annotations": {
    "org.opencontainers.image.source": "https://github.com/Layr-Labs/devkit-cli",
    "org.opencontainers.image.description": "EigenRuntime specification for ...",
    "org.opencontainers.image.created": "2025-01-01T00:00:00Z",
    "io.eigenruntime.spec.version": "v1"
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeRuntimeSpecDigest

func ComputeRuntimeSpecDigest(runtimeSpec []byte) string

ComputeRuntimeSpecDigest computes the SHA256 digest of a runtime spec

Types

type OCIArtifactBuilder

type OCIArtifactBuilder struct {
	// contains filtered or unexported fields
}

OCIArtifactBuilder creates OCI artifacts for EigenRuntime specs

func NewOCIArtifactBuilder

func NewOCIArtifactBuilder(logger iface.Logger) *OCIArtifactBuilder

NewOCIArtifactBuilder creates a new OCI artifact builder

func (*OCIArtifactBuilder) CreateEigenRuntimeArtifact

func (b *OCIArtifactBuilder) CreateEigenRuntimeArtifact(
	runtimeSpec []byte,
	registry string,
	avsName string,
	tag string,
) (string, error)

CreateEigenRuntimeArtifact creates and pushes an OCI artifact containing the runtime spec Using oras-go for full OCI artifact support including custom media types and artifactType

This implementation produces an OCI artifact with the following structure:

{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "artifactType": "application/vnd.eigenruntime.manifest.v1",
  "config": {
    "mediaType": "application/vnd.eigenruntime.manifest.config.v1+json",
    "digest": "sha256:<config-digest>",
    "size": <config-size>
  },
  "layers": [{
    "mediaType": "text/yaml",
    "digest": "sha256:<runtime-spec-digest>",
    "size": <spec-size>
  }],
  "annotations": {
    "org.opencontainers.image.source": "https://github.com/Layr-Labs/devkit-cli",
    "org.opencontainers.image.description": "EigenRuntime specification for <name>",
    "org.opencontainers.image.created": "<timestamp>",
    "io.eigenruntime.spec.version": "v1"
  }
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL