Puppet Class: gitlab::omnibus_package_repository

Defined in:
manifests/omnibus_package_repository.pp

Summary

This class is used to configure gitlab repositories

Overview

Parameters:

  • repository_configuration (Any) (defaults to: $gitlab::repository_configuration)

    A hash of repository types and attributes for configuraiton the gitlab package repositories. See docs in README.md

  • manage_omnibus_repository (Any) (defaults to: $gitlab::manage_omnibus_repository)

    Set to false if you wish to manage gitlab without configuring the package repository

  • manage_upstream_edition (Any) (defaults to: $gitlab::manage_upstream_edition)

    One of [ ‘ce’, ‘ee’, ‘disabled’ ]. Manage the installation of an upstream Gitlab Omnibus edition to install.



6
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'manifests/omnibus_package_repository.pp', line 6

class gitlab::omnibus_package_repository (
  $repository_configuration = $gitlab::repository_configuration,
  $manage_omnibus_repository = $gitlab::manage_omnibus_repository,
  $manage_upstream_edition = $gitlab::manage_upstream_edition,
) {
  if $manage_omnibus_repository {
    if $gitlab::edition {
      $_edition = $gitlab::edition
      notify { 'gitlab::edition is deprecated':
        message => 'gitlab::edition has been deprecated, use gitlab::manage_upstream_edition instead',
      }
    } else {
      $_edition = $manage_upstream_edition
    }

    if $_edition == 'disabled' {
      $_repository_configuration = $repository_configuration
    } else {
      # if we manage the repositories, adjust the ensure => present/absent
      # attributes according to the desired edition.
      $_repository_configuration = $repository_configuration.reduce ({}) | $_memo, $_pair1 | {
        # yumrepo =>  ...
        [$_rsc_type, $_repo_hash] = $_pair1

        $_mapped_repo_hash = $_repo_hash.reduce ({}) | $_memo, $_pair2 | {
          # gitlab_official_ce => ...
          [$_repo_name, $_repo_attrs,] = $_pair2

          if $_repo_name == "gitlab_official_${_edition}" {
            $_ensure = 'present'
          } else {
            $_ensure = 'absent'
          }

          $_memo + { $_repo_name => $_repo_attrs + { ensure => $_ensure } }
        }

        $_memo + { $_rsc_type => $_mapped_repo_hash }
      }
    }

    # common attributes for all repository configuration resources
    # ensures correct ordering regardless of the number or configuration
    # of repository related resources
    $resource_defaults = {
      tag    => 'gitlab_omnibus_repository_resource',
      before => Class['gitlab::install'],
    }

    # create all the repository resources
    $_repository_configuration.each() | String $resource_type, Hash $resources | {
      if downcase($resource_type) == 'apt::source' {
        Class['Apt::Update'] -> Class['gitlab::install']
      }
      create_resources($resource_type, $resources, $resource_defaults)
    }
  }
}