schemas

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMergeRequestIIDFromRefName

func GetMergeRequestIIDFromRefName(refName string) (string, error)

GetMergeRequestIIDFromRefName parse a refName to extract a merge request IID.

func GetRefRegexp

func GetRefRegexp(ppr config.ProjectPullRefs, rk RefKind) (re *regexp.Regexp, err error)

GetRefRegexp returns the expected regexp given a ProjectPullRefs config and a RefKind.

Types

type Deployment

type Deployment struct {
	JobID           int
	RefKind         RefKind
	RefName         string
	Username        string
	Timestamp       float64
	DurationSeconds float64
	CommitShortID   string
	Status          string
}

Deployment ..

type Environment

type Environment struct {
	ProjectName      string
	ID               int
	Name             string
	ExternalURL      string
	Available        bool
	LatestDeployment Deployment

	OutputSparseStatusMetrics bool
}

Environment ..

func (Environment) DefaultLabelsValues

func (e Environment) DefaultLabelsValues() map[string]string

DefaultLabelsValues ..

func (Environment) InformationLabelsValues

func (e Environment) InformationLabelsValues() (v map[string]string)

InformationLabelsValues ..

func (Environment) Key

func (e Environment) Key() EnvironmentKey

Key ..

type EnvironmentKey

type EnvironmentKey string

EnvironmentKey ..

type Environments

type Environments map[EnvironmentKey]Environment

Environments allows us to keep track of all the Environment objects we have discovered.

func (Environments) Count

func (envs Environments) Count() int

Count returns the amount of environments in the map.

type Job

type Job struct {
	ID                    int
	Name                  string
	Stage                 string
	Timestamp             float64
	StartTime             float64
	DurationSeconds       float64
	QueuedDurationSeconds float64
	Status                string
	ArtifactSize          float64
	Runner                Runner
}

Job ..

func NewJob

func NewJob(gj goGitlab.Job) Job

NewJob ..

type Jobs

type Jobs map[string]Job

Jobs ..

type Metric

type Metric struct {
	Kind   MetricKind
	Labels prometheus.Labels
	Value  float64
}

Metric ..

func (Metric) Key

func (m Metric) Key() MetricKey

Key ..

type MetricKey

type MetricKey string

MetricKey ..

type MetricKind

type MetricKind int32

MetricKind ..

const (
	// MetricKindCoverage refers to the coerage of a job/pipeline.
	MetricKindCoverage MetricKind = iota

	// MetricKindDurationSeconds ..
	MetricKindDurationSeconds

	// MetricKindEnvironmentBehindCommitsCount ..
	MetricKindEnvironmentBehindCommitsCount

	// MetricKindEnvironmentBehindDurationSeconds ..
	MetricKindEnvironmentBehindDurationSeconds

	// MetricKindEnvironmentDeploymentCount ..
	MetricKindEnvironmentDeploymentCount

	// MetricKindEnvironmentDeploymentDurationSeconds ..
	MetricKindEnvironmentDeploymentDurationSeconds

	// MetricKindEnvironmentDeploymentJobID ..
	MetricKindEnvironmentDeploymentJobID

	// MetricKindEnvironmentDeploymentStatus ..
	MetricKindEnvironmentDeploymentStatus

	// MetricKindEnvironmentDeploymentTimestamp ..
	MetricKindEnvironmentDeploymentTimestamp

	// MetricKindEnvironmentInformation ..
	MetricKindEnvironmentInformation

	// MetricKindID ..
	MetricKindID

	// MetricKindJobArtifactSizeBytes ..
	MetricKindJobArtifactSizeBytes

	// MetricKindJobDurationSeconds ..
	MetricKindJobDurationSeconds

	// MetricKindJobID ..
	MetricKindJobID

	// MetricKindJobQueuedDurationSeconds ..
	MetricKindJobQueuedDurationSeconds

	// MetricKindJobRunCount ..
	MetricKindJobRunCount

	// MetricKindJobStatus ..
	MetricKindJobStatus

	// MetricKindJobTimestamp ..
	MetricKindJobTimestamp

	// MetricKindJobStartTime ..
	MetricKindJobStartTime

	// MetricKindQueuedDurationSeconds ..
	MetricKindQueuedDurationSeconds

	// MetricKindRunCount ..
	MetricKindRunCount

	// MetricKindStatus ..
	MetricKindStatus

	// MetricKindTimestamp ..
	MetricKindTimestamp

	// MetricKindStartTime ..
	MetricKindStartTime

	// MetricKindTestReportTotalTime ..
	MetricKindTestReportTotalTime

	// MetricKindTestReportTotalCount ..
	MetricKindTestReportTotalCount

	// MetricKindTestReportSuccessCount ..
	MetricKindTestReportSuccessCount

	// MetricKindTestReportFailedCount ..
	MetricKindTestReportFailedCount

	// MetricKindTestReportSkippedCount ..
	MetricKindTestReportSkippedCount

	// MetricKindTestReportErrorCount ..
	MetricKindTestReportErrorCount

	// MetricKindTestSuiteTotalTime ..
	MetricKindTestSuiteTotalTime

	// MetricKindTestSuiteTotalCount ..
	MetricKindTestSuiteTotalCount

	// MetricKindTestSuiteSuccessCount ..
	MetricKindTestSuiteSuccessCount

	// MetricKindTestSuiteFailedCount ..
	MetricKindTestSuiteFailedCount

	// MetricKindTestSuiteSkippedCount ..
	MetricKindTestSuiteSkippedCount

	// MetricKindTestSuiteErrorCount ..
	MetricKindTestSuiteErrorCount
)

