schema

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

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

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 interface{} `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty" mapstructure:"additionalProperties,omitempty"`

	// Default is the default input value. Its type must match `type`.
	Default InputDefault `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 InputDefault

type InputDefault interface{}

Default is the default input value. Its type must match `type`.

type InputDefaultTypes

type InputDefaultTypes interface{}

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 Output

type Output struct {
	// Default is the default output value.
	Default OutputDefault `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 OutputDefault

type OutputDefault interface{}

Default is the default output value.

type OutputDefaultTypes

type OutputDefaultTypes interface{}

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" yaml:"git" mapstructure:"git"`
}

Git a reference to a step in a Git repository.

func (*Reference) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

type Signature

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

	// Outputs corresponds to the JSON schema field "outputs".
	Outputs interface{} `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 SignatureInputs

type SignatureInputs map[string]Input

Input describes a single step input.

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 StepEnv `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 interface{} `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(i int) (*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 StepEnv

type StepEnv map[string]string

Env is a map of environment variable names to string values.

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