Defined Type: profile::docker::reporter::report

Defined in:
modules/profile/manifests/docker/reporter/report.pp

Summary

create systemtd timer to generate docker reports

Overview

SPDX-License-Identifier: Apache-2.0

Parameters:

  • ensure (Wmflib::Ensure) (defaults to: 'present')

    ensurable parameter

  • frequency (Enum['daily', 'weekly']) (defaults to: 'weekly')

    either daily or weekly to indicate how often the timer should run

  • proxy (Optional[Stdlib::HTTPUrl]) (defaults to: undef)

    the http proxy to use, if any

  • team (Optional[Wmflib::Team]) (defaults to: undef)
  • min_debian_version (Integer) (defaults to: 11)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'modules/profile/manifests/docker/reporter/report.pp', line 7

define profile::docker::reporter::report(
    Wmflib::Ensure            $ensure             = 'present',
    Enum['daily', 'weekly']   $frequency          = 'weekly',
    Optional[Stdlib::HTTPUrl] $proxy              = undef,
    Optional[Wmflib::Team]    $team               = undef,
    Integer                   $min_debian_version = 11,
) {
    file { "/etc/docker-report/${title}_rules.ini":
        ensure => $ensure,
        owner  => 'root',
        group  => 'root',
        source => "puppet:///modules/profile/docker/reporter/${title}_rules.ini",
    }
    $hour = sprintf('%02d', fqdn_rand(24, $title))
    $environment = $proxy.then |$p| {{'http_proxy' => $p}}

    $interval = $frequency ? {
        'daily' => "*-*-* ${hour}:00:00",
        'weekly' => "Mon *-*-* ${hour}:00:00"
    }
    systemd::timer::job { "docker-reporter-${title}-images":
        ensure            => $ensure,
        description       => "Report on upgrades to ${title} images.",
        command           => "/usr/bin/docker-report --minimum-debian-version ${min_debian_version} --filter-file /etc/docker-report/${title}_rules.ini docker-registry.wikimedia.org",
        interval          => {'start' => 'OnCalendar', 'interval' => $interval},
        user              => 'root',
        environment       => $environment,
        syslog_identifier => "docker-report-${title}",
        team              => $team,
    }
}