citool

package
v0.0.0-...-a450720 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadCircleCIJobResults

func DownloadCircleCIJobResults(params DownloadParams)

DownloadCircleCIJobResults performs the downloading of the build results.

func IsEmpty

func IsEmpty(value *string) bool

IsEmpty is a helper function which returns true if value is nil or empty

func LogDebug

func LogDebug(msg string)

LogDebug logs if debug mode is enabled. NO-OP otherwise.

func PrintJobStats

func PrintJobStats(results []CircleCiJobResult, params AnalyzeParams)

PrintJobStats prints the aggregated job statistics from results.

func SetDebugMode

func SetDebugMode(newMode bool)

SetDebugMode enables/disables dbeug enable mode which enables debug logging.

Types

type AggregateJobInfo

type AggregateJobInfo struct {
	JobName            string
	Frequency          int
	CumulativeDuration time.Duration
	SuccessCount       int32
	FailureCount       int32
}

AggregateJobInfo is aggregated job status information from the individual jobs

type AnalyzeParams

type AnalyzeParams struct {
	PrintJobSuccessRate         bool
	PrintJobDurationInAggregate bool
	PrintJobDurationTimeSeries  bool
	PrintJobSuccessTimeSeries   bool
}

AnalyzeParams are used for configuring the analysis mode settings.

type CircleCiJobResult

type CircleCiJobResult struct {
	Username    string              `json:"username"`
	Reponame    string              `json:"reponame"`
	Branch      string              `json:"branch"`
	BuildNumber int                 `json:"build_num"`
	Status      JobStatusType       `json:"status"`
	EndTime     string              `json:"stop_time"`
	StartTime   string              `json:"start_time"`
	Workflows   CircleCiJobWorkflow `json:"workflows"`
}

CircleCiJobResult encapsulates the relevant portions of a single Circle CI build result.

func GetCircleCIJobResults

func GetCircleCIJobResults(filename string) []CircleCiJobResult

GetCircleCIJobResults reads filename and returns the results as an array of Circle CI build results.

type CircleCiJobWorkflow

type CircleCiJobWorkflow struct {
	JobName string `json:"job_name"`
}

CircleCiJobWorkflow encapsulates the relevant portions of "workflows" filed in a Circle CI build result.

type DownloadParams

type DownloadParams struct {
	CircleToken     *string
	VcsType         *string
	Username        *string
	RepositoryName  *string
	BranchName      *string
	Start           int
	Limit           int
	DownloadDirPath string
	JobStatus       *JobStatusFilterTypes
}

DownloadParams are used for configuring parameters for downloading data from Circle CI.

type FilterParams

type FilterParams struct {
	Username       *string
	RepositoryName *string
	BranchName     *string
	JobName        *string
	JobStatus      *string
	Start          int
	Limit          int
}

FilterParams are parameters used for filtering results at the time of analysis.

func (FilterParams) FilterData

func (filterParams FilterParams) FilterData(results *[]CircleCiJobResult)

FilterData filters the results field in-place using filterParams.

type JobStatusFilterTypes

type JobStatusFilterTypes string

JobStatusFilterTypes enum values are the job status values used for filtering.

const (
	JobCompleted  JobStatusFilterTypes = "completed"
	JobSuccessful JobStatusFilterTypes = "successful"
	JobFailed     JobStatusFilterTypes = "failed"
	JobRunning    JobStatusFilterTypes = "running"
)

Only for filtering https://circleci.com/docs/api/#recent-builds-across-all-projects

func GetJobStatusFilterOrFail

func GetJobStatusFilterOrFail(status string) JobStatusFilterTypes

GetJobStatusFilterOrFail converts the string value to enum type. Panics if the string value does not match any enum value.

type JobStatusType

type JobStatusType string

JobStatusType represents the actual status of the job. These values are valid only for the status field inside the job result JSON structure

const (
	JobStatusRetried            JobStatusType = "retried"
	JobStatusCanceled           JobStatusType = "canceled"
	JobStatusInfrastructureFail JobStatusType = "infrastructure_fail"
	JobStatusTimedOut           JobStatusType = "timedout"
	JobStatusNotRun             JobStatusType = "not_run"
	JobStatusRunning            JobStatusType = "running"
	JobStatusFailed             JobStatusType = "failed"
	JobStatusQueued             JobStatusType = "queued"
	JobStatusScheduled          JobStatusType = "scheduled"
	JobStatusNotRunning         JobStatusType = "not_running"
	JobStatusNoTests            JobStatusType = "no_tests"
	JobStatusFixed              JobStatusType = "fixed"
	JobStatusSuccess            JobStatusType = "success"
)

:retried, :canceled, :infrastructure_fail, :timedout, :not_run, :running, :failed, :queued, :scheduled, :not_running, :no_tests, :fixed, :success

Jump to

Keyboard shortcuts

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