Documentation ¶
Index ¶
- type BackendConfig
- type BackendConfigType
- type Context
- type DataConfig
- type OptionsConfig
- type OptionsDependenciesConfig
- type OutputConfig
- type OutputConfigMetadata
- type ParametersConfig
- type Provider
- type ProviderConfig
- type RetriesConfig
- type RetryConfig
- type SchemaConfig
- type Stage
- type StageConfig
- type StageConfigs
- type StageError
- type StagePlugin
- type StageRPC
- type StageRPCServer
- func (s *StageRPCServer) Description(args interface{}, resp *string) error
- func (s *StageRPCServer) GatherInfo(args interface{}, resp *StageError) error
- func (s *StageRPCServer) GetContext(args interface{}, resp *Context) error
- func (s *StageRPCServer) Name(args interface{}, resp *string) error
- func (s *StageRPCServer) SetContext(context Context, resp *error) error
- type StageSourceConfig
- type StateConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendConfig ¶ added in v0.0.5
type BackendConfig struct { // Type specifies the backend type Type BackendConfigType `yaml:"type,omitempty"` // CloudBuild specifies the configuration for the cloudbuild backend CloudBuild map[string]interface{} `yaml:"cloudbuild,omitempty"` Local map[string]interface{} `yaml:"local,omitempty"` }
BackendConfig is the configuration for the backend
type BackendConfigType ¶ added in v0.0.5
type BackendConfigType string
BackendConfigType is the type of the backend this is an enum containing local and cloudbuild for now
const ( // BackendConfigTypeLocal is the local backend BackendConfigTypeLocal BackendConfigType = "local" BackendConfigTypeCloudBuild BackendConfigType = "cloudbuild" BackendConfigTypeDefault BackendConfigType = BackendConfigTypeLocal )
type DataConfig ¶
type DataConfig struct { Id string `yaml:"RawId"` PluginGit string `yaml:"plugin.git"` PluginPath string `yaml:"plugin.path"` Type string `yaml:"type"` Context map[string]interface{} `yaml:"parameters"` FromFile string `yaml:"fromfile"` From map[string]string `yaml:"from"` Sensitive bool `yaml:"sensitive"` }
type OptionsConfig ¶
type OptionsConfig struct { Chdir bool `yaml:"chdir"` Debug bool `yaml:"debug"` FailLazy bool `yaml:"fail-lazy"` Summary string `yaml:"summary"` Retries RetriesConfig `yaml:"retries"` Dependencies OptionsDependenciesConfig `yaml:"dependencies"` }
type OptionsDependenciesConfig ¶ added in v0.0.5
type OptionsDependenciesConfig struct {
AlwaysInclude bool `yaml:"always-include"`
}
type OutputConfig ¶
type OutputConfig struct { Data any `yaml:"data,omitempty"` Kind string `yaml:"kind"` Metadata OutputConfigMetadata `yaml:"metadata,omitempty"` }
type OutputConfigMetadata ¶
type ParametersConfig ¶
type Provider ¶
type Provider struct { Config ProviderConfig Client *plugin.Client Provider Stage }
type ProviderConfig ¶
type ProviderConfig struct { // Id is the unique identification index of the provider // This Id will be used when RawName resolutions on pongo is // evaluated. Id defaults to Name if unset RawId string `yaml:"id"` // Name is the RawName of the plugin, will be used as Id if Id is unset RawName string `yaml:"name"` // Git specifies the URL to the git repository which hosts the provider Git string `yaml:"git"` // Path specifies the path to the plugin Path string `yaml:"path"` Data context.Data `yaml:"data"` }
ProviderConfig is a configuration block for creating a Provider
func (ProviderConfig) ID ¶
func (p ProviderConfig) ID() string
func (ProviderConfig) Name ¶
func (p ProviderConfig) Name() string
type RetriesConfig ¶
type RetriesConfig struct { // Enabled sets the retry policy Enabled bool `yaml:"enabled"` // Max gives the number of attempts to retry the job before declaring the job as failed. Max int `yaml:"max"` // MinBackoff gives the seconds to wait before retrying the job again. MinBackoff int `yaml:"min-backoff"` // MaxBackoff gives the maximum time to wait before retrying the job again. MaxBackoff int `yaml:"max-backoff"` }
type RetryConfig ¶
type RetryConfig struct {
Enabled bool `yaml:"enabled,omitempty"`
}
type SchemaConfig ¶
type SchemaConfig struct { // Version specifies the version of the configuration Version int `yaml:"version"` // IncludePlugins provides the list of plugins that needs to be // executed before or after the stage is completed s IncludePlugins []string `yaml:"include_plugins"` // Parameters Parameters []ParametersConfig `yaml:"parameters"` // Environment specifies the key value map on the environment variables that need to be exported Environment map[string]string `yaml:"environment"` // Backend specifies where the code will be run, which could be either one // of local, cloudbuild for now Backend BackendConfig `yaml:"backend,omitempty"` // Extends does an internal deep merge of yaml maps so that // on can inherit the properties of another stage without having to write // most of the content Extends string `yaml:"extends"` // Providers are plugins which can be written by users // which can do one, or all of the following: gather information, // check if all the pre-requisites for running a provider is met // and do the job Providers []ProviderConfig `yaml:"providers"` // Stages are user defined jobs which will need to run. The order // of execution depends on the StageConfigs DependsOn parameter Stages StageConfigs `yaml:"stages"` // Data - have not decided what to do with this yet Data []DataConfig `yaml:"data"` // State has options on where to store the pipeline state State StateConfig `yaml:"state,omitempty"` // Options provide togomak specific build configurations Options OptionsConfig `yaml:"options"` // Matrix is a list of parameters that can be used to build a matrix of // builds. This is useful for testing multiple configurations of the same Matrix map[string][]string `yaml:"matrix"` }
SchemaConfig shows the overall YAML configuration file
type Stage ¶
type Stage interface { Name() string Description() string //CanRun() bool //Run() error GatherInfo() StageError SetContext(c Context) error GetContext() Context }
Stage is the interface that we're exposing as a plugin.
type StageConfig ¶
type StageConfig struct { // Id is a unique key to a stage. Internally the CICD system // will use these Id 's as a method of referencing other stages Id string `yaml:"id"` // DependsOn helps to specify the order of execution by // specifying the dependencies. This order will be used to generate // an internal graph, which will be topologically sorted. DependsOn []string `yaml:"depends-on,omitempty"` // Condition is a boolean value that determines if the stage will be // run or not. A user can however invoke the tool by explicitly calling // the Stage by the Id, and it will run nevertheless. // Condition may have pongo expressions which will be evaluated before the // stage is called Condition string `yaml:"if,omitempty"` // State is a URL reference to a file State string `yaml:"state,omitempty"` // Targets is a URL references to a list of files // if any of the files have a modification time greater than the one specified in State // then, it will trigger the state, else skip Targets []string `yaml:"targets"` // Plugin Plugin string `yaml:"plugin,omitempty"` // Script multiline shell scripts can be specified here. The container, if // specified will be set to have 'sh' as entrypoint and the shell scripts // will be passed with -c argument. This does not fail if any of the commands // within the shell script fail by default. Use `set -e` to explicitly configure // the shell behaviour. Args and Script are mutually exclusive and they should // not be specified at the same time. Script string `yaml:"script,omitempty"` // Args which needs to be passed to Container if they are specified. // Args and Script should not be specified simultaneously Args []string `yaml:"args,omitempty"` // Container the RawName of the docker container that needs to be called // This will use the docker backend, or the podman backend depending on // which of the following is available. `docker` backend will have higher // precedence over podman. Container string `yaml:"container,omitempty"` // Name specifies the human friendly RawName of the stage. This is optional. Name string `yaml:"name,omitempty"` // Description provides more information about the stage to the user. Description string `yaml:"description,omitempty"` // Extends specifies the stage that this stage extends. This is optional. Extends string `yaml:"extends,omitempty"` Source StageSourceConfig `yaml:"source,omitempty"` DisableLock bool `yaml:"disable-lock,omitempty"` // Environment specifies the key value map on the environment variables that need to be exported // in the running stage before the script is executed Environment map[string]string `yaml:"environment,omitempty"` // Dir specifies the directory in which the command will be run Dir string `yaml:"dir"` // Retry specifies the config block for retrying the stage Retry RetryConfig `yaml:"retry,omitempty"` Output OutputConfig `yaml:"output,omitempty"` // contains filtered or unexported fields }
StageConfig is a block of definition for a stage to run. Stage is a job which run internally, concurrently by default to achieve a specific task.
func NewRootStage ¶
func NewRootStage() StageConfig
func (*StageConfig) LoadStage ¶
func (p *StageConfig) LoadStage() string
func (*StageConfig) Taint ¶
func (p *StageConfig) Taint()
type StageConfigs ¶
type StageConfigs []StageConfig
func (StageConfigs) GetStageById ¶
func (s StageConfigs) GetStageById(id string) StageConfig
type StageError ¶
func StageErrorFromErr ¶
func StageErrorFromErr(err error) StageError
type StagePlugin ¶
type StagePlugin struct { // Impl Injection Impl Stage }
This is the implementation of plugin.Plugin so we can serve/consume this
This has two methods: Server must return an RPC server for this plugin type. We construct a StageRPCServer for this.
Client must return an implementation of our interface that communicates over an RPC client. We return StageRPC for this.
Ignore MuxBroker. That is used to create more multiplexed streams on our plugin connection and is a more advanced use case.
func (StagePlugin) Client ¶
func (StagePlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)
func (*StagePlugin) Server ¶
func (p *StagePlugin) Server(*plugin.MuxBroker) (interface{}, error)
type StageRPC ¶
type StageRPC struct {
// contains filtered or unexported fields
}
Here is an/var/mnt/data/repo/github.com/srevinsaju/togomak/.togomak/plugins/togomak-provider-git implementation that talks over RPC
func (*StageRPC) Description ¶
func (*StageRPC) GatherInfo ¶
func (g *StageRPC) GatherInfo() StageError
func (*StageRPC) GetContext ¶
func (*StageRPC) SetContext ¶
type StageRPCServer ¶
type StageRPCServer struct { // This is the real implementation Impl Stage }
Here is the RPC server that StageRPC talks to, conforming to the requirements of net/rpc
func (*StageRPCServer) Description ¶
func (s *StageRPCServer) Description(args interface{}, resp *string) error
func (*StageRPCServer) GatherInfo ¶
func (s *StageRPCServer) GatherInfo(args interface{}, resp *StageError) error
func (*StageRPCServer) GetContext ¶
func (s *StageRPCServer) GetContext(args interface{}, resp *Context) error
func (*StageRPCServer) Name ¶
func (s *StageRPCServer) Name(args interface{}, resp *string) error
func (*StageRPCServer) SetContext ¶
func (s *StageRPCServer) SetContext(context Context, resp *error) error
type StageSourceConfig ¶
type StageSourceConfig struct { Type string `yaml:"type"` URL string `yaml:"url"` File string `yaml:"file"` Stages []string `yaml:"stages"` Parameters []ParametersConfig `yaml:"parameters"` }
StageSourceConfig is a block of definition for an external source specified on a different file to be run
type StateConfig ¶
func NewStateConfig ¶
func NewStateConfig() StateConfig