cuirass.texi 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260
  1. \input texinfo
  2. @setfilename cuirass.info
  3. @documentencoding UTF-8
  4. @include version.texi
  5. @settitle Cuirass Reference Manual
  6. @setchapternewpage odd
  7. This manual is for Cuirass version @value{VERSION}, a build automation
  8. server.
  9. @copying
  10. Copyright @copyright{} 2016, 2017 Mathieu Lirzin@*
  11. Copyright @copyright{} 2017, 2020, 2021 Mathieu Othacehe@*
  12. Copyright @copyright{} 2018 Ludovic Courtès@*
  13. Copyright @copyright{} 2018 Clément Lassieur
  14. @quotation
  15. Permission is granted to copy, distribute and/or modify this document
  16. under the terms of the GNU Free Documentation License, Version 1.3 or
  17. any later version published by the Free Software Foundation; with no
  18. Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
  19. copy of the license is included in the section entitled ``GNU Free
  20. Documentation License''.
  21. @end quotation
  22. @end copying
  23. @dircategory Software development
  24. @direntry
  25. * Cuirass: (cuirass). Build automation server.
  26. @end direntry
  27. @titlepage
  28. @title Cuirass Reference Manual
  29. @subtitle Build automation server
  30. @subtitle for version @value{VERSION}, @value{UPDATED}
  31. @author The Cuirass Developers
  32. @page
  33. @vskip 0pt plus 1filll
  34. @insertcopying
  35. @end titlepage
  36. @contents
  37. @ifnottex
  38. @node Top
  39. @top Cuirass
  40. @insertcopying
  41. @end ifnottex
  42. @c *********************************************************************
  43. @menu
  44. * Introduction:: What is Cuirass about?
  45. * Specifications:: Writing Cuirass specifications.
  46. * Notifications:: Build notifications.
  47. * Parameters:: Cuirass parameters.
  48. * Build modes:: Build modes.
  49. * Invocation:: How to run Cuirass.
  50. * Web API:: Description of the Web API.
  51. * Database:: About the database schema.
  52. * Contributing:: Your help needed!
  53. * GNU Free Documentation License:: The license of this manual.
  54. * Concept Index:: Concepts.
  55. @end menu
  56. @c *********************************************************************
  57. @node Introduction
  58. @unnumbered Introduction
  59. @cindex introduction
  60. @dfn{Cuirass} is a general-purpose build automation server that checks
  61. out source files from @acronym{VCS, Version Control System}
  62. repositories, executes build jobs, and stores build results in a
  63. database. It provides a web interface to monitor the build results,
  64. as well as an HTTP API. Cuirass is also able to send build
  65. notifications using different mechanisms such as RSS and email.
  66. Cuirass is inspired by the @url{https://nixos.org/hydra/, Hydra}
  67. continuous build system. Unlike Hydra, it is built on top of the
  68. @url{https://www.gnu.org/software/guix/, GNU Guix} functional package
  69. manager.
  70. The goal of Cuirass is to prevent software regressions by building a
  71. set of package definitions, system images and running periodical tests
  72. for various architectures. Cuirass is also responsible for GNU Guix
  73. binary substitutes production (@pxref{Substitutes, Substitutes,, guix,
  74. Guix}).
  75. Cuirass is deployed on the GNU Guix build farm at
  76. @url{https://ci.guix.gnu.org}. It is also common for Guix users to
  77. run their own Cuirass instance to build different sources, using
  78. different priorities (@pxref{Continuous Integration, Continuous
  79. Integration,, guix, Guix}).
  80. @c *********************************************************************
  81. @node Specifications
  82. @chapter Specifications
  83. @cindex cuirass specifications
  84. The main Cuirass argument is the @var{specification} file. It
  85. describes the repositories that must be used, the build jobs and their
  86. priorities between other things.
  87. @deftp {Data Type} specification
  88. @table @asis
  89. @item @code{name}
  90. The specification name as a Scheme symbol.
  91. @item @code{build} (default: @code{all})
  92. The packages to be built by Cuirass. It defaults to @code{all}, which
  93. means that all the discovered packages in the subsequent @code{channels}
  94. field are to be selected.
  95. It is also possible to set this field to:
  96. @itemize
  97. @item @code{core}
  98. Build only the core packages such as @code{gcc}, @code{guile} and
  99. @code{glibc}.
  100. @item @code{guix}
  101. Build only the Guix modules that are involved in the @command{guix
  102. pull} command.
  103. @item @code{hello}
  104. Build only the hello package.
  105. @item @code{(channels . list)}
  106. Build only the packages that are part of the given channel
  107. @code{list}. For instance, @code{(channels my-channel)} will only
  108. build the packages that are part of @code{my-channel} channel.
  109. @item @code{(packages . list)}
  110. Build only the specified packages in @code{list}. For instance,
  111. @code{(packages "strace" "perf")} will only build the packages
  112. @code{strace} and @code{perf}.
  113. @item @code{(manifests . list)}
  114. Build only the packages that are part of the manifests @code{list}.
  115. For instance, @code{(manifests "etc/manifest")} will only build the
  116. packages that are part of the @code{etc/manifest} file. This file
  117. must be provided by exactly one of the channels defined below.
  118. @end itemize
  119. @item @code{channels} (default: @code{(list %default-guix-channel)})
  120. The channels to be fetched by Cuirass (@pxref{Channels, Channels,,
  121. guix, Guix}).
  122. @item @code{build-outputs} (default: @code{()})
  123. The build artifacts that must be saved and proposed to download in the
  124. web interface as a list of @code{build-outputs} records.
  125. @deftp {Data Type} build-outputs
  126. @table @asis
  127. @item @code{job}
  128. Save the build outputs of the build jobs which names match the
  129. @code{job} regexp.
  130. @item @code{type}
  131. The build output type as a string. It is only used to describe the
  132. build output in the web interface.
  133. @item @code{output} (default: @code{("out")})
  134. The job output if it has multiple outputs (@pxref{Packages with
  135. Multiple Outputs, Packages with Multiple Outputs,, guix, Guix}).
  136. @item @code{path}
  137. The build output path within the job, as a string.
  138. @end table
  139. @end deftp
  140. For instance, let's consider the @code{binary-tarball.x86_64-linux}
  141. job which produces the following output:
  142. @code{/gnu/store/xxx-guix-binary.tar.xz}.
  143. The build output definition below will save the root element
  144. (@code{""}) of the @code{"out"} output of the
  145. @code{"binary-tarball.x86_64-linux"} job---i.e., the
  146. @code{"xxx-guix-binary.tar.xz"} file.
  147. @lisp
  148. (build-output
  149. (job "binary-tarball*")
  150. (type "archive")
  151. (output "out")
  152. (path ""))
  153. @end lisp
  154. @item @code{notifications} (default: @code{()})
  155. The list of build notifications that must be sent. For instance:
  156. @lisp
  157. (list (email
  158. (from "build@@cuirass.org")
  159. (to "notification@@myself.org")
  160. (server "sendmail:///etc/my-mailer.sh")))
  161. @end lisp
  162. will send build notifications emails from @code{build@@cuirass.org} to
  163. @code{notifications@@myself.org}, using
  164. @code{"sendmail:///etc/my-mailer.sh"} mailer.
  165. The different notification types are described in the
  166. @ref{Notifications} section.
  167. @item @code{priority} (default: @code{9})
  168. The specification priority relatively to the other specifications, as
  169. an integer ranging from 0 to 9 where 0 is the higher priority and 9
  170. the lowest.
  171. @item @code{systems} (default: @code{(list (%current-system))})
  172. Build every job for each system in this list. By default only the
  173. current system is selected.
  174. @end table
  175. @end deftp
  176. @c *********************************************************************
  177. @node Notifications
  178. @chapter Notifications
  179. @cindex cuirass notifications
  180. Cuirass supports different build notifications types, that can be
  181. passed in the @code{notifications} field of the specification record,
  182. see @ref{Specifications}.
  183. Cuirass sends build notifications each time a build is broken or
  184. fixed.
  185. @section Email
  186. Email build notifications can be enabled using the following record.
  187. @deftp {Data Type} email
  188. @table @asis
  189. @item @code{from}
  190. The email @code{From} field, as a string.
  191. @item @code{to}
  192. The email @code{To} field, as a string.
  193. @item @code{server}
  194. The mail server connection string. Cuirass uses the @code{mailutils}
  195. package. Hence the server can be specified as a remote SMTP mailbox
  196. (@pxref{SMTP Mailboxes, SMTP Mailboxes,, mailutils, Mailutils}) or as
  197. a program mailbox (@pxref{Program Mailboxes, Program Mailboxes,,
  198. mailutils, Mailutils}).
  199. @end table
  200. @end deftp
  201. @section Mastodon
  202. Mastodon build notifications can be enabled using the following record.
  203. @deftp {Data Type} mastodon
  204. @end deftp
  205. The Mastodon credentials must be defined as Cuirass parameters, see
  206. @ref{Parameters}.
  207. @section RSS
  208. Cuirass is proposing a build notification RSS feed at the following
  209. URL:
  210. @itemize
  211. @item @url{http://cuirass-url/events/rss[?specification=spec]}
  212. By default build notifications are sent for all specifications. If
  213. the @code{specification} argument is passed, they can be restricted to
  214. the @var{spec} specification.
  215. @end itemize
  216. @c *********************************************************************
  217. @node Parameters
  218. @chapter Parameters
  219. @cindex cuirass parameters
  220. Cuirass is able to connect to different external services such as
  221. @code{postgresql} for the database, @code{zabbix} for machine
  222. monitoring and @code{mastodon} for build notifications. As those
  223. services often require using secret credentials, Cuirass can be passed
  224. a parameter file.
  225. The parameters file can be passed using the @code{parameters} command
  226. line argument, see @ref{Invocation}.
  227. Here's an example parameter file:
  228. @example
  229. (%cuirass-url "https://ci.guix.gnu.org")
  230. (%zabbix-url "http://127.0.0.1:15412/api_jsonrpc.php")
  231. (%mastodon-instance-name "My Instance")
  232. (%mastodon-instance-url "https://instance.org")
  233. (%mastodon-instance-token "secret-token")
  234. @end example
  235. @deftp {Parameters} parameters
  236. @table @asis
  237. @item @code{%cuirass-database} (default: @code{"cuirass"})
  238. The Cuirass PostgreSQL database name.
  239. @item @code{%cuirass-host} (default: @code{"/var/run/postgresql"})
  240. The Cuirass PostgreSQL database host.
  241. @item @code{%cuirass-url} (default: @code{#f})
  242. The URL of the Cuirass web server. This is useful to send absolute
  243. links within notifications.
  244. @item @code{%zabbix-url} (default: @code{#f})
  245. The URL of the Zabbix monitoring server providing the workers status,
  246. if supported.
  247. @item @code{%zabbix-user} (default: @code{"Admin"})
  248. The user for Zabbix API authentication.
  249. @item @code{%zabbix-password} (default: @code{"zabbix"})
  250. The password for Zabbix API authentication.
  251. @item @code{%mastodon-instance-name} (default: @code{#f})
  252. The name of the Mastodon instance used to send build notifications.
  253. @item @code{%mastodon-instance-url} (default: @code{#f})
  254. The URL of the Mastodon instance.
  255. @item @code{%mastodon-instance-token} (default: @code{#f})
  256. The token used to authenticate on the Mastodon instance.
  257. @end table
  258. @end deftp
  259. @c *********************************************************************
  260. @node Build modes
  261. @chapter Build modes
  262. @cindex cuirass build modes
  263. Cuirass supports two mechanisms to build derivations.
  264. @section With the local Guix daemon
  265. This is the default build mechanism. Once the build jobs are
  266. evaluated, they are sent to the local Guix daemon. Cuirass then
  267. listens to the Guix daemon output to detect the various build events.
  268. While this mode doesn't require any particular configuration, it
  269. doesn't scale well. The scheduling decisions of the Guix daemon are
  270. opaque and often suboptimal.
  271. When Cuirass is used to build a large amount of jobs, the remote build
  272. mechanism described below should be preferred.
  273. @section With the remote build mechanism.
  274. This mode is harder to setup but scales way better. This is the build
  275. mode that is used on the GNU Guix build farm at
  276. @url{https://ci.guix.gnu.org}. The build jobs are not submitted to
  277. the local Guix daemon. Instead, a remote server dispatches build
  278. requests to the connect remote workers, according to the build
  279. priorities.
  280. The remote server and the connected workers communicate using ZMQ over
  281. TCP. The workers are able to discover the remote server using Avahi.
  282. The built items are exchanged as substitutes (@pxref{Substitutes,
  283. Substitutes,, guix, Guix}) by spawning Guix publish servers both on
  284. the remote server and on each connected remote worker.
  285. It can be enabled this way:
  286. @itemize
  287. @item
  288. Start the @code{cuirass register} process with the @code{build-remote}
  289. command line argument, see @ref{Invocation}. This way, the
  290. registration process does not submit the new build jobs to the local
  291. Guix daemon.
  292. @item
  293. Start the @code{cuirass remote-server} process to dispatch the build
  294. jobs to the connected workers.
  295. @item
  296. Start at least one @code{cuirass remote-worker} process on any machine
  297. of the local network to actually perform the builds and report their
  298. status.
  299. @end itemize
  300. Note that some Cuirass features are only available when using this
  301. build mode. That's the case for:
  302. @itemize
  303. @item
  304. The build priority support.
  305. @item
  306. The notification mechanism, see @ref{Notifications}.
  307. @item
  308. The transmission of @code{timeout} and @code{max-silent-time} package
  309. properties to the Guix daemon.
  310. @item
  311. The live build log mechanism of the Web interface.
  312. @item
  313. The workers status page of the Web inferface accessible at
  314. @url{http://cuirass-url/workers}.
  315. @end itemize
  316. The easiest way to setup such an infrastructure is to rely on the GNU
  317. Guix Cuirass services definitions (@pxref{Continuous Integration,
  318. Continuous Integration,, guix, Guix}).
  319. @c *********************************************************************
  320. @node Invocation
  321. @chapter Invocation
  322. @section Invoking cuirass register
  323. @cindex register
  324. The usual way to invoke @code{cuirass} registration process is as follows:
  325. @example
  326. cuirass register --specifications @var{specs}
  327. @end example
  328. This starts a Cuirass registration instance building @var{specs} and
  329. storing the results using the default PostgreSQL database.
  330. Additionally the following options can be used.
  331. @table @code
  332. @item --one-shot
  333. Instead of executing @code{cuirass} as a daemon looping over the jobs.
  334. Only evaluate and build the specifications once.
  335. @item --cache-directory=@var{directory}
  336. @var{directory} is the place where the VCS repositories used by the jobs
  337. are stored.
  338. @item --specifications=@var{specifications-file}
  339. @itemx -S @var{specifications-file}
  340. Add the specifications defined in @var{specifications-file} in the job
  341. database before launching the evaluation and build processes.
  342. @item --database=@var{database}
  343. @itemx -D @var{database}
  344. Use @var{database} as the database containing the jobs and the past
  345. build results. Since Cuirass uses PostgreSQL as a database engine,
  346. @var{database} must be a string such as @code{"dbname=cuirass
  347. host=localhost"}. By default, Cuirass uses the following connection
  348. string: @code{dbname=cuirass host=/var/run/postgresql"}.
  349. @item --parameters=@var{parameters-file}
  350. @itemx -P @var{parameters-file}
  351. Read parameters from the given @var{parameters-file}. The supported
  352. parameters are described here (@pxref{Parameters}).
  353. @item --ttl=@var{duration}
  354. Cuirass registers build results as garbage collector (GC) roots, thereby
  355. preventing them from being deleted by the GC. The @option{--ttl} option
  356. instructs it to keep those GC roots live for at least @var{duration}---e.g.,
  357. @code{1m} for one month, @code{2w} for two weeks, and so on. The default is
  358. 30 days.
  359. Those GC roots are typically stored in
  360. @file{/var/guix/gcroots/profiles/per-user/@var{user}/cuirass}, where @var{user} is the
  361. user under which Cuirass is running.
  362. @item --interval=@var{n}
  363. @itemx -I @var{n}
  364. Wait @var{n} seconds between each poll.
  365. @item --use-substitutes
  366. This can be useful when you are not interested in building the
  367. dependencies of a particular job.
  368. @item --threads=@var{n}
  369. Use up to @var{n} kernel threads.
  370. @var{n} should be lower than or equal to the number of CPU cores on the
  371. machine. In general though, having a large @var{n} is not very useful
  372. since the work of Cuirass is primarily I/O-bound---on the contrary,
  373. large values of @var{n} may increase overhead. The default value should
  374. be appropriate for most cases.
  375. @item --version
  376. @itemx -V
  377. Display the actual version of @code{cuirass}.
  378. @item --help
  379. @itemx -h
  380. Display an help message that summarize all the options provided.
  381. @end table
  382. @section Invoking cuirass web
  383. @cindex web
  384. The usual way to invoke the @code{cuirass} web server is as follows:
  385. @example
  386. cuirass web
  387. @end example
  388. This starts a Cuirass web server on the default port. Additionally the
  389. following options can be used.
  390. @table @code
  391. @item --database=@var{database}
  392. @itemx -D @var{database}
  393. Use @var{database} as the database containing the jobs and the past
  394. build results. Since Cuirass uses PostgreSQL as a database engine,
  395. @var{database} must be a string such as @code{"dbname=cuirass
  396. host=localhost"}. By default, Cuirass uses the following connection
  397. string: @code{dbname=cuirass host=/var/run/postgresql"}.
  398. @item --parameters=@var{parameters-file}
  399. @itemx -P @var{parameters-file}
  400. Read parameters from the given @var{parameters-file}. The supported
  401. parameters are described here (@pxref{Parameters}).
  402. @item --port=@var{num}
  403. @itemx -p @var{num}
  404. Make the HTTP interface listen on port @var{num}. Use port 8080 by
  405. default.
  406. @item --listen=@var{host}
  407. Make the HTTP interface listen on network interface for @var{host}. Use
  408. localhost by default.
  409. @item --version
  410. @itemx -V
  411. Display the actual version of @code{cuirass}.
  412. @item --help
  413. @itemx -h
  414. Display an help message that summarize all the options provided.
  415. @end table
  416. @section Invoking cuirass remote-server
  417. @cindex remote-server
  418. The @code{remote-server} command starts a daemon that is able to
  419. communicate with @code{remote-worker} processes. Its role is to
  420. answer build requests from the workers, by sending back derivations
  421. that must be built.
  422. On build completion it updates the database accordingly and possibly
  423. fetches build substitutes. The @code{remote-server} and
  424. @code{remote-worker} processes communicate using ZMQ over TCP.
  425. Additionally the following options can be used.
  426. @table @code
  427. @item --backend-port=@var{port}
  428. The TCP port for communicating with @code{remote-worker} processes
  429. using ZMQ. It defaults to @code{5555}.
  430. @item --log-port=@var{port}
  431. The TCP port of the log server. It defaults to @code{5556}.
  432. @item --publish-port=@var{port}
  433. The TCP port of the publish server. It defaults to @code{5557}.
  434. @item --parameters=@var{parameters-file}
  435. @itemx -P @var{parameters-file}
  436. Read parameters from the given @var{parameters-file}. The supported
  437. parameters are described here (@pxref{Parameters}).
  438. @item --database=@var{database}
  439. @itemx -D @var{database}
  440. Use @var{database} PostgreSQL connection string.
  441. @item --cache=@var{directory}
  442. Use @var{directory} to cache build log files.
  443. @item --trigger-substitute-url=@var{URL}
  444. Once a substitute is successfully fetched, trigger substitute baking
  445. at @var{URL}.
  446. @item --user=@var{user}
  447. Change privileges to @var{user} as soon as possible---i.e., once the
  448. signing key has been read.
  449. @item --public-key=@var{file}
  450. @itemx --private-key=@var{file}
  451. Use the specific @var{file}s as the public/private key pair used to sign
  452. the store items being published.
  453. @item --version
  454. @itemx -V
  455. Display the actual version of @code{cuirass}.
  456. @item --help
  457. @itemx -h
  458. Display an help message that summarize all the options provided.
  459. @end table
  460. @section Invoking cuirass remote-worker
  461. @cindex remote-worker
  462. The @code{remote-worker} command starts a daemon that is able to
  463. communicate with a @code{remote-server} process. Its role is to
  464. request builds to the @code{remote-server}, perform them and report
  465. their status.
  466. The @code{remote-worker} is able to discover a @code{remote-server}
  467. process on the local network using Avahi and connect to it.
  468. Additionally the following options can be used.
  469. @table @code
  470. @item --workers=@var{count}
  471. Start @var{count} parallel workers. It defaults to @code{1}.
  472. @item --publish-port=@var{port}
  473. The TCP port of the publish server. It defaults to @code{5558}.
  474. @item --server=@var{ip-address}
  475. Do not use Avahi discovery and connect to the given
  476. @code{remote-server} IP address.
  477. @item --systems=@var{systems}
  478. Only request builds for the given @var{systems}. It defaults to
  479. @code{(list (%current-system))}.
  480. @item --public-key=@var{file}
  481. @itemx --private-key=@var{file}
  482. Use the specific @var{file}s as the public/private key pair used to sign
  483. the store items being published.
  484. @item --version
  485. @itemx -V
  486. Display the actual version of @code{cuirass}.
  487. @item --help
  488. @itemx -h
  489. Display an help message that summarize all the options provided.
  490. @end table
  491. @c *********************************************************************
  492. @node Web API
  493. @chapter Web API
  494. @cindex web api
  495. The Cuirass web API is inspired from the Hydra one.
  496. @section API description
  497. @cindex description, json
  498. @subsection Evaluation information
  499. @subsubheading Single evaluation
  500. It is possible to query the Cuirass web server for evaluation
  501. information. The dedicated API is "/api/evaluation?id=@var{eval-id}"
  502. where @var{eval-id} is the unique id associated to the evaluation in
  503. database.
  504. For instance, querying a local Cuirass web server can be done with
  505. @code{curl} and @code{jq} to format the JSON response :
  506. @example
  507. $ curl -s "http://localhost:8080/api/evaluation?id=1" | jq
  508. @{
  509. "id": 1,
  510. "specification": "guix-master",
  511. "status": 0,
  512. "timestamp": 1615289011,
  513. "checkouttime": 1615289011,
  514. "evaltime": 1615289655,
  515. "checkouts": [
  516. @{
  517. "commit": "bd311f5a6ccbd4696ac77f0426a036bb375a2f10",
  518. "channel": "guix",
  519. "directory": "/gnu/store/6978xw9vs4ybg2pc3g736p1dba2056yl-guix-bd311f5"
  520. @}
  521. ]
  522. @}
  523. @end example
  524. The nominal output is a JSON object whose fields are described
  525. hereafter.
  526. @table @code
  527. @item id
  528. The unique build id.
  529. @item specification
  530. The associated specification name, as a string.
  531. @item status
  532. The evaluation status, as an integer. Possible values are :
  533. @example
  534. -1 -> started
  535. 0 -> succeeded
  536. 1 -> failed
  537. 2 -> aborted
  538. @end example
  539. @item checkouttime
  540. The timestamp after channel checkout.
  541. @item evaltime
  542. The timestamp after evaluation completion.
  543. @item checkouts
  544. The evaluation checkouts as a JSON object.
  545. @end table
  546. @subsubheading Multiple evaluations
  547. The latest evaluations list can be obtained with the API
  548. "/api/evaluations". The output is a JSON array of
  549. evaluations. Evaluations are represented as in the
  550. "/api/evaluation?id=@var{eval-id}" API.
  551. This request accepts a mandatory parameter.
  552. @table @code
  553. @item nr
  554. Limit query result to nr elements. This parameter is @emph{mandatory}.
  555. @end table
  556. @subsection Build information
  557. It is possible to query Cuirass web server for build informations. The
  558. dedicated API is "/build/@var{build-id}" where @var{build-id} is the
  559. unique id associated to the build in database.
  560. The build information can also be queried by output. For example,
  561. @samp{/output/kg9mirg6xbvzcp0a98v7326n1nvvwgsj-hello-2.10} will return
  562. the details of the output, along with the build if available.
  563. @example
  564. $ curl -s "http://localhost:8080/build/2" | jq
  565. @{
  566. "id": 2,
  567. "jobset": "guix",
  568. "job": "acpica-20150410-job",
  569. "timestamp": 1501347493,
  570. "starttime": 1501347493,
  571. "stoptime": 1501347493,
  572. "buildoutputs": @{
  573. "out": @{
  574. "path": "/gnu/store/6g3njhfzqpdm335s7qhvmwvs5l7gcbq1-acpica-20150410"
  575. @}
  576. @},
  577. "system": "x86_64-linux",
  578. "nixname": "acpica-20150410",
  579. "buildstatus": 0,
  580. "weather": 0,
  581. "busy": 0,
  582. "priority": 0,
  583. "finished": 1,
  584. "buildproducts": null
  585. @}
  586. @end example
  587. If requested @var{build-id} is not known, the HTTP code 404 is
  588. answered with a JSON error message. For example:
  589. @example
  590. $ curl -s "http://localhost:8080/build/fff"
  591. @{"error" : "Build with ID fff doesn't exist."@}
  592. @end example
  593. The nominal output is a JSON object whose fields are described
  594. hereafter.
  595. @table @code
  596. @item id
  597. The unique build id.
  598. @item jobset
  599. The associated specification name, as a string.
  600. @item job
  601. The associated job-name, as a string.
  602. @item timestamp
  603. Timestamp taken at build creation time.
  604. @item starttime
  605. Timestamp taken at build start time.
  606. @item stoptime
  607. Timestamp taken at build stop time.
  608. @item buildoutputs
  609. Build outputs as a JSON object. The keys names are referring to the
  610. eventual output names. The associated value is another JSON object which
  611. only key is @code{path}. @code{path} value is the output directory in
  612. store as a string.
  613. @item system
  614. System name of the build, as a string.
  615. @item nixname
  616. Derivation name, as a string.
  617. @item buildstatus
  618. Build status, as an integer. Possible values are :
  619. @example
  620. 0 -> succeeded
  621. 1 -> failed
  622. 2 -> failed dependency
  623. 3 -> failed other
  624. 4 -> cancelled
  625. @end example
  626. @item weather
  627. Build weather, as an integer.
  628. @example
  629. -1 -> unknown
  630. 0 -> new-success
  631. 1 -> new-failure
  632. 2 -> still-succeeding
  633. 3 -> still-failing
  634. @end example
  635. @item busy
  636. Whether the build is pending, as an integer.
  637. @item priority
  638. Build priority, as an integer.
  639. @item finished
  640. Build finished, as an integer.
  641. @item buildproducts
  642. Build products in store as a JSON object.
  643. @end table
  644. @subsection Build raw log output
  645. It is possible to ask Cuirass for the raw build output log with the API
  646. "/build/@var{build-id}/log/raw" where @var{build-id} is the
  647. unique id associated to the build in database.
  648. The output is a raw text, for example:
  649. @example
  650. $ curl http://localhost:8080/build/2/log/raw
  651. starting phase `set-SOURCE-DATE-EPOCH'
  652. phase `set-SOURCE-DATE-EPOCH' succeeded after 0.0 seconds
  653. starting phase `set-paths'
  654. ...
  655. @end example
  656. If requested @var{build-id} is not known, the HTTP code 404 is
  657. answered with a JSON error message. For example:
  658. @example
  659. $ curl -s "http://localhost:8080/build/fff/log/raw"
  660. @{"error" : "Build with ID fff doesn't exist."@}
  661. @end example
  662. @subsection Latest builds
  663. The list of latest builds can be obtained with the API
  664. "/api/latestbuilds". The output is a JSON array of builds. Builds are
  665. represented as in the "/build/@var{build-id}" API.
  666. This request accepts a mandatory parameter and multiple optional ones.
  667. @table @code
  668. @item nr
  669. Limit query result to nr elements. This parameter is @emph{mandatory}.
  670. @item jobset
  671. Filter query result to builds with the given @code{jobset}.
  672. @item job
  673. Filter query result to builds with the given @code{job} name.
  674. @item system
  675. Filter query result to builds with the given @code{system}.
  676. @end table
  677. For example, to ask for the ten last builds:
  678. @example
  679. $ curl "http://localhost:8080/api/latestbuilds?nr=10"
  680. @end example
  681. or the five last builds where jobset ``guix'':
  682. @example
  683. $ curl "http://localhost:8080/api/latestbuilds?nr=5&jobset=guix"
  684. @end example
  685. If no builds matching given parameters are found, an empty JSON array is
  686. returned.
  687. @subsection Queued builds
  688. The list of queued builds can be obtained with the API
  689. "/api/queue". The output is a JSON array of builds. Builds are
  690. represented as in the "/build/@var{build-id}" API.
  691. This request accepts a mandatory parameter.
  692. @table @code
  693. @item nr
  694. Limit query result to nr elements. This parameter is @emph{mandatory}.
  695. @end table
  696. @c *********************************************************************
  697. @node Database
  698. @chapter Database schema
  699. @cindex cuirass database
  700. @cindex postgresql database
  701. @cindex persistent configuration
  702. Cuirass uses a PostgreSQL database to store information about jobs and
  703. past build results, but also to coordinate the execution of jobs.
  704. The database contains the following tables: @code{Specifications},
  705. @code{Checkouts}, @code{Evaluations}, @code{Builds}, @code{Outputs},
  706. @code{Metrics}, @code{BuildProducts}, @code{Events} and
  707. @code{Workers}. The purpose of each of these tables is explained
  708. below.
  709. @section Specifications
  710. @cindex specifications, database
  711. This table stores specifications describing the repositories from whence
  712. Cuirass fetches code and the environment in which it will be processed.
  713. Entries in this table must have values for the following text fields:
  714. @table @code
  715. @item name
  716. This field holds the name of the specification. This field is also the
  717. primary key of this table.
  718. @item channels
  719. The channels to be fetched by Cuirass as an SEXP string.
  720. @item build_ouputs
  721. The build outputs to be saved by Cuirass as an SEXP string.
  722. @item notifications
  723. The build notifications to be sent by Cuirass as an SEXP string.
  724. @item priority
  725. The specification priority relatively to the other specifications, as
  726. an integer ranging from 0 to 9 where 0 is the higher priority and 9
  727. the lowest.
  728. @item systems
  729. The systems for which build jobs must be evaluated, as a comma
  730. separated list.
  731. @end table
  732. @section Checkouts
  733. @cindex checkouts, database
  734. When a specification is processed, the repositories must be downloaded at a
  735. certain revision as specified. The download is called a checkout. The
  736. @code{Checkouts} table stores the new checkouts for every specification when
  737. it is being processed.
  738. The @code{Checkouts} table has the following columns:
  739. @table @code
  740. @item specification
  741. The specification associated with the checkout.
  742. @item revision
  743. The revision of the checkout. Within the same specification, two checkouts
  744. can't be identical: they can't have the same revision.
  745. @item evaluation
  746. The evaluation that was triggered by the addition of that new checkout.
  747. @item channel
  748. The channel associated with the checkout.
  749. @item directory
  750. The directory into which the checkout was extracted.
  751. @item timestamp
  752. The checkout insertion timestamp.
  753. @end table
  754. @section Evaluations
  755. @cindex evaluations, database
  756. An evaluation relates a specification with the revision of the repository
  757. specified therein. Builds (see below) belong to a specific evaluation.
  758. The @code{Evaluations} table has the following columns:
  759. @table @code
  760. @item id
  761. This is an automatically incrementing numeric identifier.
  762. @item specification
  763. This field holds the @code{name} of a specification from the
  764. @code{Specifications} table.
  765. @item status
  766. This integer field hold the evaluation status. Possible values are:
  767. @itemize
  768. @item started (@code{-1})
  769. @item succeeded (@code{0})
  770. @item failed (@code{1})
  771. @item aborted (@code{2})
  772. @end itemize
  773. @item timestamp
  774. The timestamp at evaluation insertion.
  775. @item checkout
  776. The timestamp after channel checkout.
  777. @item evaltime
  778. The timestamp after evaluation completion.
  779. @end table
  780. @section Builds
  781. @cindex builds, database
  782. This table holds records of the derivations and their build status. Note that
  783. a job will be registered here only if its derivation doesn't already exist.
  784. @table @code
  785. @item derivation
  786. This text field holds the absolute name of the derivation file that
  787. resulted in this build.
  788. @item evaluation
  789. This integer field references the evaluation identifier from the
  790. @code{Evaluations} table, indicating to which evaluation this build
  791. belongs.
  792. @item job_name
  793. This text field holds the name of the job.
  794. @item system
  795. This text field holds the system name of the derivation.
  796. @item nix_name
  797. This text field holds the name of the derivation ---e.g.,
  798. @code{coreutils-8.24}.
  799. @item worker
  800. This text field references the name of worker performing the build
  801. from the @code{Workers} table.
  802. @item log
  803. This text field holds the absolute file name of the build log file.
  804. @item status
  805. This integer field holds the build status of the derivation.
  806. @item last_status
  807. This integer field holds the build status of the previous job
  808. evaluation.
  809. @item weather
  810. This integer field holds the weather of the build. Possible values
  811. are:
  812. @itemize
  813. @item unknown (@code{-1})
  814. @item new-success (@code{0})
  815. @item new-failure (@code{1})
  816. @item still-succeeding (@code{2})
  817. @item still-failing (@code{3})
  818. @end itemize
  819. @item priority
  820. The build priority relatively to the other builds with the same
  821. @code{job_name}, as an integer ranging from 0 to 99 where 0 is the
  822. higher priority and 99 the lowest.
  823. @item max_silent
  824. This integer field holds the number of seconds of silence after which
  825. a build process times out.
  826. @item timeout
  827. This integer field holds the number of seconds of activity after which
  828. a build process times out.
  829. @item timestamp
  830. This integer field holds a timestamp taken at build creation time.
  831. @item starttime
  832. This integer field holds a timestamp taken at build start time.
  833. Currently, it has the same value as the @code{timestamp} above.
  834. @item stoptime
  835. This integer field holds a timestamp taken at build stop time.
  836. Currently, it has the same value as the @code{timestamp} above.
  837. @end table
  838. @section Outputs
  839. @cindex outputs, database
  840. This table keep tracks for every eventual build outputs. Each build
  841. stored in @code{Builds} table may have zero (if it has failed), one or
  842. multiple outputs.
  843. @table @code
  844. @item derivation
  845. This field holds the @code{derivation} of a build from the @code{Builds}
  846. table.
  847. @item name
  848. This text field holds the name of the output.
  849. @item path
  850. This text field holds the path of the output.
  851. @end table
  852. @section Metrics
  853. @cindex metrics, database
  854. This table contains several metrics that are recorded by the
  855. @code{metrics} fiber periodically.
  856. @table @code
  857. @item field
  858. This text field holds the application field of the metric.
  859. @item type
  860. This integer field holds the type of the metric.
  861. @item path
  862. This float field holds the value of the metric.
  863. @item evaltime
  864. The metric insertion timestamp.
  865. @end table
  866. @section BuildProducts
  867. @cindex buildproducts, database
  868. This table contains the saved build products, that are proposed to
  869. download through the web interface.
  870. @table @code
  871. @item build
  872. This integer field holds a reference to the build @code{id} from the
  873. @code{Builds} table, the build product belongs to.
  874. @item type
  875. This text field holds the build product type.
  876. @item file_size
  877. This integer field holds build product size in bytes.
  878. @item checksum
  879. This text field holds the build product checksum.
  880. @item path
  881. This text field holds the build product absolute store path.
  882. @end table
  883. @section Notifications
  884. @cindex notifications, database
  885. This table contains the notifications that are queued for sending.
  886. @table @code
  887. @item id
  888. This is an automatically incrementing numeric identifier.
  889. @item type
  890. This text field holds the SEXP representation of the notification.
  891. @item build
  892. This integer fields references the build id associated with the
  893. notification.
  894. @end table
  895. @section Workers
  896. @cindex workers, database
  897. This table contains the registered workers when Cuirass is using the
  898. remote building mechanism.
  899. @table @code
  900. @item name
  901. This text field holds the worker name. This field is also the primary
  902. key of this table.
  903. @item address
  904. This text field holds the worker IP address.
  905. @item machine
  906. This text field holds the worker machine name.
  907. @item systems
  908. This text field holds the systems that are supported by the worker, as
  909. a comma separated list of systems.
  910. @item last_seen
  911. This integer field holds the timestamp of the last communication with
  912. the worker.
  913. @end table
  914. @c *********************************************************************
  915. @node Contributing
  916. @chapter Contributing
  917. Everyone is welcome to contribute to Cuirass. You can report bugs, send
  918. patches and share your ideas with others by sending emails the
  919. @email{guix-devel@@gnu.org, mailing list}.
  920. Development is done using the Git distributed version control system.
  921. Thus, access to the repository is not strictly necessary. We welcome
  922. contributions in the form of patches as produced by @code{git
  923. format-patch}. Please write commit logs in the ChangeLog format
  924. (@pxref{Change Logs,,, standards, GNU Coding Standards}); you can check
  925. the commit history for examples.
  926. When posting a patch to the mailing list, use @samp{[PATCH] @dots{}} as
  927. a subject. You may use your email client or the @command{git
  928. send-email} command. We prefer to get patches in plain text messages,
  929. either inline or as MIME attachments. You are advised to pay attention
  930. if your email client changes anything like line breaks or indentation
  931. which could potentially break the patches.
  932. @c *********************************************************************
  933. @node GNU Free Documentation License
  934. @appendix GNU Free Documentation License
  935. @cindex license, GNU Free Documentation License
  936. @include fdl-1.3.texi
  937. @c *********************************************************************
  938. @node Concept Index
  939. @unnumbered Concept Index
  940. @printindex cp
  941. @bye