cmd

package
v0.16.9 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// custom project board keys that get extracted via graphql
	IssueURLKey       = ciSignalProjectBoardKey("Issue URL")
	PullRequestURLKey = ciSignalProjectBoardKey("PullRequest URL")
	// project board column headers
	TestgridBoardKey       = ciSignalProjectBoardKey("Testgrid Board")
	SlackDiscussionLinkKey = ciSignalProjectBoardKey("Slack discussion link")
	StatusKey              = ciSignalProjectBoardKey("Status")
	CiSignalMemberKey      = ciSignalProjectBoardKey("CI Signal Member")
	CreatedAtKey           = ciSignalProjectBoardKey("Created At")
	UpdatedAtKey           = ciSignalProjectBoardKey("Updated At")
)

Variables

View Source
var AllImplementedReporters = CIReporters{GithubReporter{}, TestgridReporter{}}

AllImplementedReporters list of implemented reports that are used to generate ci-reports

Functions

func Execute

func Execute() error

Execute executes the ci-reporter root command.

func GetTestgridReportData

func GetTestgridReportData(cfg Config) (testgrid.DashboardData, error)

GetTestgridReportData used to request the raw report data from testgrid

func PrintReporterData

func PrintReporterData(cfg *Config, reports *CIReportDataFields) error

PrintReporterData used to print report data

  1. Get a output stream to write the data to
  2. Write data to stream 2.1. Write data in JSON format if set so 2.2. Write data in table format

func RunReport

func RunReport(cfg *Config, reporters *CIReporters) error

RunReport used to execute

Types

type CIReportData

type CIReportData struct {
	Info    CIReporterInfo    `json:"info"`
	Records []*CIReportRecord `json:"records"`
}

CIReportData format of the ci report data that is being generated

type CIReportDataFields

type CIReportDataFields []CIReportData

CIReportDataFields used so specify multiple reports

func (*CIReportDataFields) Marshal

func (d *CIReportDataFields) Marshal() ([]byte, error)

Marshal used to marshal CIReports into bytes

type CIReportRecord

type CIReportRecord struct {
	Title            string `json:"title"`
	TestgridBoard    string `json:"testgrid_board"`
	URL              string `json:"url"`
	Status           string `json:"status"`
	StatusDetails    string `json:"status_details"`
	CreatedTimestamp string `json:"created_timestamp"`
	UpdatedTimestamp string `json:"updated_timestamp"`
}

CIReportRecord generic report data format

type CIReporter

type CIReporter interface {
	// GetCIReporterHead sets meta information which is used to differentiate reporters
	GetCIReporterHead() CIReporterInfo
	// CollectReportData is used to request / collect all report data
	CollectReportData(*Config) ([]*CIReportRecord, error)
}

CIReporter interface that is used to implement a new reporter

func SearchReporter

func SearchReporter(reporterName string) (CIReporter, error)

SearchReporter used to filter a implemented reporter by name

type CIReporterInfo

type CIReporterInfo struct {
	Name CIReporterName `json:"name"`
}

CIReporterInfo meta information about a reporter implementation

type CIReporterName

type CIReporterName string

CIReporterName identifying name of a reporter

var GithubReporterName CIReporterName = "github"

GithubReporterName used to identify github reporter

var TestgridReporterName CIReporterName = "testgrid"

TestgridReporterName used to identify github reporter

type CIReporters

type CIReporters []CIReporter

CIReporters used to specify multiple CIReports, type gets extended by helper functions to collect and visualize report data

func (*CIReporters) CollectReportDataFromReporters

func (r *CIReporters) CollectReportDataFromReporters(cfg *Config) (*CIReportDataFields, error)

CollectReportDataFromReporters used to collect data for multiple reporters

type Config

type Config struct {
	GithubClient   *githubv4.Client
	GithubToken    string
	ReleaseVersion string
	ShortReport    bool
	JSONOutput     bool
	Filepath       string
}

Config configuration that is getting injected into ci-signal report functions

type FilteredFieldName added in v0.14.0

type FilteredFieldName string

Types for project board filtering

type FilteredListVal added in v0.14.0

type FilteredListVal string

type GitHubProjectBoardFieldSettings added in v0.14.0

type GitHubProjectBoardFieldSettings struct {
	Width   int `json:"width"`
	Options []struct {
		ID       string `json:"id"`
		Name     string `json:"name"`
		NameHTML string `json:"name_html"`
	} `json:"options"`
}

GitHubProjectBoardFieldSettings settings for a column of a github beta project board --> | Testgrid Board | -> { ID: XXX, Name: Testgrid Board, ... } This information is required to match the settings ID to the name since table entries ref. id

type GithubReporter

type GithubReporter struct{}

GithubReporter github CIReporter implementation

func (GithubReporter) CollectReportData

func (r GithubReporter) CollectReportData(cfg *Config) ([]*CIReportRecord, error)

CollectReportData implementation from CIReporter

func (GithubReporter) GetCIReporterHead

func (r GithubReporter) GetCIReporterHead() CIReporterInfo

GetCIReporterHead implementation from CIReporter

type TestgridReporter

type TestgridReporter struct{}

TestgridReporter github CIReporter implementation

func (TestgridReporter) CollectReportData

func (r TestgridReporter) CollectReportData(cfg *Config) ([]*CIReportRecord, error)

CollectReportData implementation from CIReporter

func (TestgridReporter) GetCIReporterHead

func (r TestgridReporter) GetCIReporterHead() CIReporterInfo

GetCIReporterHead implementation from CIReporter

type TransformedProjectBoardItem added in v0.14.0

type TransformedProjectBoardItem struct {
	ID     string
	Title  string
	Fields map[fieldName]fieldValue
}

func GetGithubReportData

func GetGithubReportData(cfg Config, denyListFieldFilter, allowListFieldFilter map[FilteredFieldName][]FilteredListVal) ([]*TransformedProjectBoardItem, error)

GetGithubReportData used to request the raw report data from github

Jump to

Keyboard shortcuts

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