memory-bank/components/image-builder-api.md
The Image Builder API defines the gRPC interfaces for the Image Builder service, which is responsible for building Docker images for workspaces within the Gitpod platform. This API enables the dynamic creation, management, and monitoring of workspace image builds.
This API provides a standardized interface for:
The Image Builder API is implemented as a set of gRPC services defined in Protocol Buffer files. These definitions are used to generate client and server code in various languages (Go, TypeScript) for use by other components in the system.
Provides methods for building and managing Docker images:
ResolveBaseImage: Returns the "digest" form of a Docker image tag, making it absoluteResolveWorkspaceImage: Returns information about a build configuration without actually buildingBuild: Initiates the build of a Docker image using a build configurationLogs: Streams the build output of an ongoing Docker buildListBuilds: Returns a list of currently running buildsProvides methods for managing subassemblies (pre-built components that can be used in workspace images):
CreateSubassembly: Creates a subassembly from an OCI imageGetSubassembly: Returns the status and URL for a subassemblyDefines the source for a build, which can be either:
Defines authentication settings for accessing Docker registries during the build process.
Enum representing the status of a build:
unknown: Status is not knownrunning: Build is currently in progressdone_success: Build completed successfullydone_failure: Build failedContains detailed information about a build:
Contains information about a subassembly:
Build and Logs methods use server-side streaming to provide real-time updatesThe API uses Protocol Buffers version 3 (proto3) syntax, which provides forward and backward compatibility features. The service is designed to allow for the addition of new build options and features without breaking existing clients.
The Image Builder API uses Protocol Buffers and gRPC for defining interfaces. When changes are made to the .proto files, the corresponding code in various languages needs to be regenerated.
To regenerate the code:
Navigate to the image-builder-api directory:
cd components/image-builder-api
Run the generate script:
./generate.sh
This script performs the following actions:
protoc-gen-go and protoc-gen-go-grpcAdditionally, the script:
mockgen for testingAfter regenerating the code, you may need to rebuild components that depend on the Image Builder API. This typically involves:
For Go components:
cd <component-directory>
go build ./...
For TypeScript components:
cd <component-directory>
yarn install
yarn build
Using Leeway (for CI/CD):
leeway build -D components/<component-name>:app