circleci

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvaluateConditional

func EvaluateConditional(expand ExpandFunc, c *Conditional) bool

EvaluateConditional evaluates a Conditional, expanding any variables using the given ExpandFunc before evaluating.

func Expand

func Expand(b []byte, expand ExpandFunc) (p []byte)

Expand takes bytes and an ExpandFunc. Whenever it encounters a variable in the bytes, signified by e.g. "<< example >>", it calls ExpandFunc with the variable name and replaces the variable with the result. It returns the fully expanded bytes.

func ExpandString

func ExpandString(s string, expand ExpandFunc) string

ExpandString is a convenience method for Expanding strings. See Expand.

Types

type Command

type Command struct {
	Description string     `json:"description,omitempty" yaml:",omitempty"`
	Parameters  Parameters `json:"parameters,omitempty" yaml:",omitempty"`
	Steps       []Step     `json:"steps,omitempty" yaml:",omitempty"`
}

type Conditional

type Conditional struct {
	Condition any    `json:"condition,omitempty" yaml:",omitempty"`
	Steps     []Step `json:"steps,omitempty" yaml:",omitempty"`
}

Conditional is a `when` or `unless` in a CircleCI Orb step.

type Config

type Config struct {
	Version float64           `json:"version,omitempty" yaml:",omitempty"`
	Orbs    map[string]string `json:"orbs,omitempty" yaml:",omitempty"`
}

Config is the subset of a CircleCI configuration file relevant to finding Orb aliases.

type ExpandFunc

type ExpandFunc func(string) string

ExpandFunc takes a variable name and returns the variable value.

func (ExpandFunc) Expand

func (e ExpandFunc) Expand(b []byte) []byte

func (ExpandFunc) ExpandString

func (e ExpandFunc) ExpandString(s string) string

type Job

type Job struct {
	Command  `json:",inline"`
	Executor map[string]any `json:"executor,omitempty" yaml:",omitempty"`
}

type Orb

type Orb struct {
	Name    string
	Version string
}

Orb is a parsed orb reference e.g. "circleci/node@5.1.0".

func Parse

func Parse(orb string) (*Orb, error)

func (*Orb) GoString

func (o *Orb) GoString() string

func (*Orb) MarshalJSON

func (o *Orb) MarshalJSON() ([]byte, error)

func (*Orb) String

func (o *Orb) String() string

type Parameter

type Parameter struct {
	Default     any      `json:"default,omitempty" yaml:",omitempty"`
	Description string   `json:"description,omitempty" yaml:",omitempty"`
	Type        string   `json:"type,omitempty" yaml:",omitempty"`
	Enum        []string `json:"enum,omitempty" yaml:",omitempty"`
}

type Parameters

type Parameters map[string]Parameter

type Source

type Source struct {
	Version     float64 `json:"version,omitempty" yaml:",omitempty"`
	Description string  `json:"description,omitempty" yaml:",omitempty"`
	Display     *struct {
		HomeURL   string `json:"home_url,omitempty" yaml:",omitempty"`
		SourceURL string `json:"source_url,omitempty" yaml:",omitempty"`
	} `json:"display,omitempty"`
	Commands  map[string]Command `json:"commands,omitempty" yaml:",omitempty"`
	Executors map[string]struct {
		Description string `json:"description,omitempty" yaml:",omitempty"`
		Docker      []struct {
			Image string `json:"image,omitempty" yaml:",omitempty"`
		}
		Parameters Parameters `json:"parameters,omitempty" yaml:",omitempty"`
	} `json:"executors,omitempty"`
	Jobs map[string]Job
}

func GetOrbSource

func GetOrbSource(ctx context.Context, o *Orb) (*Source, error)

type Step

type Step struct {
	When   *Conditional `json:"when,omitempty" yaml:",omitempty"`
	Unless *Conditional `json:"unless,omitempty" yaml:",omitempty"`
	Run    *struct {
		Name             string            `json:"name,omitempty" yaml:",omitempty"`
		Command          string            `json:"command,omitempty" yaml:",omitempty"`
		WorkingDirectory string            `json:"working_directory,omitempty" yaml:",omitempty"`
		Environment      map[string]string `json:"environment,omitempty" yaml:",omitempty"`
	} `json:"run,omitempty" yaml:",omitempty"`
	Dynamic map[string]map[string]any `json:",inline" yaml:",inline"`
}

Step ...

	steps:
   - when:
 	  condition:
		    equal:
		      - 1.0.0
		      - << parameters.version >>
	      run:
		    command: env
   - run:
       command: env
   - node/install:
	      key: value

Jump to

Keyboard shortcuts

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