Documentation
¶
Index ¶
Constants ¶
View Source
const AppName = "doco-cd" // Name of the application
Variables ¶
View Source
var ( DefaultDeploymentConfigFileNames = []string{".doco-cd.yaml", ".doco-cd.yml"} CustomDeploymentConfigFileNames = []string{".doco-cd.%s.yaml", ".doco-cd.%s.yml"} DeprecatedDeploymentConfigFileNames = []string{".compose-deploy.yaml", ".compose-deploy.yml"} ErrConfigFileNotFound = errors.New("configuration file not found in repository") ErrDuplicateProjectName = errors.New("duplicate project/stack name found in configuration file") ErrInvalidConfig = errors.New("invalid deploy configuration") ErrKeyNotFound = errors.New("key not found") ErrDeprecatedConfig = errors.New("configuration file name is deprecated, please use .doco-cd.y(a)ml instead") )
View Source
var ( ErrInvalidLogLevel = validator.TextErr{Err: errors.New("invalid log level, must be one of debug, info, warn, error")} ErrBothSecretsSet = errors.New("both secrets are set, please use one or the other") ErrBothSecretsNotSet = errors.New("neither secrets are set, please use one or the other") ErrInvalidHttpUrl = errors.New("invalid HTTP URL, must begin with http or https") )
Functions ¶
This section is empty.
Types ¶
type AppConfig ¶
type AppConfig struct {
LogLevel string `env:"LOG_LEVEL,notEmpty" envDefault:"info"` // LogLevel is the log level for the application
HttpPort uint16 `env:"HTTP_PORT,notEmpty" envDefault:"80" validate:"min=1,max=65535"` // HttpPort is the port the HTTP server will listen on
WebhookSecret string `env:"WEBHOOK_SECRET"` // WebhookSecret is the secret used to authenticate the webhook
WebhookSecretFile string `env:"WEBHOOK_SECRET_FILE,file"` // WebhookSecretFile is the file containing the WebhookSecret
GitAccessToken string `env:"GIT_ACCESS_TOKEN"` // GitAccessToken is the access token used to authenticate with the Git server (e.g. GitHub) for private repositories
GitAccessTokenFile string `env:"GIT_ACCESS_TOKEN_FILE,file"` // GitAccessTokenFile is the file containing the GitAccessToken
AuthType string `env:"AUTH_TYPE,notEmpty" envDefault:"oauth2"` // AuthType is the type of authentication to use when cloning repositories
SkipTLSVerification bool `env:"SKIP_TLS_VERIFICATION,notEmpty" envDefault:"false"` // SkipTLSVerification skips the TLS verification when cloning repositories.
DockerQuietDeploy bool `env:"DOCKER_QUIET_DEPLOY,notEmpty" envDefault:"true"` // DockerQuietDeploy suppresses the status output of dockerCli in deployments (e.g. pull, create, start)
}
AppConfig is used to configure this application https://github.com/caarlos0/env?tab=readme-ov-file#env-tag-options
type DeployConfig ¶
type DeployConfig struct {
Name string `yaml:"name"` // Name is the name of the docker-compose deployment / stack
RepositoryUrl HttpUrl `yaml:"repository_url" default:"" validate:"httpUrl"` // RepositoryUrl is the http URL of the Git repository to deploy
Reference string `yaml:"reference" default:"refs/heads/main"` // Reference is the Git reference to the deployment, e.g., refs/heads/main, main, refs/tags/v1.0.0 or v1.0.0
WorkingDirectory string `yaml:"working_dir" default:"."` // WorkingDirectory is the working directory for the deployment
ComposeFiles []string `yaml:"compose_files" default:"[\"compose.yaml\", \"compose.yml\", \"docker-compose.yml\", \"docker-compose.yaml\"]"` // ComposeFiles is the list of docker-compose files to use
RemoveOrphans bool `yaml:"remove_orphans" default:"true"` // RemoveOrphans removes containers for services not defined in the Compose file
ForceRecreate bool `yaml:"force_recreate" default:"false"` // ForceRecreate forces the recreation/redeployment of containers even if the configuration has not changed
ForceImagePull bool `yaml:"force_image_pull" default:"false"` // ForceImagePull always pulls the latest version of the image tags you've specified if a newer version is available
Timeout int `yaml:"timeout" default:"180"` // Timeout is the time in seconds to wait for the deployment to finish in seconds before timing out
BuildOpts struct {
ForceImagePull bool `yaml:"force_image_pull" default:"false"` // ForceImagePull always attempt to pull a newer version of the image
Quiet bool `yaml:"quiet" default:"false"` // Quiet suppresses the build output
Args map[string]string `yaml:"args"` // BuildArgs is a map of build-time arguments to pass to the build process
NoCache bool `yaml:"no_cache" default:"false"` // NoCache disables the use of the cache when building images
} `yaml:"build_opts"` // BuildOpts is the build options for the deployment
Destroy bool `yaml:"destroy" default:"false"` // Destroy removes the deployment and all its resources from the Docker host
DestroyOpts struct {
RemoveVolumes bool `yaml:"remove_volumes" default:"true"` // RemoveVolumes removes the volumes used by the deployment
RemoveImages bool `yaml:"remove_images" default:"true"` // RemoveImages removes the images used by the deployment
RemoveRepoDir bool `yaml:"remove_dir" default:"true"` // RemoveRepoDir removes the repository directory after the deployment is destroyed
} `yaml:"destroy_opts"` // DestroyOpts is the destroy options for the deployment
}
DeployConfig is the structure of the deployment configuration file
func DefaultDeployConfig ¶
func DefaultDeployConfig(name string) *DeployConfig
DefaultDeployConfig creates a DeployConfig with default values
func FromYAML ¶
func FromYAML(f string) ([]*DeployConfig, error)
func GetDeployConfigs ¶ added in v0.11.0
func GetDeployConfigs(repoDir, name, customTarget string) ([]*DeployConfig, error)
GetDeployConfigs returns either the deployment configuration from the repository or the default configuration
func (*DeployConfig) UnmarshalYAML ¶
func (c *DeployConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
Click to show internal directories.
Click to hide internal directories.