config

package
v0.1.30549 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Making this the one true source for default config path
	DefaultConfigPath = ".circleci/config.yml"
)

Functions

func GetCompileHost added in v0.1.28196

func GetCompileHost(cfgHost string) string

Types

type APIClient added in v0.1.28745

type APIClient interface {
	CompileConfig(configContent string, orgID string, params Parameters, values Values) (*ConfigResponse, error)
}

type BuildConfigResponse added in v0.1.26061

type BuildConfigResponse struct {
	BuildConfig struct {
		LegacyConfigResponse
	}
}

BuildConfigResponse wraps the GQL result of the ConfigQuery

type CompileConfigRequest

type CompileConfigRequest struct {
	ConfigYaml string  `json:"config_yaml"`
	Options    Options `json:"options"`
}

CompileConfigRequest - the structure of the data we send to the downstream compilation service.

type ConfigCompiler added in v0.1.25569

type ConfigCompiler struct {
	// contains filtered or unexported fields
}

func New added in v0.1.25569

func New(apiClient APIClient, collaboratorsClient collaborators.CollaboratorsClient) *ConfigCompiler

func NewWithConfig added in v0.1.28745

func NewWithConfig(cfg *settings.Config) (*ConfigCompiler, error)

func (*ConfigCompiler) ConfigQuery added in v0.1.25569

func (c *ConfigCompiler) ConfigQuery(
	configPath string,
	orgID string,
	params Parameters,
	values Values,
) (*ConfigResponse, error)

ConfigQuery - attempts to compile or validate a given config file with the passed in params/values. If the orgID is passed in, the config-compilation with private orbs should work.

func (*ConfigCompiler) ProcessConfig added in v0.1.25569

func (c *ConfigCompiler) ProcessConfig(opts ProcessConfigOpts) (response *ConfigResponse, err error)

func (*ConfigCompiler) ValidateConfig added in v0.1.25569

func (c *ConfigCompiler) ValidateConfig(opts ValidateConfigOpts) error

The <path> arg is actually optional, in order to support compatibility with the --path flag.

type ConfigError

type ConfigError struct {
	Message string `json:"message"`
}

type ConfigResponse

type ConfigResponse struct {
	Valid      bool          `json:"valid"`
	SourceYaml string        `json:"source-yaml"`
	OutputYaml string        `json:"output-yaml"`
	Errors     []ConfigError `json:"errors"`
}

ConfigResponse - the structure of what is returned from the downstream compilation endpoint

type GQLErrorsCollection added in v0.1.26061

type GQLErrorsCollection []GQLResponseError

GQLErrorsCollection is a slice of errors returned by the GraphQL server. Each error is made up of a GQLResponseError type.

func (GQLErrorsCollection) Error added in v0.1.26061

func (errs GQLErrorsCollection) Error() string

Error turns a GQLErrorsCollection into an acceptable error string that can be printed to the user.

type GQLResponseError added in v0.1.26061

type GQLResponseError struct {
	Message       string
	Value         string
	AllowedValues []string
	EnumType      string
	Type          string
}

GQLResponseError is a mapping of the data returned by the GraphQL server of key-value pairs. Typically used with the structure "Message: string", but other response errors provide additional fields.

type KeyVal added in v0.1.26061

type KeyVal struct {
	Key string      `json:"key"`
	Val interface{} `json:"val"`
}

KeyVal is a data structure specifically for passing pipeline data to GraphQL which doesn't support free-form maps.

func PrepareForGraphQL added in v0.1.26061

func PrepareForGraphQL(kvMap Values) []KeyVal

PrepareForGraphQL takes a golang homogenous map, and transforms it into a list of keyval pairs, since GraphQL does not support homogenous maps.

type LegacyConfigResponse added in v0.1.26061

type LegacyConfigResponse struct {
	Valid      bool
	SourceYaml string
	OutputYaml string

	Errors GQLErrorsCollection
}

LegacyConfigResponse is a structure that matches the result of the GQL query, so that we can use mapstructure to convert from nested maps to a strongly typed struct.

type Options

type Options struct {
	OwnerID string `json:"owner_id,omitempty"`
	// PipelineParameters are deprecated and will be removed in the future.
	// Use PipelineValues instead.
	PipelineParameters map[string]interface{} `json:"pipeline_parameters,omitempty"`
	PipelineValues     map[string]interface{} `json:"pipeline_values,omitempty"`
}

type Parameters added in v0.1.25569

type Parameters map[string]interface{}

Static typing is bypassed using an empty interface here due to pipeline parameters supporting multiple types.

type ProcessConfigOpts added in v0.1.25569

type ProcessConfigOpts struct {
	ConfigPath             string
	OrgID                  string
	OrgSlug                string
	PipelineParamsFilePath string

	VerboseOutput bool
}

type ValidateConfigOpts added in v0.1.25569

type ValidateConfigOpts struct {
	ConfigPath string
	OrgID      string
	OrgSlug    string

	IgnoreDeprecatedImages bool
	VerboseOutput          bool
}

type Values added in v0.1.25569

type Values map[string]interface{}

CircleCI provides various `<< pipeline.x >>` values to be used in your config, but sometimes we need to fabricate those values when validating config.

func LocalPipelineValues added in v0.1.25569

func LocalPipelineValues(parameters Parameters) Values

LocalPipelineValues returns a map of pipeline values that can be used for local validation. The given parameters will be prefixed with "pipeline.parameters." and accessible via << pipeline.parameters.foo >>.

Jump to

Keyboard shortcuts

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