service

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PERPAGE = 100
	PAGE    = 1
)
View Source
const DefaultScanningTimeout = 60 * 60

Variables

This section is empty.

Functions

func CancelScanningTask added in v1.9.9

func CancelScanningTask(userName, scanningID string, taskID int64, typeString config.PipelineType, requestID string, log *zap.SugaredLogger) error

func ConvertToDBScanningModule added in v1.9.9

func ConvertToDBScanningModule(args *Scanning) *commonmodels.Scanning

func CreateScanningModule added in v1.9.9

func CreateScanningModule(username string, args *Scanning, log *zap.SugaredLogger) error

func CreateScanningTask added in v1.9.9

func CreateScanningTask(id string, req []*ScanningRepoInfo, notificationID, username string, log *zap.SugaredLogger) (int64, error)

CreateScanningTask uses notificationID if the task is triggered by webhook, otherwise it should be empty

func CreateTesting added in v1.2.0

func CreateTesting(username string, testing *commonmodels.Testing, log *zap.SugaredLogger) error

func DeleteScanningModuleByID added in v1.9.9

func DeleteScanningModuleByID(id string, log *zap.SugaredLogger) error

func GetHTMLTestReport added in v1.2.0

func GetHTMLTestReport(pipelineName, pipelineType, taskIDStr, testName string, log *zap.SugaredLogger) (string, error)

func GetRaw

func GetRaw(name, productName string, log *zap.SugaredLogger) (*commonmodels.Testing, error)

GetRaw find the testing module with secret env not masked

func GetTestLocalTestSuite

func GetTestLocalTestSuite(serviceName string, log *zap.SugaredLogger) (*commonmodels.TestSuite, error)

func GetTestTask

func GetTestTask(testName string) (*commonmodels.TestTaskStat, error)

func GetTesting added in v1.2.0

func GetTesting(name, productName string, log *zap.SugaredLogger) (*commonmodels.Testing, error)

func GetWorkflowV4HTMLTestReport added in v1.9.9

func GetWorkflowV4HTMLTestReport(workflowName, jobName string, taskID int64, log *zap.SugaredLogger) (string, error)

func HandleCronjob

func HandleCronjob(testing *commonmodels.Testing, log *zap.SugaredLogger) error

func ListAllWorkflows

func ListAllWorkflows(testName string, log *zap.SugaredLogger) ([]*commonmodels.Workflow, error)

func ListCronjob

func ListCronjob(name, jobType string) ([]*commonmodels.Cronjob, error)

func ListTestStat added in v1.2.0

func ListTestStat(log *zap.SugaredLogger) ([]*commonmodels.TestTaskStat, error)

func UpdateScanningModule added in v1.9.9

func UpdateScanningModule(id, username string, args *Scanning, log *zap.SugaredLogger) error

func UpdateTesting added in v1.2.0

func UpdateTesting(username string, testing *commonmodels.Testing, log *zap.SugaredLogger) error

Types

type CreateTaskResp

type CreateTaskResp struct {
	PipelineName string `json:"pipeline_name"`
	TaskID       int64  `json:"task_id"`
}

func CreateTestTask

func CreateTestTask(args *commonmodels.TestTaskArgs, log *zap.SugaredLogger) (*CreateTaskResp, error)

type GetTestArtifactInfoResp added in v1.9.9

type GetTestArtifactInfoResp struct {
	FileNames          []string `json:"file_names"`
	NotHistoryFileFlag bool     `json:"not_history_file_flag"`
}

func GetTestArtifactInfo

func GetTestArtifactInfo(pipelineName, dir string, taskID int64, log *zap.SugaredLogger) (*GetTestArtifactInfoResp, error)

func GetWorkflowV4TestArtifactInfo added in v1.9.9

func GetWorkflowV4TestArtifactInfo(workflowName, jobName string, taskID int64, log *zap.SugaredLogger) (*GetTestArtifactInfoResp, error)

type ListScanningRespItem added in v1.9.9

type ListScanningRespItem struct {
	ID         string             `json:"id"`
	Name       string             `json:"name"`
	Statistics *ScanningStatistic `json:"statistics"`
	CreatedAt  int64              `json:"created_at"`
	UpdatedAt  int64              `json:"updated_at"`
}

func ListScanningModule added in v1.9.9

func ListScanningModule(projectName string, log *zap.SugaredLogger) ([]*ListScanningRespItem, int64, error)

type ListScanningTaskResp added in v1.9.9

type ListScanningTaskResp struct {
	ScanInfo   *ScanningInfo       `json:"scan_info"`
	ScanTasks  []*ScanningTaskResp `json:"scan_tasks"`
	TotalTasks int                 `json:"total_tasks"`
}

