Documentation ¶
Index ¶
- type DroidMetadata
- type DroidMetadataEnvDef
- type DroidMetadataFileDef
- type Run
- type TaskResult
- type TaskSetting
- func (setting *TaskSetting) CreateCompletedTask(result string, duration int, podName string, runID string) *TaskResult
- func (setting *TaskSetting) CreateUncompletedTask(podName string, runID string, errorMsg string) *TaskResult
- func (setting *TaskSetting) Execute() (result string, duration int, output []byte)
- func (setting *TaskSetting) GetIdentifier() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DroidMetadata ¶
type DroidMetadata struct { Kind string `yaml:"kind"` Version string `yaml:"version"` Product string `yaml:"product"` Storage bool `yaml:"storage"` Environments []DroidMetadataEnvDef `yaml:"environments"` SecretFiles []DroidMetadataFileDef `yaml:"secretFiles"` }
DroidMetadata defines the data model used in metadata.yml
func ReadDroidMetadata ¶
func ReadDroidMetadata(filePath string) *DroidMetadata
ReadDroidMetadata reads the droid metadata from the metadata.yml file. Returns nil if the file is missing or the JSON unmarshal failed.
type DroidMetadataEnvDef ¶
type DroidMetadataEnvDef struct { Name string `yaml:"name"` Type string `yaml:"type"` Value string `yaml:"value"` }
DroidMetadataEnvDef defines the data model of the environment variable definition in metadata.yml
type DroidMetadataFileDef ¶
DroidMetadataFileDef defines the data model of the secret files definition in metadata.yml
type Run ¶
type Run struct { ID int `json:"id,omitempty"` Name string `json:"name"` Settings map[string]interface{} `json:"settings"` Details map[string]string `json:"details"` Status string `json:"status"` }
Run is the data structure of A01 run
func (*Run) GetSecretName ¶
func (run *Run) GetSecretName(metadata *DroidMetadata) string
GetSecretName returns the secret mapping to this run. It first tries to find the secret name in the run settings. If the run's settings do not contain the property, falls back to the product name in the metadata.
func (*Run) IsOfficial ¶
IsOfficial returns true if the run is an official run
func (*Run) QueryTests ¶
func (run *Run) QueryTests() []TaskSetting
QueryTests returns the list of test tasks based on the query string
func (*Run) SubmitChange ¶
SubmitChange POST the changes in current Run instance to task store
type TaskResult ¶
type TaskResult struct { Annotation string `json:"annotation,omitempty"` Duration int `json:"duration,omitempty"` ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Result string `json:"result,omitempty"` ResultDetails map[string]interface{} `json:"result_details,omitempty"` RunID int `json:"run_id,omitempty"` Settings TaskSetting `json:"settings,omitempty"` Status string `json:"status,omitempty"` }
TaskResult is the data model of a task in A01 system
func (*TaskResult) CommitChanges ¶
func (task *TaskResult) CommitChanges() (*TaskResult, error)
CommitChanges save a committed task's updated properties to the database
func (*TaskResult) CommitNew ¶
func (task *TaskResult) CommitNew() (*TaskResult, error)
CommitNew save an uncommitted Task to the database
func (*TaskResult) SaveTaskLog ¶
func (task *TaskResult) SaveTaskLog(output []byte) (string, error)
SaveTaskLog the task execution log to the mounted artifacts folder
type TaskSetting ¶
type TaskSetting struct { Version string `json:"ver,omitempty"` Execution map[string]string `json:"execution,omitempty"` Classifier map[string]string `json:"classifier,omitempty"` Miscellanea map[string]string `json:"misc,omitempty"` }
TaskSetting is the setting data model of A01Task
func (*TaskSetting) CreateCompletedTask ¶
func (setting *TaskSetting) CreateCompletedTask(result string, duration int, podName string, runID string) *TaskResult
CreateCompletedTask returns an uncommitted Task instance which represents a completed task
func (*TaskSetting) CreateUncompletedTask ¶
func (setting *TaskSetting) CreateUncompletedTask(podName string, runID string, errorMsg string) *TaskResult
CreateUncompletedTask returns an uncommitted Task instance which represents an incomplete task.
func (*TaskSetting) Execute ¶
func (setting *TaskSetting) Execute() (result string, duration int, output []byte)
Execute runs the command and returns the execution results
func (*TaskSetting) GetIdentifier ¶
func (setting *TaskSetting) GetIdentifier() string
GetIdentifier returns the unique identifier of the task setting