Commit Graph

4 Commits (ff6fa7901488a7e25a3e460725ab34a78b7e9b8a)

Author SHA1 Message Date
Dustin 347b5578c3 ci: lib: Skip remount if empty limit pattern
Some playbooks apply only to hosts that do not have read-only root
filesystems.  For these, the `rw_limit` pattern will be empty.  The
*Remount R/W* and *Remount R/O* stages should be skipped when this is
the case.
2021-10-16 10:17:34 -05:00
Dustin 276ac7e5fb Add rw-root group
Some hosts, such as the Raspberry Pis built using default Fedora images,
do not have proper filesystem separation, but use a single volume for
the entire filesystem.  These hosts cannot have the root filesystem
mounted read-only, since all the writable data are also stored there.

When Jenkins runs configuration policy jobs, it always tries to remount
the root filesystem as read-only on every machine that it configured.
For these hosts with a single volume, this step fails, causing the job
to be marked as failed.  To avoid this, I have added a new group,
*rw-root*; hosts in this group will be omitted from the final remount
step.
2020-08-29 08:53:28 -05:00
Dustin 6ebe9b9a20 ci: Always skip tasks tagged "install"
Software should never be installed or updated by the continuous
enforcement jobs.  This can cause unexpected outages or other problems
if applications or libraries unexpectedly.  Everything should already be
installed and in production before continuous enforcement begins, so
skipping install steps should not matter.

Most tasks that install software are tagged with the `install` tag.
When Jenkins runs `ansible-playbook` to apply configuration policy, it
will now skip any task that includes this tag.
2020-07-24 11:56:49 -05:00
Dustin eb4139e0be ci lib: Add applyConfigPolicy pipeline function
The Jenkins pipeline definition files are highly redundant.  Each one
implements almost the same stages, with only a few variations.  Whenever
a new pipeline is added, it's copied from the most recent file and
modified.  If any improvements are made to it, they do not usually get
implemented in any of the existing pipelines.

To address this, the `applyConfigPolicy` pipeline library function is
now available.  This function generates the full pipeline for a
particular application, including stages for setup, each individual
playbook, and cleanup.  Using this function, pipeline files can be as
simple as:

    @Library('cfgpol')_

    applyConfigPolicy(
        'gitea',
        [
            'Gitea': [
                'gitea.yml',
            ],
        ]
    )

This will create a pipeline that mounts the root filesystem read-write
on all hosts in the "gitea" group (any Ansible host pattern is allowed),
applies the `gitea.yml` playbook (in a stage named "Gitea"), and then
remounts the filesystems read-only.

Since this "library" is so simple, containing only a single function in
a single file, and since it will not be used by any pipelines outside
this repository, it makes sense to keep it in this repository, instead
of a separate repository as is customary for Jenkins pipeline shared
libraries.
2020-03-18 11:29:35 -05:00