imageinspect

package module
v0.0.0-...-e405fbd Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

README ¶

go-imageinspect

CI Status

Go library for accessing container images with their associated objects and typed metadata.

Experimental 🧪

This repository is considered EXPERIMENTAL and under active development until further notice. It is subject to non-backward compatible changes or removal in any future version.

Rationale

Image authors are increasingly distributing associated metadata and artifacts alongside their images, such as OCI annotations, SLSA Provenance, SBOMs, signatures, and more. The exact method of storage can differ across the ecosystem, making this information difficult to consume.

This library provides a unified interface for accessing this metadata and ensuring that it can be consumed consistently.

Support

This library supports pulling metadata from the following formats:

Usage

go-imageinspect is intended to be used as a library. However, for development purposes, a simple command line tool is provided for prototyping:

$ docker buildx bake bin
$ ./bin/imageinspect moby/buildkit:latest

Contributing

Want to contribute? Awesome! You can find information about contributing to this project in the CONTRIBUTING.md

Documentation ¶

Index ¶

Constants ¶

View Source
const (
	AnnotationReference  = "vnd.docker.reference.digest"
	AnnotationImageTitle = "org.opencontainers.image.title"
)

Variables ¶

This section is empty.

Functions ¶

This section is empty.

Types ¶

type ContentCache ¶

type ContentCache interface {
	content.Provider
	content.Ingester
}

type Identity ¶

type Identity struct {
	PublicKey string
}

type Image ¶

type Image struct {
	Title            string
	Platform         string
	Author           string
	Vendor           string
	URL              string
	Source           string
	Revision         string
	Documentation    string
	ShortDescription string
	Description      string
	License          string
	Size             int64

	Signatures []Signature
	SBOM       *SBOM       `json:",omitempty"`
	Provenance *Provenance `json:",omitempty"`
}

type Loader ¶

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

func NewLoader ¶

func NewLoader(opt Opt) (*Loader, error)

func (*Loader) Load ¶

func (l *Loader) Load(ctx context.Context, ref string) (*Result, error)

type Material ¶

type Material struct {
	Type  string `json:",omitempty"`
	Ref   string `json:",omitempty"`
	Alias string `json:",omitempty"`
	Pin   string `json:",omitempty"`
}

type Opt ¶

type Opt struct {
	Resolver remotes.Resolver
	CacheDir string
}

type Package ¶

type Package struct {
	Name        string
	Version     string
	Description string
	Creator     PackageCreator
	DownloadURL string
	HomepageURL string
	License     []string
	Files       []string

	CPEs []string
}

type PackageCreator ¶

type PackageCreator struct {
	Name string // TODO: split name and e-mail
	Org  string `json:",omitempty"`
}

type Provenance ¶

type Provenance struct {
	BuildSource     string            `json:",omitempty"`
	BuildDefinition string            `json:",omitempty"`
	BuildParameters map[string]string `json:",omitempty"`
	Materials       []Material
}

type Result ¶

type Result struct {
	Digest     digest.Digest
	ResultType ResultType
	Platforms  []string
	Images     map[string]Image
}

type ResultType ¶

type ResultType string
const (
	Manifest ResultType = "manifest"
	Index    ResultType = "index"
	Unknown  ResultType = "unknown"
)

type SBOM ¶

type SBOM struct {
	AlpinePackages  []Package `json:",omitempty"`
	UnknownPackages []Package `json:",omitempty"`
}

type Signature ¶

type Signature struct {
	Verified bool
	Identity Identity
}

Directories ¶

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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