configadapter

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 25 Imported by: 1

Documentation

Overview

Package configadapter converts a Porter manifest (porter.yaml) to a CNAB bundle.json

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToTestBundle added in v1.0.1

func ConvertToTestBundle(ctx context.Context, cfg *config.Config, manifest *manifest.Manifest) (cnab.ExtendedBundle, error)

ConvertToTestBundle is suitable for taking a test manifest (porter.yaml) and making a bundle.json for it. Does not make an accurate representation of the bundle, but is suitable for testing.

func LoadTestBundle added in v1.0.12

func LoadTestBundle(t *testing.T, config *config.Config, path string) cnab.ExtendedBundle

Types

type ManifestConverter

type ManifestConverter struct {
	Manifest        *manifest.Manifest
	ImageDigests    map[string]string
	InstalledMixins []mixin.Metadata
	// contains filtered or unexported fields
}

ManifestConverter converts from a porter manifest to a CNAB bundle definition.

func NewManifestConverter

func NewManifestConverter(
	config *config.Config,
	manifest *manifest.Manifest,
	imageDigests map[string]string,
	mixins []mixin.Metadata,
) *ManifestConverter

func (*ManifestConverter) DigestManifest

func (c *ManifestConverter) DigestManifest() (string, error)

func (*ManifestConverter) GenerateStamp

func (c *ManifestConverter) GenerateStamp(ctx context.Context) (Stamp, error)

func (*ManifestConverter) ToBundle

type MixinRecord

type MixinRecord struct {
	// Name of the mixin used in the bundle. This is used for sorting only, and
	// should not be written to the Porter's stamp in bundle.json because we are
	// storing these mixin records in a map, keyed by the mixin name.
	Name string `json:"-"`

	// Version of the mixin used in the bundle.
	Version string `json:"version"`
}

MixinRecord contains information about a mixin used in a bundle For now it is a placeholder for data that we would like to include in the future.

type MixinRecords added in v1.0.13

type MixinRecords []MixinRecord

func (MixinRecords) Len added in v1.0.13

func (m MixinRecords) Len() int

func (MixinRecords) Less added in v1.0.13

func (m MixinRecords) Less(i, j int) bool

func (MixinRecords) Swap added in v1.0.13

func (m MixinRecords) Swap(i, j int)

type Stamp

type Stamp struct {
	// ManifestDigest takes into account all unique data that goes into a
	// porter build to help determine if the last build is stale.
	// * manifest
	// * mixins
	// * (TODO) files in current directory
	ManifestDigest string `json:"manifestDigest"`

	// Mixins used in the bundle.
	Mixins map[string]MixinRecord `json:"mixins"`

	// Manifest is the base64 encoded porter.yaml.
	EncodedManifest string `json:"manifest"`

	// Version and commit define the version of the Porter used when a bundle was built.
	Version string `json:"version"`
	Commit  string `json:"commit"`
}

Stamp contains Porter specific metadata about a bundle that we can place in the custom section of a bundle.json

func LoadStamp

func LoadStamp(bun cnab.ExtendedBundle) (Stamp, error)

func (Stamp) DecodeManifest

func (s Stamp) DecodeManifest() ([]byte, error)

DecodeManifest base64 decodes the manifest stored in the stamp

func (Stamp) WriteManifest

func (s Stamp) WriteManifest(cxt *portercontext.Context, path string) error

Jump to

Keyboard shortcuts

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