2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/guix-cuirass.git synced 2023-12-14 06:03:04 +01:00
Cuirass continuous integration tool https://git.savannah.gnu.org/cgit/guix/guix-cuirass.git
Find a file
Ludovic Courtès 87a6d6ea7a
remote-worker: Correctly compute parallelism per worker.
Fixes <https://issues.guix.gnu.org/67502>.

Since ‘run-fibers’ binds each thread to one core by default,
‘current-processor-count’ when called from within ‘run-fibers’ on a
machine with 4 or fewer cores would always return 1.

* src/cuirass/scripts/remote-worker.scm (worker-management-thunk): Add
‘cpu-count’ parameter and use it instead of calling
‘current-processor-count’.
(cuirass-remote-worker): Call ‘current-processor-count’ outside
‘run-fibers’ and pass the result to ‘worker-management-thunk’.
2023-11-28 15:51:38 +01:00
bin Use a single Cuirass binary. 2021-03-22 18:29:06 +01:00
build-aux maint: Build against the latest ‘guile-fibers’. 2023-10-19 08:51:49 +02:00
doc remote-worker: Add ‘--user’. 2023-11-27 15:26:43 +01:00
etc doc: Document authentication. 2023-06-14 23:15:12 +02:00
examples examples: random: Define a “build product” for some jobs. 2023-10-18 15:03:27 +02:00
src remote-worker: Correctly compute parallelism per worker. 2023-11-28 15:51:38 +01:00
tests tests: Check value of ‘evaluation-summary-newly-failed’. 2023-11-22 10:48:42 +01:00
.dir-locals.el Factorize 'with-store/non-blocking'. 2023-07-15 17:07:15 +02:00
.gitignore Add systemd unit file for remote worker service. 2021-09-16 22:00:15 +02:00
.guix-authorizations .guix-authorizations: Add Maxim Cournoyer to the committers. 2023-06-22 21:52:54 +02:00
.guix-channel maint: Turn into a Guix channel. 2023-05-09 16:27:57 +02:00
bootstrap build: Add 'bootstrap' script. 2016-08-02 19:04:53 +02:00
configure.ac config: Define '%runstatedir'. 2023-09-12 11:51:19 +02:00
COPYING Initial commit. 2016-05-29 19:53:17 +02:00
guix.scm maint: Update Guix package definition. 2023-05-09 16:27:57 +02:00
Makefile.am utils: Add tests for the resource pool. 2023-11-16 22:16:27 +01:00
NEWS Update NEWS. 2023-10-29 22:39:07 +01:00
README README: Add test instructions for 'remote-server' and 'remote-worker'. 2023-07-14 01:38:10 +02:00
TODO Update TODO. 2023-10-25 00:43:36 +02:00

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-*- mode: org -*-

Cuirass is a continuous integration tool using GNU Guix.

* Requirements

Cuirass currently depends on the following packages:

  - GNU Guile 3.0.x or 2.2.x
  - GNU Guix (and all its development dependencies)
  - GNU Make
  - Guile-JSON 3.x
  - Guile-Avahi
  - Guile-Squee
  - Guile-Git
  - Guile-zlib
  - Guile-Mastodon
  - Guile-Simple-ZMQ
  - Ephemeral PostgreSQL (for the tests)
  - Mailutils
  - Fibers

A convenient way to install those dependencies is to install Guix and execute
the following command:

#+BEGIN_EXAMPLE
  guix shell -CPNW --expose=/var/log/guix/drvs \
    --expose=/var/run/dbus --expose=/run/avahi-daemon \
    --expose=/etc/ssl/certs
#+END_EXAMPLE

This will build and enter a containarized environment which provides all the
necessary dependencies and resources.

The =-W= flag gives access to the outer =guix-daemon= and to the store, which
is necessary when running =cuirass= to perform actual builds.  Exposing
=/var/log/guix/drvs= allows =cuirass web= to display build logs.  The
next two =--expose= flags give access to the outer =avahi-daemon=, which is
used by =cuirass remote-server= and =cuirass remote-worker=; this is a
requirement for =tests/remote.scm=.  Last, exposing the hosts
=/etc/ssl/certs= allows access to X.509 root certificates, necessary when
accessing for instance Git repositories over HTTPS.

