docker

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 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 {
	// HostMount specifies a mount point from the Docker host into the Docker
	// container. The format is "{host-dir}:{local-dir}".
	HostMount string

	// LibraryID specifies the ID of the library to build.
	LibraryID string

	// RepoDir is the local root directory of the language repository.
	RepoDir string

	// State is a pointer to the [config.LibrarianState] struct, representing
	// the overall state of the generation and release pipeline.
	State *config.LibrarianState
}

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 (
	// CommandBuild builds a library.
	CommandBuild Command = "build"
	// CommandConfigure configures a new API as a library.
	CommandConfigure Command = "configure"
	// CommandGenerate performs generation for a configured library.
	CommandGenerate Command = "generate"
	// CommandReleaseInit performs release for a library.
	CommandReleaseInit Command = "release-init"
)

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 {
	// ApiRoot specifies the root directory of the API specification repo.
	ApiRoot string

	// HostMount specifies a mount point from the Docker host into the Docker
	// container. The format is "{host-dir}:{local-dir}".
	HostMount string

	// libraryID specifies the ID of the library to configure.
	LibraryID string

	// RepoDir is the local root directory of the language repository.
	RepoDir string

	// State is a pointer to the [config.LibrarianState] struct, representing
	// the overall state of the generation and release pipeline.
	State *config.LibrarianState
}

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.

func (*Docker) ReleaseInit added in v0.2.0

func (c *Docker) ReleaseInit(ctx context.Context, request *ReleaseInitRequest) error

ReleaseInit initiates a release for a given language repository.

type GenerateRequest added in v0.1.1

type GenerateRequest struct {
	// ApiRoot specifies the root directory of the API specification repo.
	ApiRoot string

	// HostMount specifies a mount point from the Docker host into the Docker
	// container. The format is "{host-dir}:{local-dir}".
	HostMount 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

	// State is a pointer to the [config.LibrarianState] struct, representing
	// the overall state of the generation and release pipeline.
	State *config.LibrarianState
}

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

type ReleaseInitRequest added in v0.2.0

type ReleaseInitRequest struct {
	// Branch is the remote branch of the language repository to use.
	Branch string

	// Commit determines whether to create a commit for the release but not
	// create a pull request. This flag is ignored if Push is set to true.
	Commit bool

	// HostMount is used to remap Docker mount paths when running in environments
	// where Docker containers are siblings (e.g., Kokoro).
	// It specifies a mount point from the Docker host into the Docker container.
	// The format is "{host-dir}:{local-dir}".
	HostMount string

	// LibrarianConfig is a pointer to the [config.LibrarianConfig] struct, holding
	// global files configuration in a language repository.
	LibrarianConfig *config.LibrarianConfig

	// LibraryID specifies the ID of the library to release.
	LibraryID string

	// LibraryVersion specifies the version of the library to release.
	LibraryVersion string

	// Output specifies the empty output directory into which the command should
	// generate code.
	Output string

	// PartialRepoDir is the local root directory of language repository contains
	// files that make up libraries and global files.
	// This is the directory that container can access.
	PartialRepoDir string

	// Push determines whether to push changes to GitHub.
	Push bool

	// State is a pointer to the [config.LibrarianState] struct, representing
	// the overall state of the generation and release pipeline.
	State *config.LibrarianState
}

ReleaseInitRequest contains all the information required for a language container to run the init command.

Jump to

Keyboard shortcuts

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