ci

package
v0.0.0-...-be47510 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Overview

Package ci defines the internal representation of a continuous integration reports.

Index

Constants

View Source
const (
	// Ref defines the git-notes ref that we expect to contain CI reports.
	Ref = "refs/notes/devtools/ci"

	// StatusSuccess is the status string representing that a build and/or test passed.
	StatusSuccess = "success"
	// StatusFailure is the status string representing that a build and/or test failed.
	StatusFailure = "failure"

	// FormatVersion defines the latest version of the request format supported by the tool.
	FormatVersion = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Report

type Report struct {
	Timestamp string `json:"timestamp,omitempty"`
	URL       string `json:"url,omitempty"`
	Status    string `json:"status,omitempty"`
	Agent     string `json:"agent,omitempty"`
	// Version represents the version of the metadata format.
	Version int `json:"v,omitempty"`
}

Report represents a build/test status report generated by a continuous integration tool.

Every field is optional.

func GetLatestCIReport

func GetLatestCIReport(reports []Report) (*Report, error)

GetLatestCIReport takes the collection of reports and returns the one with the most recent timestamp.

func Parse

func Parse(note repository.Note) (Report, error)

Parse parses a CI report from a git note.

func ParseAllValid

func ParseAllValid(notes []repository.Note) []Report

ParseAllValid takes collection of git notes and tries to parse a CI report from each one. Any notes that are not valid CI reports get ignored, as we expect the git notes to be a heterogenous list, with only some of them being valid CI status reports.

Jump to

Keyboard shortcuts

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