schema

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileShortRef added in v0.9.0

func CompileShortRef(value string) (*proto.Step_Reference, error)

func GitRefDir added in v0.5.0

func GitRefDir(dir string) func(*GitReference)

func LoadSteps

func LoadSteps(filename string) (*Spec, *Step, error)

func ReadSteps

func ReadSteps(content string) (*Spec, *Step, error)

func WriteSteps

func WriteSteps(spec *Spec, step *Step) (string, error)

Types

type Exec

type Exec struct {
	// Command are the parameters to the system exec API. It does not invoke a shell.
	Command []string `json:"command" yaml:"command" mapstructure:"command"`

	// WorkDir is the working directly in which `command` will be exec'ed.
	WorkDir *string `json:"work_dir,omitempty" yaml:"work_dir,omitempty" mapstructure:"work_dir,omitempty"`
}

func (*Exec) UnmarshalJSON

func (j *Exec) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type GitReference

type GitReference struct {
	// Dir corresponds to the JSON schema field "dir".
	Dir *string `json:"dir,omitempty" yaml:"dir,omitempty" mapstructure:"dir,omitempty"`

	// Rev corresponds to the JSON schema field "rev".
	Rev string `json:"rev" yaml:"rev" mapstructure:"rev"`

	// Url corresponds to the JSON schema field "url".
	Url string `json:"url" yaml:"url" mapstructure:"url"`

	// File corresponds to the JSON schema field "file".
	File *string `json:"file,omitempty" yaml:"file,omitempty" mapstructure:"file,omitempty"`
}

GitReference is a reference to a step in a Git repository containing the full set of configuration options.

func NewGitReference added in v0.5.0

func NewGitReference(url, rev string, options ...func(*GitReference)) *GitReference

func (*GitReference) UnmarshalJSON

func (j *GitReference) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Input

type Input struct {
	// AdditionalProperties corresponds to the JSON schema field
	// "additionalProperties".
	AdditionalProperties any `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty" mapstructure:"additionalProperties,omitempty"`

	// Default is the default input value. Its type must match `type`.
	Default any `json:"default,omitempty" yaml:"default,omitempty" mapstructure:"default,omitempty"`

	// Sensitive implies the input is of sensitive nature and effort should be made to
	// prevent accidental disclosure.
	Sensitive *bool `json:"sensitive,omitempty" yaml:"sensitive,omitempty" mapstructure:"sensitive,omitempty"`

	// Type is the value type of the input.
	Type *InputType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"`
}

type InputType

type InputType string
const InputTypeArray InputType = "array"
const InputTypeBoolean InputType = "boolean"
const InputTypeNumber InputType = "number"
const InputTypeString InputType = "string"
const InputTypeStruct InputType = "struct"

func (*InputType) UnmarshalJSON

