Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
// BuildID is the UUID for the build. This is unique.
BuildID string `envconfig:"BRIGADE_BUILD_ID"`
// WorkerID is the ID of the worker.
WorkerID string `envconfig:"BRIGADE_BUILD_NAME"`
// Type is the event type, such as `push`, `pull_request`
Type string `envconfig:"BRIGADE_EVENT_TYPE"`
// Provider is the name of the event provider, such as `github` or `dockerhub`
Provider string `envconfig:"BRIGADE_EVENT_PROVIDER"`
// Revision is VCS information
Revision Revision
// Payload is the payload from the original event trigger.
Payload []byte
}
Event represents a Brigade event.
func GetEventFromEnvironment ¶
GetEventFromEnvironment returns an Event object with values derived from environment variables.
func NewEventWithDefaults ¶
func NewEventWithDefaults() Event
NewEventWithDefaults returns an Event object with default values already applied. Callers are then free to set custom values for the remaining fields and/or override default values.
type Executor ¶
type Executor interface {
ExecuteBuild(
ctx context.Context,
project Project,
event Event,
) error
}
Executor is the public interface for the Brigade executor
func NewExecutor ¶
func NewExecutor( workerConfig WorkerConfig, kubeClient kubernetes.Interface, ) Executor
NewExecutor returns an executor suitable for use with Brigade
type KubernetesConfig ¶
type KubernetesConfig struct {
Namespace string
VCSSidecar string
VCSSidecarResourcesLimitsCPU string
VCSSidecarResourcesLimitsMemory string
VCSSidecarResourcesRequestsCPU string
VCSSidecarResourcesRequestsMemory string
BuildStorageSize string
BuildStorageClass string
ServiceAccount string
ImagePullSecrets []string
}
KubernetesConfig represents Kubernetes-related project configuration.
type Project ¶
type Project struct {
ID string
Name string
Repo Repository
Kubernetes KubernetesConfig
Secrets map[string]string
AllowPrivilegedJobs bool
AllowHostMounts bool
}
Project represents Brigade project configuration.
func GetProjectFromEnvironmentAndSecret ¶
func GetProjectFromEnvironmentAndSecret( kubeClient kubernetes.Interface, ) (Project, error)
GetProjectFromEnvironmentAndSecret returns a Project object with values derived from environment variables and a project-specific Kubernetes secret.
type Repository ¶
type Repository struct {
Name string
CloneURL string
SSHKey string
Token string
InitGitSubmodules bool
}
Repository represents VCS-related projects configuration.
type Revision ¶
type Revision struct {
// Commit is the VCS commit ID (e.g. the Git commit)
Commit string `envconfig:"BRIGADE_COMMIT_ID"`
// Ref is the VCS full reference, defaults to `refs/heads/master`
Ref string `envconfig:"BRIGADE_COMMIT_REF"`
}
Revision represents VCS-related details.
type WorkerConfig ¶
type WorkerConfig struct {
DefaultBuildStorageClass string `envconfig:"BRIGADE_DEFAULT_BUILD_STORAGE_CLASS"` // nolint: lll
}
WorkerConfig represents worker configuration specified by the Brigade controller when it launches the worker.
func GetWorkerConfigFromEnvironment ¶
func GetWorkerConfigFromEnvironment() (WorkerConfig, error)
GetWorkerConfigFromEnvironment returns a WorkerConfig object with values derived from environment variables.
func NewWorkerConfigWithDefaults ¶
func NewWorkerConfigWithDefaults() WorkerConfig
NewWorkerConfigWithDefaults returns a WorkerConfig object with default values already applied. Callers are then free to set custom values for the remaining fields and/or override default values.