docker

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 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

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 (
	// 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

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 configure.
	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

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

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

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

ReleaseInit initiates a release for a given language repository.

type GenerateRequest

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.

type ReleaseInitRequest

type ReleaseInitRequest struct {
	// Cfg is a pointer to the [config.Config] struct, holding general configuration
	// values parsed from flags or environment variables.
	Cfg *config.Config
	// LibrarianConfig is a pointer to the [config.LibrarianConfig] struct, holding
	// global files configuration in a language repository.
	LibrarianConfig *config.LibrarianConfig
	// 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 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
}

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