123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274openSexplib.Stdtypeid=string[@@derivingsexp_of]typetag=[|`Heading(** Introduces a new build step *)|`Note(** Informational output from OBuilder *)|`Output(** Raw output from the build command *)]typelogger=tag->string->unitmoduletypeSTORE=sigtypetvalroot:t->string(** [root t] returns the root of the store. *)valdf:t->floatLwt.t(** [df t] returns the percentage of free space in the store. *)valbuild:t->?base:id->id:id->(string->(unit,'e)Lwt_result.t)->(unit,'e)Lwt_result.t(** [build t ~id fn] runs [fn tmpdir] to add a new item to the store under
key [id]. On success, [tmpdir] is saved as [id], which can be used
as the [base] for further builds, until it is expired from the cache.
On failure, nothing is recorded and calling [build] again will make
another attempt at building it.
The builder will not request concurrent builds for the same [id] (it
will handle that itself). It will also not ask for a build that already
exists (i.e. for which [result] returns a path).
@param base Initialise [tmpdir] as a clone of [base]. *)valdelete:t->id->unitLwt.t(** [delete t id] removes [id] from the store, if present. *)valresult:t->id->stringoptionLwt.t(** [result t id] is the path of the build result for [id], if present. *)vallog_file:t->id->stringLwt.t(** [log_file t id] is the path of the build logs for [id]. The file may
not exist if the build has never been run, or failed. *)valstate_dir:t->string(** [state_dir] is the path of a directory which can be used to store mutable
state related to this store (e.g. an sqlite3 database). *)valcache:user:Obuilder_spec.user->t->string->(string*(unit->unitLwt.t))Lwt.t(** [cache ~user t name] creates a writeable copy of the latest snapshot of the
cache [name]. It returns the path of this fresh copy and a function which
must be called to free it when done.
If the cache [name] does not exist, it is first created (as an empty directory,
and owned by [user]).
When the copy is released, it is snapshotted to become the new latest
version of the cache, unless the cache has already been updated since
it was snapshotted, in which case this writeable copy is simply discarded. *)valdelete_cache:t->string->(unit,[>`Busy])Lwt_result.t(** [delete_cache t name] removes the cache [name], if present.
If the cache is currently in use, the store may instead return [Error `Busy]. *)valcomplete_deletes:t->unitLwt.t(** [complete_deletes t] attempts to wait for previously executed deletes to finish,
so that the free space is accurate. *)endmoduletypeSANDBOX=sigtypetvalrun:cancelled:unitLwt.t->?stdin:Os.unix_fd->log:Build_log.t->t->Config.t->string->(unit,[`Cancelled|`Msgofstring])Lwt_result.t(** [run ~cancelled t config dir] runs the operation [config] in a sandbox with root
filesystem [dir].
@param cancelled Resolving this kills the process (and returns [`Cancelled]).
@param stdin Passed to child as its standard input.
@param log Used for child's stdout and stderr.
*)valfinished:unit->unitLwt.tendmoduletypeBUILDER=sigtypettypecontextvalbuild:t->context->Obuilder_spec.t->(id,[>`Cancelled|`Msgofstring])Lwt_result.tvalfinish:t->unitLwt.t(** [finish builder] close allocated resources and store state (e.g., sqlite3
databases). *)valdelete:?log:(id->unit)->t->id->unitLwt.t(** [delete ?log t id] removes [id] from the store, along with all of its dependencies.
This is for testing. Note that is not safe to perform builds while deleting:
the delete might fail because an item got a new child during the delete, or
we might delete something that the build is using.
@param log Called just before deleting each item, so it can be displayed. *)valprune:?log:(id->unit)->t->before:Unix.tm->int->intLwt.t(** [prune t ~before n] attempts to remove up to [n] items from the store,
all of which were last used before [before].
Returns the number of items removed.
@param log Called just before deleting each item, so it can be displayed. *)valcount:t->int64(** [count t] return number of items in the store. *)valdf:t->floatLwt.t(** [df t] returns the percentage of free space in the store. *)valcache_stats:t->int*int(** [cache_stats t] returns the number of cache hits and the number of cache misses. *)valhealthcheck:?timeout:float->t->(unit,[>`Msgofstring])Lwt_result.t(** [healthcheck t] performs a check that [t] is working correctly.
@param timeout Cancel and report failure after this many seconds.
This excludes the time to fetch the base image. *)endmoduletypeFETCHER=sigvalfetch:log:Build_log.t->rootfs:string->string->Config.envLwt.t(** [fetch ~log ~rootfs base] initialises the [rootfs] directory by
fetching and extracting the [base] image.
Returns the image's environment.
@param log Used for outputting the progress of the fetch
@param rootfs The directory in which to extract the base image *)end(** Wrappers for various Docker client commands. *)moduletypeDOCKER_CMD=sigtype'alog(** Log standard output and standard error of the sub-process. *)type'alogerr(** Log only standard error of the sub-process. *)valversion:(unit->(string,[>`Msgofstring])resultLwt.t)logerrvalpull:([<`Docker_imageofstring]->unitLwt.t)log(** Pulls a Docker image. *)valexport:([<`Docker_containerofstring]->unitLwt.t)log(** Exports a Docker container. *)valimage:([<`Removeof[<`Docker_imageofstring]]->unitLwt.t)log(** Operates on a Docker image. *)valrm:([`Docker_containerofstring]list->unitLwt.t)log(** Removes a Docker container. *)valrmi:([`Docker_imageofstring]list->unitLwt.t)log(** Removes a list of Docker images. *)valtag:([<`Docker_imageofstring]->[<`Docker_imageofstring]->unitLwt.t)log(** [tag source_image target_image] creates a new tag for a Docker iamge. *)valcommit:([<`Docker_imageofstring]->[<`Docker_containerofstring]->[<`Docker_imageofstring]->unitLwt.t)log(** [commit base_image container target_image] commits the
[container] to the [target_image] using [base_image] (typically
the container's base image) entrypoint and cmd. *)valvolume:(?timeout:float->[<`Createof[<`Docker_volumeofstring]|`Inspectof[<`Docker_volumeofstring]list*[<`Mountpoint]|`Listofstringoption|`Removeof[<`Docker_volumeofstring]list]->stringLwt.t)logerr(** Operates on Docker volumes. *)valvolume_containers:([<`Docker_volumeofstring]->[>`Docker_containerofstring]listLwt.t)logerr(** [volume_containers vol] returns the list of containers using [vol]. *)valmount_point:([<`Docker_volumeofstring]->stringLwt.t)logerr(** [mount_point vol] returns the mount point in the host filesystem of [vol]. *)valbuild:(stringlist->[<`Docker_imageofstring]->string->unitLwt.t)log(** [build docker_args image context_path] builds the Docker [image]
using the context located in [context_path]. *)valrun:?stdin:[`Dev_null|`FD_move_safelyofOs.unix_fd]->(?is_success:(int->bool)->?name:[<`Docker_containerofstring]->?rm:bool->stringlist->[<`Docker_imageofstring]->stringlist->unitLwt.t)log(** [run ?stdin ?stdout ?stderr ?is_success ?name ?rm docker_argv image argv] *)valrun':?stdin:[`Dev_null|`FD_move_safelyofOs.unix_fd]->?stdout:[`Dev_null|`FD_move_safelyofOs.unix_fd]->(?is_success:(int->bool)->?name:[<`Docker_containerofstring]->?rm:bool->stringlist->[<`Docker_imageofstring]->stringlist->unitLwt.t)logerr(** [run' ?stdin ?stdout ?stderr ?is_success ?name ?rm docker_argv image argv] *)valrun_result:?stdin:[`Dev_null|`FD_move_safelyofOs.unix_fd]->(?name:[<`Docker_containerofstring]->?rm:bool->stringlist->[<`Docker_imageofstring]->stringlist->(unit,[>`Msgofstring])resultLwt.t)log(** [run_result ?stdin ?stdout ?stderr ?is_success ?name ?rm docker_argv image argv] *)valrun_result':?stdin:[`Dev_null|`FD_move_safelyofOs.unix_fd]->?stdout:[`Dev_null|`FD_move_safelyofOs.unix_fd]->(?name:[<`Docker_containerofstring]->?rm:bool->stringlist->[<`Docker_imageofstring]->stringlist->(unit,[>`Msgofstring])resultLwt.t)logerr(** [run_result ?stdin ?stdout ?stderr ?is_success ?name ?rm docker_argv image argv] *)valrun_pread_result:?stdin:[`Dev_null|`FD_move_safelyofOs.unix_fd]->(?name:[<`Docker_containerofstring]->?rm:bool->stringlist->[<`Docker_imageofstring]->stringlist->(string,[>`Msgofstring])resultLwt.t)logerr(** [run_pread_result ?stdin ?stdout ?stderr ?is_success ?name ?rm docker_argv image argv] *)valstop:([<`Docker_containerofstring]->(unit,[>`Msgofstring])resultLwt.t)log(** Stop a Docker container. *)valmanifest:([<`Createof[<`Docker_imageofstring]*[<`Docker_imageofstring]list|`Inspectof[<`Docker_imageofstring]|`Removeof[<`Docker_imageofstring]list]->(unit,[>`Msgofstring])resultLwt.t)log(** Operates on a Docker manifest. *)valexists:([<`Docker_containerofstring|`Docker_imageofstring|`Docker_volumeofstring]->(unit,[>`Msgofstring])resultLwt.t)log(** Tests if an object exists. *)valobuilder_images:(?tmp:bool->unit->[`Docker_imageofstring]listLwt.t)logerr(** Returns the list of this OBuilder instance images. *)valobuilder_containers:(unit->[`Docker_containerofstring]listLwt.t)logerr(** Returns the list of this OBuilder instance containers. *)valobuilder_volumes:(?prefix:string->unit->[`Docker_volumeofstring]listLwt.t)logerr(** Returns the list of this OBuilder instance volumes. *)valobuilder_caches_tmp:(unit->[`Docker_volumeofstring]listLwt.t)logerr(** Returns the list of this OBuilder instance temporary caches. *)end