type Metrics

type Metrics map[MetricKey]Metric

Metrics ..

type Pipeline

type Pipeline struct {
	ID                    int
	Coverage              float64
	Timestamp             float64
	StartTime             float64
	DurationSeconds       float64
	QueuedDurationSeconds float64
	Status                string
	Variables             string
	TestReport            TestReport
}

Pipeline ..

func NewPipeline

func NewPipeline(ctx context.Context, gp goGitlab.Pipeline) Pipeline

NewPipeline ..

type Project

type Project struct {
	config.Project

	Topics string
}

Project ..

func NewProject

func NewProject(name string) Project

NewProject ..

func (Project) Key

func (p Project) Key() ProjectKey

Key ..

type ProjectKey

type ProjectKey string

ProjectKey ..

type Projects

type Projects map[ProjectKey]Project

Projects ..

type Ref

type Ref struct {
	Kind           RefKind
	Name           string
	Project        Project
	LatestPipeline Pipeline
	LatestJobs     Jobs
}

Ref is what we will use a metrics entity on which we will perform regular pulling operations.

func NewRef

func NewRef(
	project Project,
	kind RefKind,
	name string,
) Ref

NewRef is an helper which returns a new Ref.

func (Ref) DefaultLabelsValues

func (ref Ref) DefaultLabelsValues() map[string]string

DefaultLabelsValues ..

func (Ref) Key

func (ref Ref) Key() RefKey

Key ..

type RefKey

type RefKey string

RefKey ..

type RefKind

type RefKind string

RefKind is used to determine the kind of the ref.

const (

	// RefKindBranch refers to a branch.
	RefKindBranch RefKind = "branch"

	// RefKindTag refers to a tag.
	RefKindTag RefKind = "tag"

	// RefKindMergeRequest refers to a tag.
	RefKindMergeRequest RefKind = "merge-request"
)

type Refs

type Refs map[RefKey]Ref

Refs allows us to keep track of all the Ref we have configured/discovered.

func (Refs) Count

func (refs Refs) Count() int

Count returns the amount of projects refs in the map.

type Runner

type Runner struct {
	Description string
}

Runner ..

type TaskType

type TaskType string

TaskType represents the type of a task.

const (
	// TaskTypePullProjectsFromWildcard ..
	TaskTypePullProjectsFromWildcard TaskType = "PullProjectsFromWildcard"

	// TaskTypePullProjectsFromWildcards ..
	TaskTypePullProjectsFromWildcards TaskType = "PullProjectsFromWildcards"

	// TaskTypePullEnvironmentsFromProject ..
	TaskTypePullEnvironmentsFromProject TaskType = "PullEnvironmentsFromProject"

	// TaskTypePullEnvironmentsFromProjects ..
	TaskTypePullEnvironmentsFromProjects TaskType = "PullEnvironmentsFromProjects"

	// TaskTypePullEnvironmentMetrics ..
	TaskTypePullEnvironmentMetrics TaskType = "PullEnvironmentMetrics"

	// TaskTypePullMetrics ..
	TaskTypePullMetrics TaskType = "PullMetrics"

	// TaskTypePullRefsFromProject ..
	TaskTypePullRefsFromProject TaskType = "PullRefsFromProject"

	// TaskTypePullRefsFromProjects ..
	TaskTypePullRefsFromProjects TaskType = "PullRefsFromProjects"

	// TaskTypePullRefMetrics ..
	TaskTypePullRefMetrics TaskType = "PullRefMetrics"

	// TaskTypeGarbageCollectProjects ..
	TaskTypeGarbageCollectProjects TaskType = "GarbageCollectProjects"

	// TaskTypeGarbageCollectEnvironments ..
	TaskTypeGarbageCollectEnvironments TaskType = "GarbageCollectEnvironments"

	// TaskTypeGarbageCollectRefs ..
	TaskTypeGarbageCollectRefs TaskType = "GarbageCollectRefs"

	// TaskTypeGarbageCollectMetrics ..
	TaskTypeGarbageCollectMetrics TaskType = "GarbageCollectMetrics"

	// TaskTypeConfigUpdate ..
	TaskTypeConfigUpdate TaskType = "ConfigUpdate"

	// TaskTypeAddWebhooks ..
	TaskTypeAddWebhooks TaskType = "AddWebhooks"
)

type Tasks

type Tasks map[TaskType]map[string]interface{}

Tasks can be used to keep track of tasks.

type TestReport

type TestReport struct {
	TotalTime    float64
	TotalCount   int
	SuccessCount int
	FailedCount  int
	SkippedCount int
	ErrorCount   int
	TestSuites   []TestSuite
}

TestReport ..

func NewTestReport

func NewTestReport(gtr goGitlab.PipelineTestReport) TestReport

NewTestReport ..

type TestSuite

type TestSuite struct {
	Name         string
	TotalTime    float64
	TotalCount   int
	SuccessCount int
	FailedCount  int
	SkippedCount int
	ErrorCount   int
}

TestSuite ..

func NewTestSuite

func NewTestSuite(gts *goGitlab.PipelineTestSuites) TestSuite

NewTestSuite ..

Jump to

Keyboard shortcuts

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