Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CallbackData ¶
type Config ¶
type Config struct {
// ServerURL is the server url for results callback.
ServerURL string `yaml:"server_url"`
// Cert is the certificate for TLS enabled listener.
Cert string `yaml:"cert"`
// Key is the key for TLS enabled listener.
Key string `yaml:"key"`
// ResultsDir is the directory to store results.
ResultsDir string `yaml:"results_dir"`
// Deployments is the list of deployments.
Deployments []Deployment `yaml:"deployments"`
}
func LoadConfig ¶
type Deployment ¶
type Deployment struct {
// Type is the deployment type from the [hookers] package, (i.e.
// dockerhub).
Type string `yaml:"type"`
// Disabled is the flag to disable the deployment.
Disabled bool `yaml:"disabled"`
// Workdir is the directory where the deployment is located, hubdeploy
// will change to this directory before running the command.
Workdir string `yaml:"work_dir"`
// Command is the command to run in the workdir.
Command []string `yaml:"command"`
// Payload is the configuration of the deployment type, i.e. dockerhub
// configuration.
Payload any `yaml:"payload"`
}
type Hooker ¶
type Hooker interface {
// Register must register a deployment. If deployment type is different then
// the one handled it must return nil.
Register(Deployment) error
// Handle must handle the incoming webhook and post a Job to a Job channel.
Handler(chan<- Job) http.HandlerFunc
// Callback can send (or not, if not implemented by the caller) the callback
// to source system with the build results info.
Callback(CallbackData) error
// Type must return the string that will be used as deployment type. It
// will also be a path of a webhook.
Type() string
}
Hooker is the interface for pluggable webhook handlers.
type Job ¶
type Job struct {
CallbackURL string
Dep Deployment
}
type Option ¶
type Option func(*Server)
func OptWithCert ¶
OptWithCert allows to specify the certificate and the private key for TLS Listener.
func OptWithPrefix ¶
OptWithPrefix allows to set the url prefix for the muxer.
func OptWithResultDir ¶
OptWithResultDir sets the directory which will contain the results of deployment (combined STDOUT and STDERR outputs).
Click to show internal directories.
Click to hide internal directories.