Documentation ¶
Index ¶
- type APIServer
- type Config
- type DBBackendType
- type Database
- type Default
- type External
- type Github
- func (g *Github) APIEndpoint() string
- func (g *Github) BaseEndpoint() string
- func (g *Github) CACertBundle() ([]byte, error)
- func (g *Github) GetAuthType() GithubAuthType
- func (g *Github) HTTPClient(ctx context.Context) (*http.Client, error)
- func (g *Github) UploadEndpoint() string
- func (g *Github) Validate() error
- type GithubApp
- type GithubAuthType
- type GithubPAT
- type JWTAuth
- type LogFormat
- type LogLevel
- type Logging
- type Metrics
- type MySQL
- type Provider
- type SQLite
- type TLSConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIServer ¶
type APIServer struct { Bind string `toml:"bind" json:"bind"` Port int `toml:"port" json:"port"` UseTLS bool `toml:"use_tls" json:"use-tls"` TLSConfig TLSConfig `toml:"tls" json:"tls"` CORSOrigins []string `toml:"cors_origins" json:"cors-origins"` }
APIServer holds configuration for the API server worker
func (*APIServer) BindAddress ¶
BindAddress returns a host:port string.
type Config ¶
type Config struct { Default Default `toml:"default" json:"default"` APIServer APIServer `toml:"apiserver,omitempty" json:"apiserver,omitempty"` Metrics Metrics `toml:"metrics,omitempty" json:"metrics,omitempty"` Database Database `toml:"database,omitempty" json:"database,omitempty"` Providers []Provider `toml:"provider,omitempty" json:"provider,omitempty"` Github []Github `toml:"github,omitempty"` JWTAuth JWTAuth `toml:"jwt_auth" json:"jwt-auth"` Logging Logging `toml:"logging" json:"logging"` }
func (*Config) GetLoggingConfig ¶ added in v0.1.4
type DBBackendType ¶
type DBBackendType string
const ( // MySQLBackend represents the MySQL DB backend MySQLBackend DBBackendType = "mysql" // SQLiteBackend represents the SQLite3 DB backend SQLiteBackend DBBackendType = "sqlite3" // EnvironmentVariablePrefix is the prefix for all environment variables // that can not be used to get overwritten via the external provider EnvironmentVariablePrefix = "GARM" )
type Database ¶
type Database struct { Debug bool `toml:"debug" json:"debug"` DbBackend DBBackendType `toml:"backend" json:"backend"` MySQL MySQL `toml:"mysql" json:"mysql"` SQLite SQLite `toml:"sqlite3" json:"sqlite3"` // Passphrase is used to encrypt any sensitive info before // inserting it into the database. This is just temporary until // we move to something like vault or barbican for secrets storage. // Don't lose or change this. It will invalidate all encrypted data // in the DB. This field must be set and must be exactly 32 characters. Passphrase string `toml:"passphrase"` // MigrateCredentials is a list of github credentials that need to be migrated // from the config file to the database. This field will be removed once GARM // reaches version 0.2.x. It's only meant to be used for the migration process. MigrateCredentials []Github `toml:"-"` }
Database is the database config entry
func (*Database) GormParams ¶
func (d *Database) GormParams() (dbType DBBackendType, uri string, err error)
GormParams returns the database type and connection URI
type Default ¶
type Default struct { // CallbackURL is the URL where the instances can send back status reports. CallbackURL string `toml:"callback_url" json:"callback-url"` // MetadataURL is the URL where instances can fetch information they may need // to set themselves up. MetadataURL string `toml:"metadata_url" json:"metadata-url"` // WebhookURL is the URL that will be installed as a webhook target in github. WebhookURL string `toml:"webhook_url" json:"webhook-url"` // EnableWebhookManagement enables the webhook management API. EnableWebhookManagement bool `toml:"enable_webhook_management" json:"enable-webhook-management"` // LogFile is the location of the log file. LogFile string `toml:"log_file,omitempty" json:"log-file"` EnableLogStreamer *bool `toml:"enable_log_streamer,omitempty" json:"enable-log-streamer,omitempty"` DebugServer bool `toml:"debug_server" json:"debug-server"` }
type External ¶
type External struct { // ConfigFile is the path on disk to a file which will be passed to // the external binary as an environment variable: GARM_PROVIDER_CONFIG // You can use this file for any configuration you need to do for the // cloud your calling into, to create the compute resources. ConfigFile string `toml:"config_file" json:"config-file"` // ProviderDir is the path on disk to a folder containing an executable // called "garm-external-provider". ProviderDir string `toml:"provider_dir" json:"provider-dir"` // ProviderExecutable is the full path to the executable that implements // the provider. If specified, it will take precedence over the "garm-external-provider" // executable in the ProviderDir. ProviderExecutable string `toml:"provider_executable" json:"provider-executable"` // EnvironmentVariables is a list of environment variable names that will be // passed to the external binary together with their values. EnvironmentVariables []string `toml:"environment_variables" json:"environment-variables"` }
External represents the config for an external provider. The external provider is a provider that delegates all operations to an external binary. This way, you can write your own logic in whatever programming language you wish, while still remaining compatible with garm.
func (*External) ExecutablePath ¶
func (*External) GetEnvironmentVariables ¶ added in v0.1.4
type Github ¶
type Github struct { Name string `toml:"name" json:"name"` Description string `toml:"description" json:"description"` // OAuth2Token is the personal access token used to authenticate with the // github API. This is deprecated and will be removed in the future. // Use the PAT section instead. OAuth2Token string `toml:"oauth2_token" json:"oauth2-token"` APIBaseURL string `toml:"api_base_url" json:"api-base-url"` UploadBaseURL string `toml:"upload_base_url" json:"upload-base-url"` BaseURL string `toml:"base_url" json:"base-url"` // CACertBundlePath is the path on disk to a CA certificate bundle that // can validate the endpoints defined above. Leave empty if not using a // self signed certificate. CACertBundlePath string `toml:"ca_cert_bundle" json:"ca-cert-bundle"` AuthType GithubAuthType `toml:"auth_type" json:"auth-type"` PAT GithubPAT `toml:"pat" json:"pat"` App GithubApp `toml:"app" json:"app"` }
Github hold configuration options specific to interacting with github. Currently that is just a OAuth2 personal token.
func (*Github) APIEndpoint ¶
func (*Github) BaseEndpoint ¶
func (*Github) CACertBundle ¶
func (*Github) GetAuthType ¶ added in v0.1.5
func (g *Github) GetAuthType() GithubAuthType
func (*Github) HTTPClient ¶ added in v0.1.5
func (*Github) UploadEndpoint ¶
type GithubApp ¶ added in v0.1.5
type GithubApp struct { AppID int64 `toml:"app_id" json:"app-id"` PrivateKeyPath string `toml:"private_key_path" json:"private-key-path"` InstallationID int64 `toml:"installation_id" json:"installation-id"` }
func (*GithubApp) PrivateKeyBytes ¶ added in v0.1.5
type GithubAuthType ¶ added in v0.1.5
type GithubAuthType string
const ( // GithubAuthTypePAT is the OAuth token based authentication GithubAuthTypePAT GithubAuthType = "pat" // GithubAuthTypeApp is the GitHub App based authentication GithubAuthTypeApp GithubAuthType = "app" )
type GithubPAT ¶ added in v0.1.5
type GithubPAT struct {
OAuth2Token string `toml:"oauth2_token" json:"oauth2-token"`
}
type JWTAuth ¶
type JWTAuth struct { Secret string `toml:"secret" json:"secret"` TimeToLive timeToLive `toml:"time_to_live" json:"time-to-live"` }
JWTAuth holds settings used to generate JWT tokens
type Logging ¶ added in v0.1.4
type Logging struct { // LogFile is the location of the log file. LogFile string `toml:"log_file,omitempty" json:"log-file"` // EnableLogStreamer enables the log streamer over websockets. EnableLogStreamer *bool `toml:"enable_log_streamer,omitempty" json:"enable-log-streamer,omitempty"` // LogLevel is the log level. LogLevel LogLevel `toml:"log_level" json:"log-format"` // LogFormat is the log format. LogFormat LogFormat `toml:"log_format" json:"log-level"` // LogSource enables the log source. LogSource bool `toml:"log_source" json:"log-source"` }
type Metrics ¶
type Metrics struct { // DisableAuth defines if the API endpoint will be protected by // JWT authentication DisableAuth bool `toml:"disable_auth" json:"disable-auth"` // Enable define if the API endpoint for metrics collection will // be enabled Enable bool `toml:"enable" json:"enable"` // Period defines the internal period at which internal metrics are getting updated // and propagated to the /metrics endpoint Period time.Duration `toml:"period" json:"period"` }
type MySQL ¶
type MySQL struct { Username string `toml:"username" json:"username"` Password string `toml:"password" json:"password"` Hostname string `toml:"hostname" json:"hostname"` DatabaseName string `toml:"database" json:"database"` }
MySQL is the config entry for the mysql section
func (*MySQL) ConnectionString ¶
ConnectionString returns a gorm compatible connection string
type Provider ¶
type Provider struct { Name string `toml:"name" json:"name"` ProviderType params.ProviderType `toml:"provider_type" json:"provider-type"` Description string `toml:"description" json:"description"` // DisableJITConfig explicitly disables JIT configuration and forces runner registration // tokens to be used. This may happen if a provider has not yet been updated to support // JIT configuration. DisableJITConfig bool `toml:"disable_jit_config" json:"disable-jit-config"` External External `toml:"external" json:"external"` }
Provider holds access information for a particular provider. A provider offers compute resources on which we spin up self hosted runners.
type SQLite ¶
type SQLite struct {
DBFile string `toml:"db_file" json:"db-file"`
}
SQLite is the config entry for the sqlite3 section