- class binderhub.build.Build(q, api, name, *, namespace, repo_url, ref, build_image, docker_host, image_name, git_credentials=None, push_secret=None, memory_limit=0, memory_request=0, node_selector=None, appendix='', log_tail_lines=100, sticky_builds=False)¶
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.
nameshould be unique and immutable since it is used to sync to the pod. The
nameshould be unique for a
(repo_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.
Delete the kubernetes build pod
- classmethod cleanup_builds(kube, namespace, max_age)¶
Delete stopped build pods and build pods that have aged out
Determine the affinity term for the build pod.
There are a two affinity strategies, which one is used depends on how the BinderHub is configured.
In the default setup the affinity of each build pod is an “anti-affinity” which causes the pods to prefer to schedule on separate nodes.
In a setup with docker-in-docker enabled pods for a particular repository prefer to schedule on the same node in order to reuse the docker layer cache of previous builds.
Get the cmd to run to build the image
Get options/flags for repo2docker
- progress(kind: binderhub.build.ProgressEvent.Kind, payload: str)¶
Put current progress info into the queue on the main thread
Stop wathcing for progress of build.
Stream build logs to the queue in self.q
Submit a build pod to create the image for the repository.
Progress of the build can be monitored by listening for items in the Queue passed to the constructor as