Next: , Previous: , Up: Services   [Contents][Index]


10.8.23 Continuous Integration

Cuirass is a continuous integration tool for Guix. It can be used both for development and for providing substitutes to others (see Substitutes).

The (gnu services cuirass) module provides the following service.

Scheme Procedure: cuirass-service-type

The type of the Cuirass service. Its value must be a cuirass-configuration object, as described below.

To add build jobs, you have to set the specifications field of the configuration. Here is an example of a service that polls the Guix repository and builds the packages from a manifest. Some of the packages are defined in the "custom-packages" input, which is the equivalent of GUIX_PACKAGE_PATH.

(define %cuirass-specs
  #~(list
     '((#:name . "my-manifest")
       (#:load-path-inputs . ("guix"))
       (#:package-path-inputs . ("custom-packages"))
       (#:proc-input . "guix")
       (#:proc-file . "build-aux/cuirass/gnu-system.scm")
       (#:proc . cuirass-jobs)
       (#:proc-args . ((subset . "manifests")
                       (systems . ("x86_64-linux"))
                       (manifests . (("config" . "guix/manifest.scm")))))
       (#:inputs . (((#:name . "guix")
                     (#:url . "git://git.savannah.gnu.org/guix.git")
                     (#:load-path . ".")
                     (#:branch . "master")
                     (#:no-compile? . #t))
                    ((#:name . "config")
                     (#:url . "https://git.example.org/config.git")
                     (#:load-path . ".")
                     (#:branch . "master")
                     (#:no-compile? . #t))
                    ((#:name . "custom-packages")
                     (#:url . "https://git.example.org/custom-packages.git")
                     (#:load-path . ".")
                     (#:branch . "master")
                     (#:no-compile? . #t)))))))

(service cuirass-service-type
         (cuirass-configuration
          (specifications %cuirass-specs)))

While information related to build jobs is located directly in the specifications, global settings for the cuirass process are accessible in other cuirass-configuration fields.

Data Type: cuirass-configuration

Data type representing the configuration of Cuirass.

log-file (default: "/var/log/cuirass.log")

Location of the log file.

web-log-file (default: "/var/log/cuirass-web.log")

Location of the log file used by the web interface.

queries-log-file (default: #f)

Location of the SQL queries log file. By default, SQL queries logging is disabled.

web-queries-log-file (default: #f)

Location of the web SQL queries log file. By default, web SQL queries logging is disabled.

cache-directory (default: "/var/cache/cuirass")

Location of the repository cache.

user (default: "cuirass")

Owner of the cuirass process.

group (default: "cuirass")

Owner’s group of the cuirass process.

interval (default: 60)

Number of seconds between the poll of the repositories followed by the Cuirass jobs.

queue-size (default: 1)

Size of the database writer queue.

database (default: "/var/lib/cuirass/cuirass.db")

Location of sqlite database which contains the build results and previously added specifications.

ttl (default: (* 30 24 3600))

Specifies the time-to-live (TTL) in seconds of garbage collector roots that are registered for build results. This means that build results are protected from garbage collection for at least ttl seconds.

port (default: 8081)

Port number used by the HTTP server.

host (default: "localhost")

Listen on the network interface for host. The default is to accept connections from localhost.

specifications (default: #~'())

A gexp (see G-Expressions) that evaluates to a list of specifications, where a specification is an association list (see Associations Lists in GNU Guile Reference Manual) whose keys are keywords (#:keyword-example) as shown in the example above.

use-substitutes? (default: #f)

This allows using substitutes to avoid building every dependencies of a job from source.

one-shot? (default: #f)

Only evaluate specifications and build derivations once.

fallback? (default: #f)

When substituting a pre-built binary fails, fall back to building packages locally.

extra-options (default: '())

Extra options to pass when running the Cuirass processes.

cuirass (default: cuirass)

The Cuirass package to use.

Simple Cuirass

The Cuirass service configuration described above can be a little intimidating. In particular, getting the right specifications can prove difficult. The simple-cuirass-configuration->specs procedure offers a way to generate those specifications and thus setup a continuous integration server more readily.

Scheme Procedure: simple-cuirass-configuration->specs configuration

This procedure takes a simple-cuirass-configuration record as argument and returns the corresponding Cuirass specifications gexp.

Data Type: simple-cuirass-configuration

Data type representing the configuration of a simple Cuirass instance.

build (default: all)

The packages to be built by Cuirass. It defaults to all, which means that all the discovered packages in the subsequent channels field are to be selected.

It is also possible to set this field to a list of build-manifest records, so that only the packages that are part of the declared manifests are built. This record is described below.

Data Type: build-manifest
channel-name

The name of the channel where the manifest is located.

manifest

The manifest path inside the channel.

channels (default: %default-channels)

The channels to be fetched by Cuirass (see Channels).

non-package-channels (default: '())

List the channel names that must not be searched for packages. That is often the case for the channel containing the manifest.

systems (default: (list (%current-system)))

Build every discovered package for each system in this list. By default only the current system is selected.

Here is an example of how to setup a Cuirass instance that builds all the packages declared by Guix and a user repository. The package list is re-evaluated each time a commit is pushed in one of the declared channels.

(service cuirass-service-type
         (cuirass-configuration
          (specifications
           (simple-cuirass-configuration->specs
            (simple-cuirass-configuration
             (build 'all)
             (channels (cons (channel
                              (name 'my-guix)
                              (url "https://my-git-repo/guix.git"))
                             %default-channels)))))))

In the same spirit, this builds all the packages that are part of the guix or my-guix channels and declared in the manifest located in the conf channel.

(service cuirass-service-type
         (cuirass-configuration
          (specifications
           (simple-cuirass-configuration->specs
            (simple-cuirass-configuration
             (build (list
                     (build-manifest
                      (channel-name 'conf)
                      (manifest "guix/manifest.scm"))))
             (channels (cons* (channel
                               (name 'my-guix)
                               (url "https://my-git-repo/guix.git"))
                              (channel
                               (name 'conf)
                               (url "https://my-git-repo/conf.git"))
                              %default-channels))
             (non-package-channels '(conf)))))))

Finally, simple-cuirass-services takes as a second optional argument a cuirass-configuration record. It can be used to customize the configuration of the Cuirass instance.

(simple-cuirass-services
 (simple-cuirass-configuration
  (build 'all)
  (channels (cons (channel
                   (name 'my-guix)
                   (url "https://my-git-repo/guix.git"))
                  %default-channels))
  (non-package-channels '(conf)))
 (cuirass-configuration
  (inherit %default-cuirass-config)
  (host "0.0.0.0"))) ;listen on all interfaces.

Next: , Previous: , Up: Services   [Contents][Index]