common

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package common shares methods for local builder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backoff

func Backoff(baseDelay, maxDelay time.Duration, retries int) time.Duration

Backoff returns a value in [0, maxDelay] that increases exponentially with retries, starting from baseDelay.

func Clean added in v0.1.1

func Clean(ctx context.Context, r runner.Runner) error

Clean removes left-over containers, networks, and volumes from a previous run of the local builder. This happens when ctrl+c is used during a local build. Each cleaning is defined by a get command, a warning to print if the get command returns something, and a delete command to apply in that case.

func ParseSubstitutionsFlag

func ParseSubstitutionsFlag(substitutions string) (map[string]string, error)

ParseSubstitutionsFlag parses a substitutions string into a map.

func RefreshDuration added in v0.2.2

func RefreshDuration(expiration time.Time) time.Duration

RefreshDuration calculates when to refresh the access token. We refresh a bit prior to the token's expiration.

func SubstituteAndValidate added in v0.3.2

func SubstituteAndValidate(b *pb.Build, substMap map[string]string) error

SubstituteAndValidate merges the substitutions from the build config and the local flag, validates them and the build.

Types

type TokenTransport added in v0.4.0

type TokenTransport struct {
	Ts oauth2.TokenSource
}

TokenTransport is a RoundTripper that automatically applies OAuth credentials from the token source.

func (*TokenTransport) RoundTrip added in v0.4.0

func (t *TokenTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip executes a single HTTP transaction, obtaining the Response for a given Request.

Jump to

Keyboard shortcuts

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