schema

package
v0.0.0-...-bdb2e15 Latest Latest
Warning

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

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

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 Deployment

type Deployment struct {
	// Environment contains the environment to deploy the module to.
	Environment string `json:"environment"`

	// On contains the events that trigger the deployment.
	On map[string]any `json:"on"`

	// Modules contains the configuration for the deployment modules for the project.
	// +optional
	Modules *DeploymentModules `json:"modules"`
}

Deployment contains the configuration for the deployment of the project.

type DeploymentModules

type DeploymentModules struct {
	// Main contains the configuration for the main deployment module.
	Main Module `json:"main"`

	// Support contains the configuration for the support deployment modules.
	// +optional
	Support map[string]Module `json:"support"`
}

Deployment contains the configuration for the deployment of the project.

type Global

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

	// Deployment contains the global configuration for the deployment of projects.
	// +optional
	Deployment GlobalDeployment `json:"deployment"`

	// Repo contains the configuration for the GitHub repository.
	Repo GlobalRepo `json:"repo"`
}

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"`
}

CI contains the configuration for the CI system.

type GlobalDeployment

type GlobalDeployment struct {
	// Registry contains the URL of the container registry holding the deployment code.
	Registry string `json:"registry"`

	// Repo contains the configuration for the global deployment repository.
	Repo GlobalDeploymentRepo `json:"repo"`

	// Root contains the root deployment directory in the deployment repository.
	Root string `json:"root"`
}

GlobalDeployment contains the configuration for the global deployment of projects.

type GlobalDeploymentRepo

type GlobalDeploymentRepo struct {
	// Ref contains the ref to use for the deployment repository.
	Ref string `json:"ref"`

	// URL contains the URL of the deployment repository.
	Url string `json:"url"`
}

GlobalDeploymentRepo contains the configuration for the global deployment repository.

type GlobalRepo

type GlobalRepo struct {
	// Name contains the name of the repository (e.g. "owner/repo-name").
	Name string `json:"name"`

	// DefaultBranch contains the default branch of the repository.
	DefaultBranch string `json:"defaultBranch"`
}

type Module

type Module struct {
	// Container contains the name of the container holding the deployment code.
	// Defaults to <module_name>-deployment). For the main module, <module_name> is the project name.
	// +optional
	Container *string `json:"container"`

	// Namespace contains the namespace to deploy the module to.
	Namespace string `json:"namespace"`

	// Values contains the values to pass to the deployment module.
	Values any `json:"values"`

	// Version contains the version of the deployment module.
	Version string `json:"version"`
}

Module contains the configuration for a deployment module.

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"`

	// Deployment contains the configuration for the deployment of the project.
	// +optional
	Deployment Deployment `json:"deployment"`

	// Release contains the configuration for the release of the project.
	// +optional
	Release map[string]Release `json:"release"`
}

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 {
	// ECR contains the configuration for AWS ECR.
	// +optional
	ECR ProviderAWSECR `json:"ecr"`

	// Role contains the role to assume.
	Role string `json:"role"`

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

ProviderAWS contains the configuration for the AWS provider.

type ProviderAWSECR

type ProviderAWSECR struct {
	// AutoCreate contains whether to automatically create ECR repositories.
	// +optional
	AutoCreate *bool `json:"autoCreate"`

	// Registry is the ECR registry to login to during CI operations.
	// +optional
	Registry *string `json:"registry"`
}

type ProviderCue

type ProviderCue struct {
	// Install contains whether to install CUE in the CI environment.
	// +optional
	Install *bool `json:"install"`

	// Registry contains the CUE registry to use.
	Registry *string `json:"registry"`

	// RegistryPrefix contains the prefix to use for CUE registries.
	// +optional
	RegistryPrefix *string `json:"registryPrefix"`

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

ProviderCue contains the configuration for the CUE 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 ProviderGit

type ProviderGit struct {
	// Credentials contains the credentials to use for interacting with private repositories.
	// +optional
	Credentials *Secret `json:"credentials"`
}

ProviderGit contains the configuration for the Git 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"`

	// CUE contains the configuration for the CUE provider.
	// +optional
	CUE ProviderCue `json:"cue"`

	// 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"`

	// Git contains the configuration for the Git provider.
	// +optional
	Git ProviderGit `json:"git"`

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

	// Timoni contains the configuration for the Timoni provider.
	// +optional
	Timoni TimoniProvider `json:"timoni"`
}

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

type Release

type Release struct {
	// Config contains the configuration to pass to the release.
	// +optional
	Config any `json:"config"`

	// On contains the events that trigger the release.
	On map[string]any `json:"on"`

	// Target is the Earthly target to run for this release.
	// Defaults to release name.
	// +optional
	Target string `json:"target"`
}

Release contains the configuration for a project release.

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 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.

type TimoniProvider

type TimoniProvider struct {
	// Install contains whether to install Timoni in the CI environment.
	// +optional
	Install *bool `json:"install"`

	// Registries contains the registries to use for publishing Timoni modules
	Registries []string `json:"registries"`

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

TimoniProvider contains the configuration for the Timoni provider.

Jump to

Keyboard shortcuts

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