models

package
v0.0.0-...-5e0bd72 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

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

type DroidMetadataFileDef struct {
	Path      string `yaml:"path"`
	SecretKey string `yaml:"secretKey"`
}

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 QueryRun

func QueryRun(runID int) (*Run, error)

QueryRun returns the run of the runID

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

func (run *Run) IsOfficial() bool

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) String

func (run Run) String() string

String creates a formatted summary about a Run.

func (*Run) SubmitChange

func (run *Run) SubmitChange() (*Run, error)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL