Documentation ¶
Index ¶
- Constants
- Variables
- func Filters() []string
- func FinishSpan(span opentracing.Span)
- func FinishSpanWithError(span opentracing.Span, err error)
- func GenerateJWT(config *APIConfig, now time.Time, expiry time.Time, ...) (tokenString string, err error)
- func GetCachedGoogleJWK(kid string) (jwk *rsa.PublicKey, err error)
- func GetClaimsFromJWT(config *APIConfig, tokenString string) (claims jwtgo.MapClaims, err error)
- func GetFilters(c *gin.Context) map[FilterType][]string
- func GetGenericFilter(c *gin.Context, filterKey FilterType, defaultValues ...string) []string
- func GetGroupsFromRequest(c *gin.Context) (groups []string)
- func GetLabelsFilter(c *gin.Context) []string
- func GetLastFilter(c *gin.Context, defaultValue int) []string
- func GetOrganizationsFromRequest(c *gin.Context) (organizations []string)
- func GetPageNumber(c *gin.Context) int
- func GetPageSize(c *gin.Context) int
- func GetPagedListResponse(itemsFunc func() ([]interface{}, error), countFunc func() (int, error), ...) (contracts.ListResponse, error)
- func GetPipelineFilters(c *gin.Context) map[FilterType][]string
- func GetSinceFilter(c *gin.Context) []string
- func GetSpanName(prefix, funcName string) string
- func GetStatusFilter(c *gin.Context, defaultValues ...contracts.Status) []string
- func HandleLogError(packageName, interfaceName, funcName string, err error, ignoredErrors ...error)
- func InjectCommands(config *APIConfig, mft manifest.EstafetteManifest) (injectedManifest manifest.EstafetteManifest)
- func InjectStages(config *APIConfig, mft manifest.EstafetteManifest, ...) (injectedManifest manifest.EstafetteManifest, err error)
- func LogTargetArrayContains(array []LogTarget, value LogTarget) bool
- func NewRequestCounter(subsystem string) metrics.Counter
- func NewRequestHistogram(subsystem string) metrics.Histogram
- func OpenTracingMiddleware() gin.HandlerFunc
- func OverrideFromEnv(config interface{}, prefix string, environmentVariables []string) error
- func OverrideFromEnvMap(config interface{}, prefix string, environmentVariables map[string]string) error
- func Permissions() []string
- func RequestTokenHasPermission(c *gin.Context, permission Permission) bool
- func RequestTokenHasRole(c *gin.Context, role Role) bool
- func RequestTokenHasSomeRole(c *gin.Context, roles ...Role) bool
- func RequestTokenIsValid(c *gin.Context) bool
- func Roles() []string
- func SetPermissionsFilters(c *gin.Context, filters map[FilterType][]string) map[FilterType][]string
- func StringArrayContains(array []string, value string) bool
- func UpdateMetrics(requestCount metrics.Counter, requestLatency metrics.Histogram, ...)
- func ValidateJWT(config *APIConfig, tokenString string) (token *jwtgo.Token, err error)
- type APIConfig
- type APIConfigIntegrations
- type APIServerConfig
- func (c *APIServerConfig) ReadLogFromCloudStorage() bool
- func (c *APIServerConfig) ReadLogFromDatabase() bool
- func (c *APIServerConfig) SetDefaults()
- func (c *APIServerConfig) Validate() (err error)
- func (c *APIServerConfig) WriteLogToCloudStorage() bool
- func (c *APIServerConfig) WriteLogToDatabase() bool
- type AffinityAndTolerationsConfig
- type AuthConfig
- type AuthOrganizationConfig
- type BigQueryConfig
- type BitbucketBuildControl
- type BitbucketConfig
- type BitbucketProjectsRepos
- type BuildControl
- type CatalogConfig
- type CloudSourceConfig
- type CloudStorageConfig
- type ConfigReader
- type DatabaseConfig
- type FilterType
- type GithubBuildControl
- type GithubConfig
- type GoogleJSONWebKey
- type GoogleJWKResponse
- type IAPJSONWebKey
- type IAPJWKResponse
- type InjectCommandsConfig
- type InjectStagesConfig
- type InjectStagesTypeConfig
- type InstallationOrganizations
- type JWTConfig
- type JobsConfig
- type List
- type LogTarget
- type Middleware
- type OAuthProvider
- func (p *OAuthProvider) AuthCodeURL(baseURL, state string) string
- func (p *OAuthProvider) GetConfig(baseURL string) *oauth2.Config
- func (p *OAuthProvider) GetUserIdentity(ctx context.Context, config *oauth2.Config, token *oauth2.Token) (identity *contracts.UserIdentity, err error)
- func (c *OAuthProvider) SetDefaults()
- func (p *OAuthProvider) UserIsAllowed(ctx context.Context, email string) (isAllowed bool, err error)
- func (c *OAuthProvider) Validate() (err error)
- type OAuthProviderInfo
- type OrderField
- type OwnerOrganizations
- type Permission
- type ProjectOrganizations
- type PrometheusConfig
- type PubsubConfig
- type QueueConfig
- type ReleaseControl
- type RepositoryReleaseControl
- type Role
- type SlackConfig
- type WarningHelper
Constants ¶
const (
AllRepositories = "*"
)
Variables ¶
var ( ErrInvalidMapItem = errors.New("invalid map item") ErrLookuperNil = errors.New("lookuper cannot be nil") ErrInvalidEnvvarName = errors.New("invalid environment variable name") ErrMissingKey = errors.New("missing key") ErrMissingRequired = errors.New("missing required value") ErrNotPtr = errors.New("input must be a pointer") ErrNotStruct = errors.New("input must be a struct") ErrPrefixNotStruct = errors.New("prefix is only valid on struct types") ErrPrivateField = errors.New("cannot parse private fields") ErrRequiredAndDefault = errors.New("field cannot be required and have a default value") ErrUnknownOption = errors.New("unknown option") )
var ErrBlockedRepository = errors.New("repository is blocked from build")
var ( // ErrInvalidSigningAlgorithm indicates signing algorithm is invalid, needs to be HS256, HS384, HS512, RS256, RS384 or RS512 ErrInvalidSigningAlgorithm = errors.New("invalid signing algorithm") )
Functions ¶
func FinishSpan ¶
func FinishSpan(span opentracing.Span)
func FinishSpanWithError ¶
func FinishSpanWithError(span opentracing.Span, err error)
func GenerateJWT ¶
func GetCachedGoogleJWK ¶
GetCachedGoogleJWK returns google's json web keys from cache or fetches them from source
func GetClaimsFromJWT ¶
func GetFilters ¶
func GetFilters(c *gin.Context) map[FilterType][]string
GetFilters extracts specific filter parameters specified according to https://jsonapi.org/format/
func GetGenericFilter ¶
func GetGenericFilter(c *gin.Context, filterKey FilterType, defaultValues ...string) []string
GetGenericFilter extracts a filter
func GetGroupsFromRequest ¶
func GetLabelsFilter ¶
GetLabelsFilter extracts a filter to select specific labels
func GetLastFilter ¶
GetLastFilter extracts a filter to select last n items
func GetPageNumber ¶
GetPageNumber extracts pagination parameters specified according to https://jsonapi.org/format/
func GetPageSize ¶
GetPageSize extracts pagination parameters specified according to https://jsonapi.org/format/
func GetPagedListResponse ¶
func GetPagedListResponse(itemsFunc func() ([]interface{}, error), countFunc func() (int, error), pageNumber, pageSize int) (contracts.ListResponse, error)
GetPagedListResponse runs a paged item query and a count query in parallel and returns them as a ListResponse
func GetPipelineFilters ¶
func GetPipelineFilters(c *gin.Context) map[FilterType][]string
func GetSinceFilter ¶
GetSinceFilter extracts a filter on build/release date
func GetSpanName ¶
func GetStatusFilter ¶
GetStatusFilter extracts a filter on status
func HandleLogError ¶
func InjectCommands ¶
func InjectCommands(config *APIConfig, mft manifest.EstafetteManifest) (injectedManifest manifest.EstafetteManifest)
InjectCommands injects configured commands
func InjectStages ¶
func InjectStages(config *APIConfig, mft manifest.EstafetteManifest, builderTrack, gitSource, gitBranch string, supportsBuildStatus bool) (injectedManifest manifest.EstafetteManifest, err error)
InjectStages injects some mandatory and configured stages
func LogTargetArrayContains ¶
LogTargetArrayContains returns true of a value is present in the array
func NewRequestCounter ¶
func NewRequestHistogram ¶
func OpenTracingMiddleware ¶
func OpenTracingMiddleware() gin.HandlerFunc
OpenTracingMiddleware creates a span for each request
func OverrideFromEnv ¶
func OverrideFromEnvMap ¶
func Permissions ¶
func Permissions() []string
Permissions returns all allowed values for Permission
func RequestTokenHasPermission ¶
func RequestTokenHasPermission(c *gin.Context, permission Permission) bool
func RequestTokenHasSomeRole ¶
RequestTokenHasSomeRole checks whether the request has at least one of a list of roles
func RequestTokenIsValid ¶
func SetPermissionsFilters ¶
func SetPermissionsFilters(c *gin.Context, filters map[FilterType][]string) map[FilterType][]string
SetPermissionsFilters adds permission related filters for groups and organizations
func StringArrayContains ¶
StringArrayContains returns true of a value is present in the array
func UpdateMetrics ¶
Types ¶
type APIConfig ¶
type APIConfig struct { Integrations *APIConfigIntegrations `yaml:"integrations,omitempty"` APIServer *APIServerConfig `yaml:"apiServer,omitempty"` Auth *AuthConfig `yaml:"auth,omitempty"` Jobs *JobsConfig `yaml:"jobs,omitempty"` Database *DatabaseConfig `yaml:"database,omitempty"` Queue *QueueConfig `yaml:"queue,omitempty"` ManifestPreferences *manifest.EstafetteManifestPreferences `yaml:"manifestPreferences,omitempty"` Catalog *CatalogConfig `yaml:"catalog,omitempty"` Credentials []*contracts.CredentialConfig `yaml:"credentials,omitempty" json:"credentials,omitempty"` ClearDefaultTrustedImages bool `yaml:"clearDefaultTrustedImages,omitempty"` TrustedImages []*contracts.TrustedImageConfig `yaml:"trustedImages,omitempty" json:"trustedImages,omitempty"` BuildControl *BuildControl `yaml:"buildControl,omitempty"` }
APIConfig represent the configuration for the entire api application
func (*APIConfig) SetDefaults ¶
func (c *APIConfig) SetDefaults()
type APIConfigIntegrations ¶
type APIConfigIntegrations struct { Github *GithubConfig `yaml:"github,omitempty"` Bitbucket *BitbucketConfig `yaml:"bitbucket,omitempty"` Slack *SlackConfig `yaml:"slack,omitempty"` Pubsub *PubsubConfig `yaml:"pubsub,omitempty"` Prometheus *PrometheusConfig `yaml:"prometheus,omitempty"` BigQuery *BigQueryConfig `yaml:"bigquery,omitempty"` CloudStorage *CloudStorageConfig `yaml:"gcs,omitempty"` CloudSource *CloudSourceConfig `yaml:"cloudsource,omitempty"` }
APIConfigIntegrations contains config for 3rd party integrations
func (*APIConfigIntegrations) SetDefaults ¶
func (c *APIConfigIntegrations) SetDefaults()
func (*APIConfigIntegrations) Validate ¶
func (c *APIConfigIntegrations) Validate() (err error)
type APIServerConfig ¶
type APIServerConfig struct { BaseURL string `yaml:"baseURL"` IntegrationsURL string `yaml:"integrationsURL"` ServiceURL string `yaml:"serviceURL"` LogWriters []LogTarget `yaml:"logWriters"` LogReader LogTarget `yaml:"logReader"` InjectStagesPerOperatingSystem map[manifest.OperatingSystem]InjectStagesConfig `yaml:"injectStagesPerOperatingSystem,omitempty"` InjectCommandsPerOperatingSystemAndShell map[manifest.OperatingSystem]map[string]InjectCommandsConfig `yaml:"injectCommandsPerOperatingSystemAndShell,omitempty"` DockerConfigPerOperatingSystem map[manifest.OperatingSystem]contracts.DockerConfig `yaml:"dockerConfigPerOperatingSystem,omitempty" json:"dockerConfigPerOperatingSystem,omitempty"` }
APIServerConfig represents configuration for the api server
func (*APIServerConfig) ReadLogFromCloudStorage ¶
func (c *APIServerConfig) ReadLogFromCloudStorage() bool
ReadLogFromCloudStorage indicates if logReader config is cloudstorage
func (*APIServerConfig) ReadLogFromDatabase ¶
func (c *APIServerConfig) ReadLogFromDatabase() bool
ReadLogFromDatabase indicates if logReader config is database
func (*APIServerConfig) SetDefaults ¶
func (c *APIServerConfig) SetDefaults()
func (*APIServerConfig) Validate ¶
func (c *APIServerConfig) Validate() (err error)
func (*APIServerConfig) WriteLogToCloudStorage ¶
func (c *APIServerConfig) WriteLogToCloudStorage() bool
WriteLogToCloudStorage indicates if cloudstorage is in the logWriters config
func (*APIServerConfig) WriteLogToDatabase ¶
func (c *APIServerConfig) WriteLogToDatabase() bool
WriteLogToDatabase indicates if database is in the logWriters config
type AffinityAndTolerationsConfig ¶
type AffinityAndTolerationsConfig struct { Affinity *v1.Affinity `yaml:"affinity"` Tolerations []v1.Toleration `yaml:"tolerations"` }
func (*AffinityAndTolerationsConfig) UnmarshalYAML ¶
func (c *AffinityAndTolerationsConfig) UnmarshalYAML(unmarshal func(interface{}) error) (err error)
UnmarshalYAML customizes unmarshalling an AffinityAndTolerationsConfig
type AuthConfig ¶
type AuthConfig struct { JWT *JWTConfig `yaml:"jwt"` Administrators []string `yaml:"administrators"` Google *OAuthProvider `yaml:"google" env:"GOOGLE"` Github *OAuthProvider `yaml:"github" env:"GITHUB"` Organizations []*AuthOrganizationConfig `yaml:"organizations"` }
AuthConfig determines whether to use IAP for authentication and authorization
func (*AuthConfig) IsConfiguredAsAdministrator ¶
func (config *AuthConfig) IsConfiguredAsAdministrator(email string) bool
IsConfiguredAsAdministrator returns for a user whether they're configured as administrator
func (*AuthConfig) SetDefaults ¶
func (c *AuthConfig) SetDefaults()
func (*AuthConfig) Validate ¶
func (c *AuthConfig) Validate() (err error)
type AuthOrganizationConfig ¶
type AuthOrganizationConfig struct { Name string `yaml:"name"` OAuthProviders []*OAuthProvider `yaml:"oauthProviders"` }
AuthOrganizationConfig configures things relevant to each organization using the system
func (*AuthOrganizationConfig) SetDefaults ¶
func (c *AuthOrganizationConfig) SetDefaults()
func (*AuthOrganizationConfig) Validate ¶
func (c *AuthOrganizationConfig) Validate() (err error)
type BigQueryConfig ¶
type BigQueryConfig struct { Enable bool `yaml:"enable"` ProjectID string `yaml:"projectID"` Dataset string `yaml:"dataset"` }
BigQueryConfig configures the dataset where to send bigquery events
func (*BigQueryConfig) SetDefaults ¶
func (c *BigQueryConfig) SetDefaults()
func (*BigQueryConfig) Validate ¶
func (c *BigQueryConfig) Validate() (err error)
type BitbucketBuildControl ¶
type BitbucketBuildControl struct { Allowed *BitbucketProjectsRepos `yaml:"allowed,omitempty"` Blocked *BitbucketProjectsRepos `yaml:"blocked,omitempty"` }
type BitbucketConfig ¶
type BitbucketConfig struct {
Enable bool `yaml:"enable"`
}
BitbucketConfig is used to configure bitbucket integration
func (*BitbucketConfig) SetDefaults ¶
func (c *BitbucketConfig) SetDefaults()
func (*BitbucketConfig) Validate ¶
func (c *BitbucketConfig) Validate() (err error)
type BitbucketProjectsRepos ¶
type BuildControl ¶
type BuildControl struct { Bitbucket *BitbucketBuildControl `yaml:"bitbucket,omitempty"` Github *GithubBuildControl `yaml:"github,omitempty"` Release *ReleaseControl `yaml:"release,omitempty"` }
type CatalogConfig ¶
type CatalogConfig struct {
Filters []string `yaml:"filters,omitempty" json:"filters,omitempty"`
}
CatalogConfig configures various aspect of the catalog page
func (*CatalogConfig) SetDefaults ¶
func (c *CatalogConfig) SetDefaults()
func (*CatalogConfig) Validate ¶
func (c *CatalogConfig) Validate() (err error)
type CloudSourceConfig ¶
type CloudSourceConfig struct { Enable bool `yaml:"enable"` ProjectOrganizations []ProjectOrganizations `yaml:"projectOrganizations"` }
CloudSourceConfig is used to configure cloudSource integration
func (*CloudSourceConfig) SetDefaults ¶
func (c *CloudSourceConfig) SetDefaults()
func (*CloudSourceConfig) Validate ¶
func (c *CloudSourceConfig) Validate() (err error)
type CloudStorageConfig ¶
type CloudStorageConfig struct { Enable bool `yaml:"enable"` ProjectID string `yaml:"projectID"` Bucket string `yaml:"bucket"` LogsDirectory string `yaml:"logsDir"` }
CloudStorageConfig is used to configure a google cloud storage bucket to be used to store logs
func (*CloudStorageConfig) SetDefaults ¶
func (c *CloudStorageConfig) SetDefaults()
func (*CloudStorageConfig) Validate ¶
func (c *CloudStorageConfig) Validate() (err error)
type ConfigReader ¶
type ConfigReader interface { GetConfigFilePaths(configPath string) (configFilePaths []string, err error) ReadConfigFromFiles(configPath string, decryptSecrets bool) (config *APIConfig, err error) }
ConfigReader reads the api config from file
func NewConfigReader ¶
func NewConfigReader(secretHelper crypt.SecretHelper, jwtKey string) ConfigReader
NewConfigReader returns a new config.ConfigReader
type DatabaseConfig ¶
type DatabaseConfig struct { DatabaseName string `yaml:"databaseName"` Host string `yaml:"host"` Insecure bool `yaml:"insecure"` SslMode string `yaml:"sslMode"` CertificateAuthorityPath string `yaml:"certificateAuthorityPath"` CertificatePath string `yaml:"certificatePath"` CertificateKeyPath string `yaml:"certificateKeyPath"` Port int `yaml:"port"` User string `yaml:"user"` Password string `yaml:"password"` MaxOpenConns int `yaml:"maxOpenConnections"` MaxIdleConns int `yaml:"maxIdleConnections"` ConnMaxLifetimeMinutes int `yaml:"connectionMaxLifetimeMinutes"` }
DatabaseConfig contains config for the dabase connection
func (*DatabaseConfig) SetDefaults ¶
func (c *DatabaseConfig) SetDefaults()
func (*DatabaseConfig) Validate ¶
func (c *DatabaseConfig) Validate() (err error)
type FilterType ¶
type FilterType int
const ( FilterStatus FilterType = iota FilterSince FilterLabels FilterReleaseTarget FilterSearch FilterBranch FilterRecentCommitter FilterRecentReleaser FilterGroupID FilterOrganizationID FilterPipeline FilterParent FilterEntity FilterGroups FilterOrganizations FilterLast FilterArchived FilterBotName )
func ToFilter ¶
func ToFilter(f string) *FilterType
func (FilterType) String ¶
func (f FilterType) String() string
type GithubBuildControl ¶
type GithubConfig ¶
type GithubConfig struct {
Enable bool `yaml:"enable"`
}
GithubConfig is used to configure github integration
func (*GithubConfig) SetDefaults ¶
func (c *GithubConfig) SetDefaults()
func (*GithubConfig) Validate ¶
func (c *GithubConfig) Validate() (err error)
type GoogleJSONWebKey ¶
type GoogleJSONWebKey struct { E string `json:"e"` KeyType string `json:"kty"` Algorithm string `json:"alg"` N string `json:"n"` PublicKeyUse string `json:"use"` KeyID string `json:"kid"` }
GoogleJSONWebKey is the Google JWT json web key to represent the public key of the key used to encrypt the Google JWT
type GoogleJWKResponse ¶
type GoogleJWKResponse struct {
Keys []GoogleJSONWebKey `json:"keys"`
}
GoogleJWKResponse as returned by https://www.googleapis.com/oauth2/v3/certs
type IAPJSONWebKey ¶
type IAPJSONWebKey struct { Algorithm string `json:"alg"` Curve string `json:"crv"` KeyID string `json:"kid"` KeyType string `json:"kty"` PublicKeyUse string `json:"use"` X string `json:"x"` Y string `json:"y"` }
IAPJSONWebKey is the IAP JWT json web key to represent the public key of the key used to encrypt the IAP JWT
type IAPJWKResponse ¶
type IAPJWKResponse struct {
Keys []IAPJSONWebKey `json:"keys"`
}
IAPJWKResponse as returned by https://www.gstatic.com/iap/verify/public_key-jwk
type InjectCommandsConfig ¶
type InjectStagesConfig ¶
type InjectStagesConfig struct { Build *InjectStagesTypeConfig `yaml:"build,omitempty"` Release *InjectStagesTypeConfig `yaml:"release,omitempty"` Bot *InjectStagesTypeConfig `yaml:"bot,omitempty"` }
type InjectStagesTypeConfig ¶
type InjectStagesTypeConfig struct { Before []*manifest.EstafetteStage `yaml:"before,omitempty"` After []*manifest.EstafetteStage `yaml:"after,omitempty"` }
type InstallationOrganizations ¶
type InstallationOrganizations struct { Installation int `yaml:"installation"` Organizations []*contracts.Organization `yaml:"organizations"` }
InstallationOrganizations is used to assign organizations to builds triggered through a specific installation
type JWTConfig ¶
type JWTConfig struct { Domain string `yaml:"domain"` // Key to sign JWT; use 256-bit key (or 32 bytes) minimum length Key string `yaml:"key"` }
JWTConfig is used to configure JWT middleware
func (*JWTConfig) SetDefaults ¶
func (c *JWTConfig) SetDefaults()
type JobsConfig ¶
type JobsConfig struct { Namespace string `yaml:"namespace"` ServiceAccountName string `yaml:"serviceAccount"` MinCPUCores float64 `yaml:"minCPUCores"` DefaultCPUCores float64 `yaml:"defaultCPUCores"` MaxCPUCores float64 `yaml:"maxCPUCores"` CPURequestRatio float64 `yaml:"cpuRequestRatio"` CPULimitRatio float64 `yaml:"cpuLimitRatio"` MinMemoryBytes float64 `yaml:"minMemoryBytes"` DefaultMemoryBytes float64 `yaml:"defaultMemoryBytes"` MaxMemoryBytes float64 `yaml:"maxMemoryBytes"` MemoryRequestRatio float64 `yaml:"memoryRequestRatio"` MemoryLimitRatio float64 `yaml:"memoryLimitRatio"` BuildAffinityAndTolerations *AffinityAndTolerationsConfig `yaml:"build"` ReleaseAffinityAndTolerations *AffinityAndTolerationsConfig `yaml:"release"` BotAffinityAndTolerations *AffinityAndTolerationsConfig `yaml:"bot"` }
JobsConfig configures the lower and upper bounds for automatically setting resources for build/release jobs
func (*JobsConfig) SetDefaults ¶
func (c *JobsConfig) SetDefaults()
func (*JobsConfig) Validate ¶
func (c *JobsConfig) Validate() (err error)
type Middleware ¶
type Middleware interface { GoogleJWTMiddlewareFunc() gin.HandlerFunc GinJWTMiddleware(authenticator func(c *gin.Context) (interface{}, error)) (middleware *jwt.GinJWTMiddleware, err error) GinJWTMiddlewareForClientLogin(authenticator func(c *gin.Context) (interface{}, error)) (middleware *jwt.GinJWTMiddleware, err error) }
Middleware handles authentication for routes requiring authentication
func NewAuthMiddleware ¶
func NewAuthMiddleware(config *APIConfig) (authMiddleware Middleware)
NewAuthMiddleware returns a new api.AuthMiddleware
type OAuthProvider ¶
type OAuthProvider struct { Name string `yaml:"name"` ClientID string `yaml:"clientID"` ClientSecret string `yaml:"clientSecret"` Organization string `yaml:"organization"` AllowedIdentitiesRegex string `yaml:"allowedIdentitiesRegex"` }
OAuthProvider is used to configure one or more oauth providers like google, github
func (*OAuthProvider) AuthCodeURL ¶
func (p *OAuthProvider) AuthCodeURL(baseURL, state string) string
AuthCodeURL returns the url to redirect to for login
func (*OAuthProvider) GetConfig ¶
func (p *OAuthProvider) GetConfig(baseURL string) *oauth2.Config
GetConfig returns the oauth config for the provider
func (*OAuthProvider) GetUserIdentity ¶
func (p *OAuthProvider) GetUserIdentity(ctx context.Context, config *oauth2.Config, token *oauth2.Token) (identity *contracts.UserIdentity, err error)
GetUserIdentity returns the user info after a token has been retrieved
func (*OAuthProvider) SetDefaults ¶
func (c *OAuthProvider) SetDefaults()
func (*OAuthProvider) UserIsAllowed ¶
func (p *OAuthProvider) UserIsAllowed(ctx context.Context, email string) (isAllowed bool, err error)
UserIsAllowed checks if user email address matches allowedIdentitiesRegex
func (*OAuthProvider) Validate ¶
func (c *OAuthProvider) Validate() (err error)
type OAuthProviderInfo ¶
OAuthProviderInfo provides non configurable information for oauth providers
type OrderField ¶
OrderField determines sorting direction
func GetQueryParameters ¶
func GetQueryParameters(c *gin.Context) (int, int, map[FilterType][]string, []OrderField)
GetQueryParameters extracts query parameters specified according to https://jsonapi.org/format/
func GetSorting ¶
func GetSorting(c *gin.Context) (sorting []OrderField)
GetSorting extracts sorting parameters specified according to https://jsonapi.org/format/
type OwnerOrganizations ¶
type OwnerOrganizations struct { Owner string `yaml:"owner"` Organizations []*contracts.Organization `yaml:"organizations"` }
OwnerOrganizations is used to assign organizations to builds triggered through a specific owner
type Permission ¶
type Permission int
Permissions are used to secure endpoints; each role maps to one or more permissions
const ( PermissionRolesList Permission = iota PermissionUsersList PermissionUsersGet PermissionUsersCreate PermissionUsersUpdate PermissionUsersDelete PermissionUsersImpersonate PermissionGroupsList PermissionGroupsGet PermissionGroupsCreate PermissionGroupsUpdate PermissionGroupsDelete PermissionOrganizationsList PermissionOrganizationsGet PermissionOrganizationsCreate PermissionOrganizationsUpdate PermissionOrganizationsDelete PermissionClientsList PermissionClientsGet PermissionClientsViewSecret PermissionClientsCreate PermissionClientsUpdate PermissionClientsDelete PermissionIntegrationsGet PermissionIntegrationsUpdate PermissionPipelinesList PermissionPipelinesGet PermissionPipelinesUpdate PermissionPipelinesArchive PermissionBuildsList PermissionBuildsGet PermissionBuildsCancel PermissionBuildsRebuild PermissionReleasesList PermissionReleasesGet PermissionReleasesCreate PermissionReleasesCancel PermissionCatalogEntitiesList PermissionCatalogEntitiesGet PermissionCatalogEntitiesCreate PermissionCatalogEntitiesUpdate PermissionCatalogEntitiesDelete )
func GetPermissionsFromRequest ¶
func GetPermissionsFromRequest(c *gin.Context) (permissions []Permission)
func ToPermission ¶
func ToPermission(p string) *Permission
func (Permission) String ¶
func (p Permission) String() string
type ProjectOrganizations ¶
type ProjectOrganizations struct { Project string `yaml:"project"` Organizations []*contracts.Organization `yaml:"organizations"` }
ProjectOrganizations is used to assign organizations to builds triggered through a specific project
type PrometheusConfig ¶
type PrometheusConfig struct { Enable *bool `yaml:"enable"` ServerURL string `yaml:"serverURL"` ScrapeIntervalSeconds int `yaml:"scrapeIntervalSeconds"` }
PrometheusConfig configures where to find prometheus for retrieving max cpu and memory consumption of build and release jobs
func (*PrometheusConfig) SetDefaults ¶
func (c *PrometheusConfig) SetDefaults()
func (*PrometheusConfig) Validate ¶
func (c *PrometheusConfig) Validate() (err error)
type PubsubConfig ¶
type PubsubConfig struct { Enable bool `yaml:"enable"` DefaultProject string `yaml:"defaultProject"` Endpoint string `yaml:"endpoint"` Audience string `yaml:"audience"` ServiceAccountEmail string `yaml:"serviceAccountEmail"` SubscriptionNameSuffix string `yaml:"subscriptionNameSuffix"` SubscriptionIdleExpirationDays int `yaml:"subscriptionIdleExpirationDays"` }
PubsubConfig is used to be able to subscribe to pub/sub topics for triggering pipelines based on pub/sub events
func (*PubsubConfig) SetDefaults ¶
func (c *PubsubConfig) SetDefaults()
func (*PubsubConfig) Validate ¶
func (c *PubsubConfig) Validate() (err error)
type QueueConfig ¶
type QueueConfig struct { Hosts []string `yaml:"hosts"` SubjectCron string `yaml:"subjectCron"` SubjectGit string `yaml:"subjectGit"` SubjectGithub string `yaml:"subjectGithub"` SubjectBitbucket string `yaml:"subjectBitbucket"` }
QueueConfig contains config for the dabase connection
func (*QueueConfig) SetDefaults ¶
func (c *QueueConfig) SetDefaults()
func (*QueueConfig) Validate ¶
func (c *QueueConfig) Validate() (err error)
type ReleaseControl ¶
type ReleaseControl struct { Repositories map[string]RepositoryReleaseControl `yaml:"repos" json:"repositories,omitempty"` RestrictedClusters List `yaml:"restrictedClusters,omitempty" json:"restrictedClusters,omitempty"` }
type Role ¶
type Role int
Role is used to hand out permissions to users and clients
const ( // RoleAdministrator can configure role-based-access-control RoleAdministrator Role = iota // RoleCronTrigger can send a cron event RoleCronTrigger // RoleLogMigrator is needed to migrate logs from db to cloud storage and vice versa RoleLogMigrator // RoleRoleViewer allows to view available roles RoleRoleViewer // RoleUserViewer allows to view users RoleUserViewer // RoleUserAdmin allows to view, create and update users RoleUserAdmin // RoleGroupViewer allows to view groups RoleGroupViewer // RoleGroupAdmin allows to view, create and update groups RoleGroupAdmin // RoleOrganizationViewer allows to view organizations RoleOrganizationViewer // RoleOrganizationAdmin allows to view, create and update organizations RoleOrganizationAdmin // RoleClientViewer allows to view clients RoleClientViewer // RoleClientAdmin allows to view, create and update clients RoleClientAdmin // RoleOrganizationPipelinesViewer allows to view all pipelines linked to an organization RoleOrganizationPipelinesViewer // RoleOrganizationPipelinesOperator allows to operate all pipelines linked to an organization RoleOrganizationPipelinesOperator // RoleGroupPipelinesViewer allows to view all pipelines linked to a group RoleGroupPipelinesViewer // RoleGroupPipelinesOperator allows to operate all pipelines linked to a group RoleGroupPipelinesOperator // RoleCatalogEntitiesViewer allows to view all catalog entities RoleCatalogEntitiesViewer // RoleCatalogEntitiesAdmin allows to view, create, update and delete catalog entities RoleCatalogEntitiesAdmin )
func GetRolesFromRequest ¶
type SlackConfig ¶
type SlackConfig struct { Enable bool `yaml:"enable"` ClientID string `yaml:"clientID"` ClientSecret string `yaml:"clientSecret"` AppVerificationToken string `yaml:"appVerificationToken"` AppOAuthAccessToken string `yaml:"appOAuthAccessToken"` }
SlackConfig is used to configure slack integration
func (*SlackConfig) SetDefaults ¶
func (c *SlackConfig) SetDefaults()
func (*SlackConfig) Validate ¶
func (c *SlackConfig) Validate() (err error)
type WarningHelper ¶
type WarningHelper interface { GetManifestWarnings(*manifest.EstafetteManifest, string) ([]contracts.Warning, error) GetContainerImageParts(string) (string, string, string) }
WarningHelper checks whether any warnings should be issued
func NewWarningHelper ¶
func NewWarningHelper(secretHelper crypt.SecretHelper) (warningHelper WarningHelper)
NewWarningHelper returns a new estafette.WarningHelper