schema

package
v0.0.0-...-c3373f0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: Apache-2.0, MIT Imports: 6 Imported by: 6

README

Blueprint Schema

This directory contains the schema for the blueprint file. The schema is created from a combination of generated and static code. The "base" schema is defined as a series of Go structures located in schema.go. Schema properties that cannot be expressed via Go structure tags are contained in schema_overrides.cue.

If you're looking for an authoritative source for the schema, see _embed/schema.cue.

Generation

Generating the schema can be accomplished by running go generate. This causes the following:

  1. The Go structures will have their respective CUE definitions generated in schema_go_gen.cue
  2. All CUE files (including the generated file from the previous step) are consolidated to a single file in _embed/schema.cue

The final generated file is embedded into the SchemaFile package variable.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RawSchemaFile []byte

Functions

This section is empty.

Types

type Blueprint

type Blueprint struct {
	// Version defines the version of the blueprint schema being used.
	Version string `json:"version"`

	// Global contains the global configuration for the blueprint.
	// +optional
	Global Global `json:"global"`

	// Project contains the configuration for the project.
	// +optional
	Project Project `json:"project"`
}

Blueprint contains the schema for blueprint files.

type Global

type Global struct {
	// CI contains the configuration for the CI system.
	// +optional
	CI GlobalCI `json:"ci"`
}

Global contains the global configuration for the blueprint.

type GlobalCI

type GlobalCI struct {
	// Local defines the filters to use when simulating a local CI run.
	Local []string `json:"local"`

	// Providers contains the configuration for the providers being used by the CI system.
	// +optional
	Providers Providers `json:"providers"`

	// Registries contains the container registries to push images to.
	// +optional
	Registries []string `json:"registries"`

	// Secrets contains global secrets that will be passed to all targets.
	// +optional
	Secrets []Secret `json:"secrets"`

	// Tagging contains the tagging configuration for the CI system.
	// +optional
	Tagging Tagging `json:"tagging"`
}

CI contains the configuration for the CI system.

type Project

type Project struct {
	// Name contains the name of the project.
	Name string `json:"name"`

	// Container is the name that the container will be built as.
	Container string `json:"container"`

	// CI contains the configuration for the CI system.
	// +optional
	CI ProjectCI `json:"ci"`
}

Project contains the configuration for the project.

type ProjectCI

type ProjectCI struct {
	// Targets configures the individual targets that are run by the CI system.
	// +optional
	Targets map[string]Target `json:"targets"`
}

type ProviderAWS

type ProviderAWS struct {
	// Role contains the role to assume.
	Role *string `json:"role"`

	// Region contains the region to use.
	Region *string `json:"region"`

	// Registry contains the ECR registry to use.
	// +optional
	Registry *string `json:"registry"`
}

ProviderAWS contains the configuration for the AWS provider.

type ProviderDocker

type ProviderDocker struct {
	// Credentials contains the credentials to use for DockerHub
	Credentials Secret `json:"credentials"`
}

ProviderDocker contains the configuration for the DockerHub provider.

type ProviderEarthly

type ProviderEarthly struct {
	// Credentials contains the credentials to use for Earthly Cloud
	// +optional
	Credentials Secret `json:"credentials"`

	// Org specifies the Earthly Cloud organization to use.
	// +optional
	Org *string `json:"org"`

	// Satellite contains the satellite to use for caching.
	// +optional
	Satellite *string `json:"satellite"`

	// The version of Earthly to use in CI.
	// +optional
	Version *string `json:"version"`
}

ProviderEarthly contains the configuration for the Earthly Cloud provider.

type ProviderGithub

type ProviderGithub struct {
	// Credentials contains the credentials to use for Github
	//  +optional
	Credentials Secret `json:"credentials"`

	// Registry contains the Github registry to use.
	// +optional
	Registry *string `json:"registry"`
}

ProviderGithub contains the configuration for the Github provider.

type Providers

type Providers struct {
	// AWS contains the configuration for the AWS provider.
	// +optional
	AWS ProviderAWS `json:"aws"`

	// Docker contains the configuration for the DockerHub provider.
	// +optional
	Docker ProviderDocker `json:"docker"`

	// Earthly contains the configuration for the Earthly Cloud provider.
	// +optional
	Earthly ProviderEarthly `json:"earthly"`

	// Github contains the configuration for the Github provider.
	// +optional
	Github ProviderGithub `json:"github"`
}

Providers contains the configuration for the providers being used by the CI system.

type SchemaFile

type SchemaFile struct {
	Value   cue.Value
	Version *semver.Version
}

SchemaFile contains the schema for blueprint files.

func LoadSchema

func LoadSchema(ctx *cue.Context) (SchemaFile, error)

LoadSchema loads the schema from the embedded schema file.

func (SchemaFile) Unify

func (s SchemaFile) Unify(v cue.Value) cue.Value

Unify unifies the schema with the given value.

type Secret

type Secret struct {
	// Maps contains mappings for Earthly secret names to JSON keys in the secret.
	// Mutually exclusive with Name.
	// +optional
	Maps map[string]string `json:"maps"`

	// Name contains the name of the Earthly secret to use.
	// Mutually exclusive with Maps.
	// +optional
	Name *string `json:"name"`

	// Optional determines if the secret is optional.
	// +optional
	Optional *bool `json:"optional"`

	// Path contains the path to the secret.
	Path *string `json:"path"`

	// Provider contains the provider to use for the secret.
	Provider *string `json:"provider"`
}

Secret contains the secret provider and a list of mappings

type TagStrategy

type TagStrategy string
const (
	TagStrategyGitCommit TagStrategy = "commit"
)

type Tagging

type Tagging struct {
	// Aliases contains the aliases to use for git tags.
	// +optional
	Aliases map[string]string `json:"aliases"`

	// Strategy contains the tagging strategy to use for containers.
	Strategy TagStrategy `json:"strategy"`
}

type Target

type Target struct {
	// Args contains the arguments to pass to the target.
	// +optional
	Args map[string]string `json:"args"`

	// Platforms contains the platforms to run the target against.
	// +optional
	Platforms []string `json:"platforms"`

	// Privileged determines if the target should run in privileged mode.
	// +optional
	Privileged *bool `json:"privileged"`

	// Retries contains the number of times to retry the target.
	// +optional
	Retries *int `json:"retries"`

	// Secrets contains the secrets to pass to the target.
	// +optional
	Secrets []Secret `json:"secrets"`
}

Target contains the configuration for a single target.

Jump to

Keyboard shortcuts

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