client

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildInfo added in v0.0.2

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

BuildInfo contains the details of an individual build.

func (*BuildInfo) ID added in v0.0.2

func (bi *BuildInfo) ID() string

func (*BuildInfo) ImageChecksum added in v0.0.2

func (bi *BuildInfo) ImageChecksum() string

func (*BuildInfo) ImageSize added in v0.0.2

func (bi *BuildInfo) ImageSize() int64

func (*BuildInfo) IsComplete added in v0.0.2

func (bi *BuildInfo) IsComplete() bool

func (*BuildInfo) LibraryRef added in v0.0.2

func (bi *BuildInfo) LibraryRef() string

func (*BuildInfo) LibraryURL added in v0.0.2

func (bi *BuildInfo) LibraryURL() string

type BuildOption added in v0.5.0

type BuildOption func(*buildOptions) error

func OptBuildArchitecture added in v0.5.0

func OptBuildArchitecture(arch string) BuildOption

OptBuildArchitecture sets the build architecture to arch.

func OptBuildContext added in v0.6.0

func OptBuildContext(digest string) BuildOption

OptBuildContext instructs the Build Service to expose the build context with the specified digest during the build. The build context must be uploaded using UploadBuildContext.

func OptBuildLibraryPullBaseURL added in v0.5.0

func OptBuildLibraryPullBaseURL(libraryURL string) BuildOption

OptBuildLibraryPullBaseURL sets the base URL to pull images from when a build involves pulling one or more image(s) from a Library source.

func OptBuildLibraryRef added in v0.5.0

func OptBuildLibraryRef(imageRef string) BuildOption

OptBuildLibraryRef sets the Library image ref to push to.

func OptBuildWorkingDirectory added in v0.6.0

func OptBuildWorkingDirectory(dir string) BuildOption

OptBuildWorkingDirectory sets dir as the current working directory to include in the request.

type Client

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

Client describes the client details.

func NewClient

func NewClient(opts ...Option) (*Client, error)

NewClient returns a Client configured according to opts.

By default, the Sylabs Build Service is used. To override this behaviour, use OptBaseURL.

By default, requests are not authenticated. To override this behaviour, use OptBearerToken.

func (*Client) Cancel added in v0.1.0

func (c *Client) Cancel(ctx context.Context, buildID string) error

Cancel cancels an existing build. The context controls the lifetime of the request.

func (*Client) DeleteBuildContext added in v0.6.0

func (c *Client) DeleteBuildContext(ctx context.Context, digest string, opts ...DeleteBuildContextOption) error

DeleteBuildContext deletes the build context with the specified digest from the Build Service.

func (*Client) GetOutput added in v0.0.2

func (c *Client) GetOutput(ctx context.Context, buildID string, w io.Writer) error

GetOutput streams build output for the provided buildID to w. The context controls the lifetime of the request.

func (*Client) GetStatus added in v0.0.2

func (c *Client) GetStatus(ctx context.Context, buildID string) (*BuildInfo, error)

GetStatus gets the status of a build from the Build Service by build ID. The context controls the lifetime of the request.

func (*Client) GetVersion

func (c *Client) GetVersion(ctx context.Context) (string, error)

GetVersion gets version information from the build service. The context controls the lifetime of the request.

func (*Client) Submit added in v0.0.2

func (c *Client) Submit(ctx context.Context, definition io.Reader, opts ...BuildOption) (*BuildInfo, error)

Submit sends a build job to the Build Service. The context controls the lifetime of the request.

By default, the built image will be pushed to an ephemeral location in the Library associated with the Remote Builder. To publish to a non-ephemeral location, consider using OptBuildLibraryRef.

By default, the image will be built for the architecture returned by runtime.GOARCH. To override this behaviour, consider using OptBuildArchitecture.

By default, if definition involves pulling one or more images from a Library reference that does not contain a hostname, they will be pulled from the Library associated with the Remote Builder. To override this behaviour, consider using OptBuildLibraryPullBaseURL.

By default, local files referenced in the supplied definition will not be available on the Build Service. To expose local files, consider using OptBuildContext.

The client includes the current working directory in the request, since the supplied definition may include paths that are relative to it. By default, the client attempts to derive the current working directory using os.Getwd(), falling back to "/" on error. To override this behaviour, consider using OptBuildWorkingDirectory.

func (*Client) UploadBuildContext added in v0.6.0

func (c *Client) UploadBuildContext(ctx context.Context, paths []string, opts ...UploadBuildContextOption) (digest string, err error)

UploadBuildContext generates an archive containing the files at the specified paths, and uploads it to the Build Service. When the build context is no longer required, DeleteBuildContext should be called to notify the Build Service.

Paths must be specified in the rootless format specified by the io/fs package. If a path contains a glob, it will be evaluated as per fs.Glob. If a path specifies a directory, its contents will be walked as per fs.WalkDir.

type DeleteBuildContextOption added in v0.6.0

type DeleteBuildContextOption func(*deleteBuildContextOptions) error

type Option added in v0.5.0

type Option func(co *clientOptions) error

Option are used to populate co.

func OptBaseURL added in v0.5.0

func OptBaseURL(url string) Option

OptBaseURL sets the base URL of the build server to url.

func OptBearerToken added in v0.5.0

func OptBearerToken(token string) Option

OptBearerToken sets the bearer token to include in the "Authorization" header of each request.

func OptHTTPTransport added in v0.9.0

func OptHTTPTransport(tr http.RoundTripper) Option

OptHTTPTransport sets the transport for HTTP requests to use.

func OptUserAgent added in v0.5.0

func OptUserAgent(agent string) Option

OptUserAgent sets the HTTP user agent to include in the "User-Agent" header of each request.

type UploadBuildContextOption added in v0.6.0

type UploadBuildContextOption func(*uploadBuildContextOptions) error

Jump to

Keyboard shortcuts

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