9. Configuration and Source Code Reference

9.2. build

expand icon

9.2. build

9.2.1. Module: binderhub.build

Contains build of a docker image from a git repository.

9.2.2. Build

class binderhub.build.Build(q, api, name, namespace, git_url, ref, builder_image, image_name, push_secret)

Represents a build of a git repository into a docker image.

This ultimately maps to a single pod on a kubernetes cluster. Many different build objects can point to this single pod and perform operations on the pod. The code in this class needs to be careful and take this into account.

For example, operations a Build object tries might not succeed because another Build object pointing to the same pod might have done something else. This should be handled gracefully, and the build object should reflect the state of the pod as quickly as possible.

name
The name should be unique and immutable since it is used to sync to the pod. The name should be unique for a (git_url, ref) tuple, and the same tuple should correspond to the same name. This allows use of the locking provided by k8s API instead of having to invent our own locking code.
cleanup()

Delete a kubernetes pod.

get_cmd()

Get the cmd to run to build the image

progress(kind, obj)

Put the current action item into the queue for execution.

stream_logs()

Stream a pod’s log.

submit()

Submit a image spec to openshift’s s2i and wait for completion