client

package
v0.0.0-...-d7867ec Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package client implements a client that can handle multiple gerrit instances derived from https://github.com/andygrunwald/go-gerrit

Index

Constants

View Source
const (
	// LGTM means all presubmits passed, but need someone else to approve before merge.
	LGTM = "+1"
	// LBTM means some presubmits failed, perfer not merge.
	LBTM = "-1"
	// CodeReview is the default gerrit code review label
	CodeReview = "Code-Review"

	// GerritID identifies a gerrit change
	GerritID = "prow.k8s.io/gerrit-id"
	// GerritInstance is the gerrit host url
	GerritInstance = "prow.k8s.io/gerrit-instance"
	// GerritRevision is the SHA of current patchset from a gerrit change
	GerritRevision = "prow.k8s.io/gerrit-revision"
	// GerritReportLabel is the gerrit label prow will cast vote on, fallback to CodeReview label if unset
	GerritReportLabel = "prow.k8s.io/gerrit-report-label"

	// Merged status indicates a Gerrit change has been merged
	Merged = "MERGED"
	// New status indicates a Gerrit change is new (ie pending)
	New = "NEW"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeInfo

type ChangeInfo = gerrit.ChangeInfo

ChangeInfo is a gerrit.ChangeInfo

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client holds a instance:handler map

func NewClient

func NewClient(instances map[string][]string) (*Client, error)

NewClient returns a new gerrit client

func (*Client) GetBranchRevision

func (c *Client) GetBranchRevision(instance, project, branch string) (string, error)

GetBranchRevision returns SHA of HEAD of a branch

func (*Client) QueryChanges

func (c *Client) QueryChanges(lastUpdate time.Time, rateLimit int) map[string][]ChangeInfo

QueryChanges queries for all changes from all projects after lastUpdate time returns an instance:changes map

func (*Client) SetReview

func (c *Client) SetReview(instance, id, revision, message string, labels map[string]string) error

SetReview writes a review comment base on the change id + revision

func (*Client) Start

func (c *Client) Start(cookiefilePath string)

Start will authenticate the client with gerrit periodically Start must be called before user calls any client functions.

type FileInfo

type FileInfo = gerrit.FileInfo

FileInfo is a gerrit.FileInfo

type ProjectsFlag

type ProjectsFlag map[string][]string

ProjectsFlag is the flag type for gerrit projects when initializing a gerrit client

func (ProjectsFlag) Set

func (p ProjectsFlag) Set(value string) error

Set populates ProjectsFlag upon flag.Parse()

func (ProjectsFlag) String

func (p ProjectsFlag) String() string

type RevisionInfo

type RevisionInfo = gerrit.RevisionInfo

RevisionInfo is a gerrit.RevisionInfo

Jump to

Keyboard shortcuts

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