Documentation ¶
Index ¶
- Constants
- func GetProwLabels(bld *cloudbuildpb.Build) map[string]string
- func KvPairFromProwLabel(tag string) (key, val string)
- func ProwLabel(key, val string) string
- type Client
- func (c *Client) CancelBuild(ctx context.Context, project, id string) (*cloudbuildpb.Build, error)
- func (c *Client) CreateBuild(ctx context.Context, project string, bld *cloudbuildpb.Build) (*cloudbuildpb.Build, error)
- func (c *Client) GetBuild(ctx context.Context, project, id string) (*cloudbuildpb.Build, error)
- func (c *Client) ListBuildsByTag(ctx context.Context, project string, tags []string) ([]*cloudbuildpb.Build, error)
- type Operator
Constants ¶
const ( // ProwLabelSeparator formats labels key:val pairs into `{key} ::: {val}` // The separator was arbitrarily selected. ProwLabelSeparator = " ::: " )
Variables ¶
This section is empty.
Functions ¶
func GetProwLabels ¶
func GetProwLabels(bld *cloudbuildpb.Build) map[string]string
GetProwLabels gets labels from cloud build struct, simulating k8s pods labels format of map[string]string.
func KvPairFromProwLabel ¶
KvPairFromProwLabel trims label into key:val pairs. returns empty string as value if the label is not formatted as prow label format.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps native cloudbuild client.
func (*Client) CancelBuild ¶
CancelBuild cancels build and wait for it.
func (*Client) CreateBuild ¶
func (c *Client) CreateBuild(ctx context.Context, project string, bld *cloudbuildpb.Build) (*cloudbuildpb.Build, error)
CreateBuild creates build and wait for the operation to complete.
func (*Client) ListBuildsByTag ¶
func (c *Client) ListBuildsByTag(ctx context.Context, project string, tags []string) ([]*cloudbuildpb.Build, error)
ListBuildsByTag lists builds by GCB tags.
This will be used by prow for listing builds triggered by prow, for example `created-by-prow ::: true`.
type Operator ¶
type Operator interface { GetBuild(ctx context.Context, project, id string) (*cloudbuildpb.Build, error) ListBuildsByTag(ctx context.Context, project string, tags []string) ([]*cloudbuildpb.Build, error) CreateBuild(ctx context.Context, project string, bld *cloudbuildpb.Build) (*cloudbuildpb.Build, error) CancelBuild(ctx context.Context, project, id string) (*cloudbuildpb.Build, error) }
Operator is the interface that's highly recommended to be used by any package that imports current package. Unit test can be carried out with a mock implemented under fake of current package.