puppet: Centralize versions and sha256 hashes of external dependencies.

This will make it easier to update versions of these dependencies.

(cherry picked from commit f166f9f7d6)
This commit is contained in:
Alex Vandiver
2021-12-28 02:00:14 +00:00
committed by Tim Abbott
parent cc95aac176
commit 3fad49a9c1
6 changed files with 53 additions and 10 deletions

View File

@@ -6,14 +6,13 @@ class zulip::camo (String $listen_address = '0.0.0.0') {
ensure => 'purged',
}
$version = '2.3.0'
$version = $zulip::common::versions['go-camo']['version']
$dir = "/srv/zulip-go-camo-${version}"
$bin = "${dir}/bin/go-camo"
zulip::external_dep { 'go-camo':
version => $version,
url => "https://github.com/cactus/go-camo/releases/download/v${version}/go-camo-${version}.go1171.linux-amd64.tar.gz",
sha256 => '965506e6edb9d974c810519d71e847afb7ca69d1d01ae7d8be6d7a91de669c0c',
tarball_prefix => "go-camo-${version}",
}

View File

@@ -32,4 +32,37 @@ class zulip::common {
$supervisor_conf_dir = "${supervisor_system_conf_dir}/zulip"
$total_memory_mb = Integer($::memorysize_mb)
$versions = {
# https://github.com/cactus/go-camo/releases
'go-camo' => {
'version' => '2.3.0',
'sha256' => {
'amd64' => '965506e6edb9d974c810519d71e847afb7ca69d1d01ae7d8be6d7a91de669c0c',
},
},
# https://go.dev/dl/
'golang' => {
'version' => '1.17.3',
'sha256' => {
'amd64' => '550f9845451c0c94be679faf116291e7807a8d78b43149f9506c1b15eb89008c',
},
},
# https://github.com/stripe/smokescreen/tags
'smokescreen-src' => {
'version' => 'dc403015f563eadc556a61870c6ad327688abe88',
# Source code, so arch-invariant sha256
'sha256' => 'ad4b181d14adcd9425045152b903a343dbbcfcad3c1e7625d2c65d1d50e1959d',
},
# https://github.com/wal-g/wal-g/releases
'wal-g' => {
'version' => '1.1.1-rc',
'sha256' => {
'amd64' => 'eed4de63c2657add6e0fe70f8c0fbe62a4a54405b9bfc801b1912b6c4f2c7107',
},
},
}
}

View File

@@ -1,15 +1,29 @@
define zulip::external_dep(
String $version,
String $sha256,
String $url,
String $tarball_prefix,
String $sha256 = '',
) {
if $sha256 == '' {
if $zulip::common::versions[$title]['sha256'] =~ Hash {
$sha256_filled = $zulip::common::versions[$title]['sha256'][$::architecture]
if $sha256_filled == undef {
err("No sha256 found for ${title} for architecture ${::architecture}")
fail()
}
} else {
# For things like source code which are arch-invariant
$sha256_filled = $zulip::common::versions[$title]['sha256']
}
} else {
$sha256_filled = $sha256
}
$dir = "/srv/zulip-${title}-${version}"
zulip::sha256_tarball_to { $title:
url => $url,
sha256 => $sha256,
sha256 => $sha256_filled,
install => {
$tarball_prefix => $dir,
},

View File

@@ -1,7 +1,7 @@
# @summary go compiler and tools
#
class zulip::golang {
$version = '1.17.3'
$version = $zulip::common::versions['golang']['version']
$dir = "/srv/zulip-golang-${version}"
$bin = "${dir}/bin/go"
@@ -9,7 +9,6 @@ class zulip::golang {
zulip::external_dep { 'golang':
version => $version,
url => "https://golang.org/dl/go${version}.linux-amd64.tar.gz",
sha256 => '550f9845451c0c94be679faf116291e7807a8d78b43149f9506c1b15eb89008c',
tarball_prefix => 'go',
}
}

View File

@@ -3,7 +3,7 @@
class zulip::postgresql_backups {
include zulip::postgresql_common
$wal_g_version = '1.1.1-rc'
$wal_g_version = $zulip::common::versions['wal-g']['version']
$bin = "/srv/zulip-wal-g-${wal_g_version}"
$package = "wal-g-pg-ubuntu-20.04-${::architecture}"
@@ -11,7 +11,6 @@ class zulip::postgresql_backups {
zulip::external_dep { 'wal-g':
version => $wal_g_version,
url => "https://github.com/wal-g/wal-g/releases/download/v${wal_g_version}/${package}.tar.gz",
sha256 => 'eed4de63c2657add6e0fe70f8c0fbe62a4a54405b9bfc801b1912b6c4f2c7107',
tarball_prefix => $package,
}
file { '/usr/local/bin/wal-g':

View File

@@ -2,14 +2,13 @@ class zulip::smokescreen {
include zulip::supervisor
include zulip::golang
$version = 'dc403015f563eadc556a61870c6ad327688abe88'
$version = $zulip::common::versions['smokescreen-src']['version']
$dir = "/srv/zulip-smokescreen-src-${version}"
$bin = "/usr/local/bin/smokescreen-${version}-go-${zulip::golang::version}"
zulip::external_dep { 'smokescreen-src':
version => $version,
url => "https://github.com/stripe/smokescreen/archive/${version}.tar.gz",
sha256 => 'ad4b181d14adcd9425045152b903a343dbbcfcad3c1e7625d2c65d1d50e1959d',
tarball_prefix => "smokescreen-${version}",
}