config

package
v0.1.27054 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 14 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

This section is empty.

Types

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(cfg *settings.Config) *ConfigCompiler

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) 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 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() Values

vars should contain any pipeline parameters that should be accessible via << pipeline.parameters.foo >>

Jump to

Keyboard shortcuts

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