moonraker

package
v0.0.0-...-1738bad Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PathGetInrepoconfig = "inrepoconfig"
	PathPing            = "ping"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	sync.Mutex // protects below
	// contains filtered or unexported fields
}

func NewClient

func NewClient(host string, configAgent prowConfigAgentClient) (*Client, error)

func (*Client) GetInRepoConfig

func (c *Client) GetInRepoConfig(identifier, baseBranch string, baseSHAGetter config.RefGetter, headSHAGetters ...config.RefGetter) (*config.ProwYAML, error)

GetInRepoConfig just wraps around GetProwYAML(), converting the input parameters into a prowapi.Refs{} type.

Importantly, it also does defaulting of the retrieved jobs. Defaulting is required because the Presubmit and Postsubmit job types have private fields in them that would not be serialized into JSON when sent over from the server. So the defaulting has to be done client-side.

func (*Client) GetPostsubmits

func (c *Client) GetPostsubmits(identifier, baseBranch string, baseSHAGetter config.RefGetter, headSHAGetters ...config.RefGetter) ([]config.Postsubmit, error)

func (*Client) GetPresubmits

func (c *Client) GetPresubmits(identifier, baseBranch string, baseSHAGetter config.RefGetter, headSHAGetters ...config.RefGetter) ([]config.Presubmit, error)

func (*Client) GetProwYAML

func (c *Client) GetProwYAML(refs *prowapi.Refs) (*config.ProwYAML, error)

GetProwYAML returns the inrepoconfig contents for a repo, based on the Refs struct as the input. From the Refs, Moonraker can determine the org/repo, BaseSHA, and the Pulls[] (additional refs of each PR, if any) to grab the inrepoconfig contents.

func (*Client) Ping

func (c *Client) Ping() error

type Moonraker

type Moonraker struct {
	ConfigAgent       *config.Agent
	InRepoConfigCache *config.InRepoConfigCache
}

func (*Moonraker) RunConfigWatcher

func (mr *Moonraker) RunConfigWatcher(ctx context.Context) error

func (*Moonraker) ServeGetInrepoconfig

func (mr *Moonraker) ServeGetInrepoconfig(w http.ResponseWriter, r *http.Request)

serveGetInrepoconfig returns a ProwYAML object marshaled into JSON.

func (*Moonraker) ServePing

func (mr *Moonraker) ServePing(w http.ResponseWriter, r *http.Request)

ServePing responds with "pong". It's meant to be used by clients to check if the service is up.

type ProwYAMLGetter

type ProwYAMLGetter interface {
	GetProwYAML(payload *payload) (*config.ProwYAML, error)
}

Jump to

Keyboard shortcuts

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