* Build Instructions

When all the dependencies are available on you system, in order to build
Cuirass, you can proceed with the usual:

#+BEGIN_EXAMPLE
  ./bootstrap && ./configure && make
#+END_EXAMPLE

* Database connection

Cuirass uses PostgreSQL to store information about jobs, past build results
and to coordinate the execution of jobs.  The database connection string must
be passed to Cuirass using the =database= argument, under the keyword/value
format described [[https://www.postgresql.org/docs/10/libpq-connect.html#LIBPQ-CONNSTRING][here]].  The PostgreSQL database must be created beforehand.

By default, this command:

#+BEGIN_EXAMPLE
  ./pre-inst-env cuirass register
#+END_EXAMPLE

will connect using the Unix socket at =/var/run/postgresql= to the =cuirass=
database and is equivalent to:

#+BEGIN_EXAMPLE
  ./pre-inst-env cuirass register --database="dbname=cuirass host=/var/run/postgresql"
#+END_EXAMPLE

To use a TCP connection, one can use:

#+BEGIN_EXAMPLE
  ./pre-inst-env cuirass register --database="host=127.0.0.1"
#+END_EXAMPLE

For a test run, instead of running a full-blown PostgreSQL, you can use the
=pg_tmp= program from [[https://eradman.com/ephemeralpg/][ephemeralpg]] like so:

#+begin_example
  DB=$(pg_tmp)
  ./pre-inst-env cuirass register -S examples/cuirass.scm --database=$DB &
  ./pre-inst-env cuirass web --database=$DB
#+end_example

Or, if you want to test the ZeroMQ-based remote build mechanism, you can run:

#+begin_example
  DB=$(pg_tmp)
  ./pre-inst-env cuirass register -S examples/cuirass.scm --database=$DB \
     --build-remote &
  ./pre-inst-env cuirass web --database=$DB &
  ./pre-inst-env cuirass remote-server --database=$DB \
     --public-key=tests/signing-key.pub --private-key=tests/signing-key.sec &
  ./pre-inst-env cuirass remote-worker \
     --public-key=tests/signing-key.pub --private-key=tests/signing-key.sec &
#+end_example

* Run tests

Cuirass tests also require an access to a PostgreSQL database, provided by the
Ephemeral PostgreSQL package.  The =pg_tmp= script needs to be part of the
path before running the usual:

#+BEGIN_EXAMPLE
  make check
#+END_EXAMPLE

* Example

A quick way to manually test Cuirass is to execute:

#+BEGIN_EXAMPLE
  ./pre-inst-env cuirass register --specifications=examples/hello.scm
#+END_EXAMPLE

This will read the file "examples/hello.scm" which contains a list of
specifications and add them to the =cuirass= database.  It will then build the
=hello= package on top of the default Guix channel.

Cuirass then loops evaluating/building the specs.  The database keeps track
of the specifications in order to allow users to accumulate specifications.
To resume the evaluation/build process you can execute the same command
without the '--specifications' option:

#+BEGIN_EXAMPLE
  ./pre-inst-env cuirass register
#+END_EXAMPLE

To start the web interface run:

#+BEGIN_EXAMPLE
  ./pre-inst-env cuirass web
#+END_EXAMPLE

* Contributing

See the manual for useful hacking informations, by running

#+BEGIN_EXAMPLE
  info -f doc/cuirass.info "Contributing"
#+END_EXAMPLE

You can authenticate the code in this repository by running:

#+begin_example
  guix git authenticate				\
      c75620777c33273fcd14261660288ec1b2dc8123	\
      3CE464558A84FDC69DB40CFB090B11993D9AEBB5
#+end_example

The command silently exits with zero on success, and errors out
otherwise.  We recommend invoking it from =.git/hooks/pre-push=.