Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTaskParse is what is wrapped when a parse error occurs. ErrTaskParse = errors.New("parse error") // ErrTaskValidation is what is wrapped when errors in TaskSettings.Validate() occur. ErrTaskValidation = errors.New("validation error") )
Functions ¶
func DecodeKey ¶
DecodeKey takes a hexadecimal key and turns it into a byte array where the bytes represent the by-two hexadecimal numerical values present in the original key.
func EncodeKey ¶
EncodeKey takes a byte stream and yields a hexadecimal set of values associated with it. See `xxd(1)`.
func EncryptToken ¶
func EncryptToken(key []byte, tok *OAuthToken) ([]byte, error)
EncryptToken encrypts an oauth token with gcm+aes.
Types ¶
type OAuthToken ¶
type OAuthToken struct { Token string `json:"token"` Scopes []string `json:"scopes"` Username string `json:"username"` }
OAuthToken contains a token and any metadata we want to assign to it.
func DecryptToken ¶
func DecryptToken(key, tokenBytes []byte) (*OAuthToken, error)
DecryptToken decrypts a token message that was encrypted by EncryptToken.
func (*OAuthToken) Can ¶
func (oat *OAuthToken) Can(scope string) bool
Can returns true if the scope is present in the scopes list.
type RepoConfig ¶
type RepoConfig struct { AllowPrivileged bool `yaml:"allow_privileged"` WorkDir string `yaml:"workdir"` Queue string `yaml:"queue"` OverrideQueue bool `yaml:"override_queue"` GlobalTimeout time.Duration `yaml:"global_timeout"` // run timeout. if unset, or 0, no timeout. OverrideTimeout bool `yaml:"override_timeout"` IgnoreDirs []string `yaml:"ignore_directories"` Metadata map[string]interface{} `yaml:"metadata"` OverrideMetadata bool `yaml:"override_metadata"` DefaultImage string `yaml:"default_image"` DefaultResources Resources `yaml:"default_resources"` Merge RepoConfigMergeOptions `yaml:"merge_options"` }
RepoConfig is the global configuration for the repository. It allows setting of global attributes as well as overrides and defaults for certain task-related items. It is typically named `tinyci.yml`.
func NewRepoConfig ¶
func NewRepoConfig(buf []byte) (RepoConfig, error)
NewRepoConfig creates a new repo config from a byte buffer.
func NewRepoConfigFromProto ¶ added in v0.3.0
func NewRepoConfigFromProto(rs *types.RepoConfig) RepoConfig
NewRepoConfigFromProto creates a runsettings from a proto representation.
func (*RepoConfig) ToProto ¶ added in v0.3.0
func (r *RepoConfig) ToProto() *types.RepoConfig
ToProto converts the run settings to the protobuf representation.
func (*RepoConfig) Validate ¶
func (r *RepoConfig) Validate() error
Validate returns any error if there are validation errors in the repo config.
type RepoConfigMergeOptions ¶ added in v0.3.0
type RepoConfigMergeOptions struct { DoNotMerge bool `yaml:"do_not_merge"` // do not merge any branch with the default branch. IgnoreRefs []string `yaml:"ignore_refs"` // be sure to include the full ref name "heads/my_branch" etc FIXME make this globbable later. }
RepoConfigMergeOptions is the operations around merging branches before launching the container.
func NewRepoConfigMergeOptionsFromProto ¶ added in v0.3.0
func NewRepoConfigMergeOptionsFromProto(rs *types.Merge) RepoConfigMergeOptions
NewRepoConfigMergeOptionsFromProto returns a local type for the protobuf type
func (RepoConfigMergeOptions) ToProto ¶ added in v0.3.0
func (rcm RepoConfigMergeOptions) ToProto() *types.Merge
ToProto converts the obj to protobuf
type Resources ¶ added in v0.3.0
type Resources struct { CPU string `yaml:"cpu"` Memory string `yaml:"memory"` Disk string `yaml:"disk"` IOPS string `yaml:"iops"` }
Resources communicates what resources should be available to the runner. This can be overridden by the tinyci master configuration.
The values here and their measurements are interpreted by the runner. We do not normalize between runners.
type RunSettings ¶
type RunSettings struct { Privileged bool `yaml:"privileged"` Command []string `yaml:"command"` Image string `yaml:"image"` Queue string `yaml:"queue"` Metadata map[string]interface{} `yaml:"metadata"` Name string `yaml:"-"` Timeout time.Duration `yaml:"timeout"` Resources Resources `yaml:"resources"` Env []string `yaml:"env"` }
RunSettings encompasses things that are a part of a run that are configurable by a user.
func NewRunSettingsFromProto ¶
func NewRunSettingsFromProto(rs *types.RunSettings) *RunSettings
NewRunSettingsFromProto creates a runsettings from a proto representation.
func (*RunSettings) ToProto ¶
func (rs *RunSettings) ToProto() *types.RunSettings
ToProto converts the run settings to the protobuf representation.
func (*RunSettings) Validate ¶
func (rs *RunSettings) Validate(t *TaskSettings) error
Validate validates the run settings, returning errors on any found.
type Submission ¶
type Submission struct { Parent string `json:"parent"` Fork string `json:"fork"` HeadSHA string `json:"head_sha"` BaseSHA string `json:"base_sha"` TicketID int64 `json:"ticket_id"` SubmittedBy string `json:"submitted_by"` All bool `json:"all"` Manual bool `json:"-"` }
Submission is the encapsulation of a submission to the queuesvc.
func (*Submission) Validate ¶
func (sub *Submission) Validate() error
Validate validates the submission, and returns an error if it encounters any.
type TaskSettings ¶
type TaskSettings struct { Mountpoint string `yaml:"mountpoint"` Env []string `yaml:"env"` Dependencies []string `yaml:"dependencies"` WorkDir string `yaml:"workdir"` Runs map[string]*RunSettings `yaml:"runs"` DefaultTimeout time.Duration `yaml:"default_timeout"` DefaultQueue string `yaml:"default_queue"` DefaultImage string `yaml:"default_image"` Metadata map[string]interface{} `yaml:"metadata"` Config RepoConfig `yaml:"-"` DefaultResources Resources `yaml:"default_resources"` }
TaskSettings encompasses things that are a part of a task that are configurable by a user.
func NewTaskSettings ¶
func NewTaskSettings(buf []byte, requireRuns bool, rc RepoConfig) (*TaskSettings, error)
NewTaskSettings creates a new task configuration from a byte buffer.
func NewTaskSettingsFromProto ¶
func NewTaskSettingsFromProto(ts *types.TaskSettings) *TaskSettings
NewTaskSettingsFromProto creates a task settings object from a proto representation.
func (*TaskSettings) ToProto ¶
func (t *TaskSettings) ToProto() *types.TaskSettings
ToProto makes a protobuf version of task settings.
func (*TaskSettings) Validate ¶
func (t *TaskSettings) Validate(requireRuns bool) error
Validate validates the task settings.