docker

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package docker provides the interface for running language-specific Docker containers which conform to the Librarian container contract. TODO(https://github.com/googleapis/librarian/issues/330): link to the documentation when it's written.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildRequest added in v0.1.1

type BuildRequest struct {
	// cfg is a pointer to the [config.Config] struct, holding general configuration
	// values parsed from flags or environment variables.
	Cfg *config.Config
	// state is a pointer to the [config.LibrarianState] struct, representing
	// the overall state of the generation and release pipeline.
	State *config.LibrarianState
	// libraryID specifies the ID of the library to build
	LibraryID string
	// RepoDir is the local root directory of the language repository.
	RepoDir string
}

BuildRequest contains all the information required for a language container to run the build command.

type Command

type Command string

Command is the string representation of a command to be passed to the language-specific container's entry point as the first argument.

const (
	// CommandGenerate performs generation for a configured library.
	CommandGenerate Command = "generate"
	// CommandBuild builds a library.
	CommandBuild Command = "build"
	// CommandConfigure configures a new API as a library.
	CommandConfigure Command = "configure"
)

The set of commands passed to the language container, in a single place to avoid typos.

type ConfigureRequest added in v0.1.1

type ConfigureRequest struct {
	// cfg is a pointer to the [config.Config] struct, holding general configuration
	// values parsed from flags or environment variables.
	Cfg *config.Config
	// state is a pointer to the [config.LibrarianState] struct, representing
	// the overall state of the generation and release pipeline.
	State *config.LibrarianState
	// apiRoot specifies the root directory of the API specification repo.
	ApiRoot string
	// libraryID specifies the ID of the library to generate
	LibraryID string
	// RepoDir is the local root directory of the language repository.
	RepoDir string
}

ConfigureRequest contains all the information required for a language container to run the configure command.

type Docker

type Docker struct {
	// The Docker image to run.
	Image string
	// contains filtered or unexported fields
}

Docker contains all the information required to run language-specific Docker containers.

func New

func New(workRoot, image, uid, gid string) (*Docker, error)

New constructs a Docker instance which will invoke the specified Docker image as required to implement language-specific commands, providing the container with required environment variables.

func (*Docker) Build added in v0.1.1

func (c *Docker) Build(ctx context.Context, request *BuildRequest) error

Build builds the library with an ID of libraryID, as configured in the Librarian state file for the repository with a root of repoRoot.

func (*Docker) Configure

func (c *Docker) Configure(ctx context.Context, request *ConfigureRequest) (string, error)

Configure configures an API within a repository, either adding it to an existing library or creating a new library.

Returns the configured library id if the command succeeds.

func (*Docker) Generate added in v0.1.1

func (c *Docker) Generate(ctx context.Context, request *GenerateRequest) error

Generate performs generation for an API which is configured as part of a library.

type GenerateRequest added in v0.1.1

type GenerateRequest struct {
	// cfg is a pointer to the [config.Config] struct, holding general configuration
	// values parsed from flags or environment variables.
	Cfg *config.Config
	// state is a pointer to the [config.LibrarianState] struct, representing
	// the overall state of the generation and release pipeline.
	State *config.LibrarianState
	// apiRoot specifies the root directory of the API specification repo.
	ApiRoot string
	// libraryID specifies the ID of the library to generate
	LibraryID string
	// output specifies the empty output directory into which the command should
	// generate code
	Output string
	// RepoDir is the local root directory of the language repository.
	RepoDir string
}

GenerateRequest contains all the information required for a language container to run the generate command.

Jump to

Keyboard shortcuts

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