func ListScanningTask added in v1.9.9

func ListScanningTask(id string, pageNum, pageSize int64, log *zap.SugaredLogger) (*ListScanningTaskResp, error)

type Scanning added in v1.9.9

type Scanning struct {
	ID          string              `json:"id"`
	Name        string              `json:"name"`
	ProjectName string              `json:"project_name"`
	Description string              `json:"description"`
	ScannerType string              `json:"scanner_type"`
	ImageID     string              `json:"image_id"`
	SonarID     string              `json:"sonar_id"`
	Repos       []*types.Repository `json:"repos"`
	// Parameter is for sonarQube type only
	Parameter string `json:"parameter"`
	// Script is for other type only
	Script          string                         `json:"script"`
	AdvancedSetting *types.ScanningAdvancedSetting `json:"advanced_settings"`
}

func ConvertDBScanningModule added in v1.9.9

func ConvertDBScanningModule(scanning *commonmodels.Scanning) *Scanning

func GetScanningModuleByID added in v1.9.9

func GetScanningModuleByID(id string, log *zap.SugaredLogger) (*Scanning, error)

type ScanningInfo added in v1.9.9

type ScanningInfo struct {
	Editor    string `json:"editor"`
	UpdatedAt int64  `json:"updated_at"`
}

type ScanningRepoInfo added in v1.9.9

type ScanningRepoInfo struct {
	CodehostID    int    `json:"codehost_id"`
	Source        string `json:"source"`
	RepoOwner     string `json:"repo_owner"`
	RepoNamespace string `json:"repo_namespace"`
	RepoName      string `json:"repo_name"`
	PR            int    `json:"pr"`
	Branch        string `json:"branch"`
	Tag           string `json:"tag"`
}

type ScanningStatistic added in v1.9.9

type ScanningStatistic struct {
	TimesRun       int64 `json:"times_run"`
	AverageRuntime int64 `json:"run_time_average"`
}

type ScanningTaskDetail added in v1.9.9

type ScanningTaskDetail struct {
	Creator    string              `json:"creator"`
	Status     string              `json:"status"`
	CreateTime int64               `json:"create_time"`
	EndTime    int64               `json:"end_time"`
	RepoInfo   []*types.Repository `json:"repo_info"`
	ResultLink string              `json:"result_link,omitempty"`
}

func GetScanningTaskInfo added in v1.9.9

func GetScanningTaskInfo(scanningID string, taskID int64, log *zap.SugaredLogger) (*ScanningTaskDetail, error)

type ScanningTaskResp added in v1.9.9

type ScanningTaskResp struct {
	ScanID    int64  `json:"scan_id"`
	Status    string `json:"status"`
	RunTime   int64  `json:"run_time"`
	Creator   string `json:"creator"`
	CreatedAt int64  `json:"created_at"`
}

type TestingDetail

type TestingDetail struct {
	Name        string                 `json:"name"`
	Envs        []*commonmodels.KeyVal `json:"envs"`
	Repos       []*types.Repository    `json:"repos"`
	Desc        string                 `json:"desc"`
	ProductName string                 `json:"product_name"`
}

func ListTestingDetails

func ListTestingDetails(productName string, log *zap.SugaredLogger) ([]*TestingDetail, error)

type TestingOpt

type TestingOpt struct {
	Name        string                     `bson:"name"                   json:"name"`
	ProductName string                     `bson:"product_name"           json:"product_name"`
	Desc        string                     `bson:"desc"                   json:"desc"`
	UpdateTime  int64                      `bson:"update_time"            json:"update_time"`
	UpdateBy    string                     `bson:"update_by"              json:"update_by"`
	TestCaseNum int                        `bson:"-"                      json:"test_case_num,omitempty"`
	ExecuteNum  int                        `bson:"-"                      json:"execute_num,omitempty"`
	PassRate    float64                    `bson:"-"                      json:"pass_rate,omitempty"`
	AvgDuration float64                    `bson:"-"                      json:"avg_duration,omitempty"`
	Workflows   []*commonmodels.Workflow   `bson:"-"                      json:"workflows,omitempty"`
	Schedules   *commonmodels.ScheduleCtrl `bson:"-"                      json:"schedules,omitempty"`
	Repos       []*types.Repository        `bson:"repos"                  json:"repos"`
	KeyVals     []*commonmodels.KeyVal     `bson:"key_vals"               json:"key_vals"`
}

func ListTestingOpt

func ListTestingOpt(productNames []string, testType string, log *zap.SugaredLogger) ([]*TestingOpt, error)

Jump to

Keyboard shortcuts

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