feat: add support for CNCF WASM OCI Artifact media types

Summary

The GitLab Container Registry does not support the CNCF WASM OCI Artifact media types defined by the CNCF TAG Runtime WASM Working Group. This prevents users from pushing WebAssembly components using standard tooling like wkg from the Bytecode Alliance.

Problem

When pushing WASM components using wkg oci push, the registry returns:

Error: Unable to push image
Caused by:
    Server error: url https://registry.gitlab.com/v2/.../manifests/...,
    code: 400,
    message: {"errors":[{"code":"MANIFEST_INVALID","message":"manifest invalid","detail":"unknown media type: application/vnd.wasm.config.v0+json"}]}

Requested Media Types

The following media types from the CNCF WASM OCI Artifact specification should be added:

Media Type Purpose
application/vnd.wasm.config.v0+json WASM component configuration (imports, exports, target world)
application/wasm WASM binary content layer

Reference Specification

  • Spec: https://tag-runtime.cncf.io/wgs/wasm/deliverables/wasm-oci-artifact/
  • Config schema: Contains created, architecture ("wasm"), os ("wasip1"/"wasip2"), layerDigests, and component metadata (exports, imports, target)

Example Manifest

{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "config": {
    "mediaType": "application/vnd.wasm.config.v0+json",
    "digest": "sha256:...",
    "size": 256
  },
  "layers": [
    {
      "mediaType": "application/wasm",
      "digest": "sha256:...",
      "size": 528147
    }
  ]
}

Current Workaround

Users must use ORAS with the older Solo.io media types that GitLab already supports:

# Create empty config (Solo.io spec allows empty config)
echo '{}' > /tmp/config.json

# Push with GitLab-supported media types
oras push \
  --config /tmp/config.json:application/vnd.module.wasm.config.v1+json \
  registry.gitlab.com/namespace/project/component:tag \
  component.wasm:application/vnd.wasm.content.layer.v1+wasm

This works but:

  1. Requires manual config file creation
  2. Is incompatible with standard WASM tooling (wkg, warg)
  3. Uses a 6-year-old spec instead of the current CNCF standard
  4. Does not include component metadata (imports, exports, target world)

Ecosystem Context

WebAssembly components are gaining adoption:

  • Bytecode Alliance wasm-pkg-tools - official tooling
  • WASI Preview 2 - component model
  • wasmCloud, Spin, Wasmer - runtimes using OCI distribution

Other registries supporting CNCF WASM media types:

  • GitHub Container Registry (ghcr.io)
  • Docker Hub
  • Azure Container Registry

Similar Past Requests

  • Flux media types (#399923) - added in GitLab 16.x
  • Falco media types (#1089) - added in GitLab 16.3

Proposal

Add the CNCF WASM media types to docs/supported-media-types.md and the registry validation code, following the pattern used for Flux and Falco media types.

Assignee Loading
Time tracking Loading