prototype

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

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

Go to latest
Published: Apr 22, 2021 License: Apache-2.0 Imports: 26 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

oci-image prototype (prototype)

A (prototype) Concourse prototype for building OCI images. Currently uses buildkit for building.

Code stolen shamelessly from Adapted from vito/oci-build-task.

Not gonna document usage because you can't use this in Concourse yet!

However, it can build itself locally by running:

jq -n '{object: {context: "input", output: "image", cache: true}, response_path: "/dev/null"}' | \
  docker run --rm -i \
  --privileged \
  -w /workdir \
  -v "$(pwd):/workdir/input" \
  -v "/tmp/output:/workdir/image" \
  -v "/tmp/cache:/workdir/cache" \
  aoldershaw/oci-image-prototype build

...and it'll be built to /tmp/output/image.tar.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(img OCIImage, buildkitd *Buildkitd, outputsDir string) error

func BuildConfig

func BuildConfig(img OCIImage) prototype.Config

func Prototype

func Prototype() prototype.Prototype

func RunBuild

func RunBuild(img OCIImage) ([]prototype.MessageResponse, error)

func ServeRegistry

func ServeRegistry(reg LocalRegistry) (string, error)

Types

type Buildkitd

type Buildkitd struct {
	Addr string
	// contains filtered or unexported fields
}

func SpawnBuildkitd

func SpawnBuildkitd(ociImage OCIImage, opts *BuildkitdOpts) (*Buildkitd, error)

func (*Buildkitd) Cleanup

func (buildkitd *Buildkitd) Cleanup() error

type BuildkitdConfig

type BuildkitdConfig struct {
	Registries map[string]RegistryConfig `toml:"registry"`
}

type BuildkitdOpts

type BuildkitdOpts struct {
	RootDir    string
	ConfigPath string
}

BuildkitdOpts to provide to Buildkitd

type ImageMetadata

type ImageMetadata struct {
	Env  []string `json:"env"`
	User string   `json:"user"`
}

ImageMetadata is the schema written to manifest.json when producing the legacy Concourse image format (rootfs/..., metadata.json).

type LocalRegistry

type LocalRegistry map[string]v1.Image

func LoadRegistry

func LoadRegistry(imagePaths map[string]string) (LocalRegistry, error)

func (LocalRegistry) BuildArgs

func (registry LocalRegistry) BuildArgs(port string) []string

func (LocalRegistry) GetBlob

func (registry LocalRegistry) GetBlob(w http.ResponseWriter, r *http.Request, p httprouter.Params)

func (LocalRegistry) GetManifest

func (registry LocalRegistry) GetManifest(w http.ResponseWriter, r *http.Request, p httprouter.Params)

type OCIImage

type OCIImage struct {
	Debug bool `json:"debug"`

	ContextDir     string            `json:"context" prototype:"required"`
	ContextInputs  map[string]string `json:"context_inputs,omitempty"`
	DockerfilePath string            `json:"dockerfile,omitempty"`

	Output string `json:"output" prototype:"required"`
	Cache  bool   `json:"cache,omitempty"`

	Target            string   `json:"target"`
	AdditionalTargets []string `json:"additional_targets"`

	BuildArgs []string `json:"build_args"`

	RegistryMirrors []string `json:"registry_mirrors"`

	Labels []string `json:"labels"`

	BuildkitSecrets map[string]string `json:"buildkit_secrets"`

	// Unpack the OCI image into Concourse's rootfs/ + metadata.json image scheme.
	//
	// Theoretically this would go away if/when we standardize on OCI.
	UnpackRootfs bool `json:"unpack_rootfs"`

	// Images to pre-load in order to avoid fetching at build time. Mapping from
	// build arg name to OCI image tarball path.
	//
	// Each image will be pre-loaded and a build arg will be set to a value
	// appropriate for setting in 'FROM ...'.
	ImageArgs []string `json:"image_args"`

	AddHosts string `json:"add_hosts"`
}

OCIImage is the object being acted upon by the prototype.

type RegistryConfig

type RegistryConfig struct {
	Mirrors      []string     `toml:"mirrors"`
	PlainHTTP    *bool        `toml:"http"`
	Insecure     *bool        `toml:"insecure"`
	RootCAs      []string     `toml:"ca"`
	KeyPairs     []TLSKeyPair `toml:"keypair"`
	TLSConfigDir []string     `toml:"tlsconfigdir"`
}

type TLSConfig

type TLSConfig struct {
	Cert string `toml:"cert"`
	Key  string `toml:"key"`
	CA   string `toml:"ca"`
}

type TLSKeyPair

type TLSKeyPair struct {
	Key         string `toml:"key"`
	Certificate string `toml:"cert"`
}

Directories

Path Synopsis
cmd
prototype command

Jump to

Keyboard shortcuts

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