HomePhabricator
Diffusion Scap 33524a3df44c

Execute checks after each stage of deployment

Description

Execute checks after each stage of deployment

Summary:
Checks are loaded in main.DeployLocal from YAML configuration under
the scap deploy subdirectory and run following execution of each stage.

Configuration takes the following form, where type is the type of
check to perform ('command' by default), command is a program (and its
arguments) that exits with non-zero status to signal check failure, and
stage is one of the main.DeployLocal stages for which the check will
execute.

checks:
  unique_check_name:
    type: command
    command: /path/to/command --with arguments
    stage: promote

New check types can be implemented by subclassing the checks.Check
class and registered for use in configuration via the
checks.checktype decorator. Validation can be added by implementing a
validate method.

@checks.checktype('icinga')
class IcingaCheck(checks.Check):
    def validate(self):
        # get/validate Icinga command

Checks are executed in parallel following the dispatch of a
main.DeployLocal stage. Any failed check should result in a rollback
prompt in main.Deploy.

The explicit check stage has been removed and the service port probe
has been moved to promote to ensure that the service has started
before executing checks.

Test Plan:
Run tox.

Bug: T109515
Change-Id: Ia0118f766f51ddd05ae04fde90f40e5fdc04825f

Reviewers: demon, mmodell, mobrovac, thcipriani

Reviewed By: mmodell, thcipriani

Maniphest Tasks: T109515

Differential Revision: https://phabricator.wikimedia.org/D11