func (j *InputType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type OCIReference added in v0.5.0

type OCIReference struct {
	// Registry corresponds to the JSON schema field "registry".
	Registry string `json:"registry" yaml:"registry" mapstructure:"registry"`

	// Repository corresponds to the JSON schema field "repository".
	Repository string `json:"repository" yaml:"repository" mapstructure:"repository"`

	// Tag corresponds to the JSON schema field "tag".
	Tag string `json:"tag" yaml:"tag" mapstructure:"tag"`

	// Dir corresponds to the JSON schema field "dir".
	Dir *string `json:"dir,omitempty" yaml:"dir,omitempty" mapstructure:"dir,omitempty"`

	// File corresponds to the JSON schema field "file".
	File *string `json:"file,omitempty" yaml:"file,omitempty" mapstructure:"file,omitempty"`
}

OCIReference is a reference to a step in an OCI image that is hosted in an OCI repository.

func NewOCIReference added in v0.5.0

func NewOCIReference(registry, repository, tag string) *OCIReference

func (*OCIReference) UnmarshalJSON added in v0.5.0

func (j *OCIReference) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Output

type Output struct {
	// Default is the default output value.
	Default any `json:"default,omitempty" yaml:"default,omitempty" mapstructure:"default,omitempty"`

	// Sensitive implies the output is of sensitive nature and effort should be made
	// to prevent accidental disclosure.
	Sensitive *bool `json:"sensitive,omitempty" yaml:"sensitive,omitempty" mapstructure:"sensitive,omitempty"`

	// Type is the value type of the output.
	Type *OutputType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"`
}

Output describes a single step output.

type OutputType

type OutputType string
const OutputTypeArray OutputType = "array"
const OutputTypeBoolean OutputType = "boolean"
const OutputTypeNumber OutputType = "number"
const OutputTypeString OutputType = "string"
const OutputTypeStruct OutputType = "struct"

func (*OutputType) UnmarshalJSON

func (j *OutputType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Outputs

type Outputs map[string]Output

type Reference

type Reference struct {
	// Git corresponds to the JSON schema field "git".
	Git *GitReference `json:"git,omitempty" yaml:"git,omitempty" mapstructure:"git,omitempty"`

	// OCI corresponds to the JSON schema field "oci".
	OCI *OCIReference `json:"oci,omitempty" yaml:"oci,omitempty" mapstructure:"oci,omitempty"`
}

Reference is a reference to a step in either a Git repository or an OCI image

func (*Reference) UnmarshalJSON

func (r *Reference) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Signature

type Signature struct {
	// Input describes a single step input.
	Inputs map[string]Input `json:"inputs,omitempty" yaml:"inputs,omitempty" mapstructure:"inputs,omitempty"`

	// Outputs corresponds to the JSON schema field "outputs".
	Outputs any `json:"outputs,omitempty" yaml:"outputs,omitempty" mapstructure:"outputs,omitempty"`
}

Signature contains the inputs and outputs of the step.

func (*Signature) UnmarshalJSON

func (s *Signature) UnmarshalJSON(data []byte) error

func (*Signature) UnmarshalYAML

func (s *Signature) UnmarshalYAML(value *yaml.Node) error

type Spec

type Spec struct {
	// Spec corresponds to the JSON schema field "spec".
	Spec *Signature `json:"spec,omitempty" yaml:"spec,omitempty" mapstructure:"spec,omitempty"`
}

Spec is a document describing the interface of a step.

func (*Spec) Compile

func (spec *Spec) Compile() (*proto.Spec, error)

type Step

type Step struct {
	// Action is a GitHub action to run.
	Action *string `json:"action,omitempty" yaml:"action,omitempty" mapstructure:"action,omitempty"`

	// Delegate selects a step by name which will produce the outputs a run.
	Delegate *string `json:"delegate,omitempty" yaml:"delegate,omitempty" mapstructure:"delegate,omitempty"`

	// Env is a map of environment variable names to string values.
	Env map[string]string `json:"env,omitempty" yaml:"env,omitempty" mapstructure:"env,omitempty"`

	// Exec is a command to run.
	Exec *Exec `json:"exec,omitempty" yaml:"exec,omitempty" mapstructure:"exec,omitempty"`

	// Inputs is a map of step input names to structured values.
	Inputs StepInputs `json:"inputs,omitempty" yaml:"inputs,omitempty" mapstructure:"inputs,omitempty"`

	// Name is a unique identifier for this step.
	Name *string `json:"name,omitempty" yaml:"name,omitempty" mapstructure:"name,omitempty"`

	// Outputs are the output values for a sequence. They can reference the outputs of
	// sub-steps.
	Outputs StepOutputs `json:"outputs,omitempty" yaml:"outputs,omitempty" mapstructure:"outputs,omitempty"`

	// Script is a shell script to evaluate.
	Script *string `json:"script,omitempty" yaml:"script,omitempty" mapstructure:"script,omitempty"`

	// Step is a reference to another step to invoke.
	Step any `json:"step,omitempty" yaml:"step,omitempty" mapstructure:"step,omitempty"`

	// Run is a list of sub-steps to run.
	Run []Step `json:"run,omitempty" yaml:"run,omitempty" mapstructure:"run,omitempty"`
}

Step is a unit of execution.

func (*Step) Compile

func (s *Step) Compile() (*proto.Definition, error)

func (*Step) CompileStep

func (s *Step) CompileStep() (*proto.Step, error)

func (*Step) UnmarshalJSON

func (s *Step) UnmarshalJSON(data []byte) error

func (*Step) UnmarshalYAML

func (s *Step) UnmarshalYAML(value *yaml.Node) error

type StepInputs

type StepInputs map[string]interface{}

Inputs is a map of step input names to structured values.

type StepOutputs

type StepOutputs map[string]interface{}

Outputs are the output values for a sequence. They can reference the outputs of sub-steps.

Jump to

Keyboard shortcuts

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