wal-g: Use pre-built aarch64 binary, rather than building from source.

Starting with wal-g 2.0.1, they provide `aarch64` assets[^1].
Effectively revert d7b59c86ce, and use
the pre-built binary for `aarch64` rather than spend a bunch of space
and time having to build it from source.

[^1]: https://github.com/wal-g/wal-g/releases/tag/v2.0.1
This commit is contained in:
Alex Vandiver 2022-11-29 21:51:13 -05:00 committed by Alex Vandiver
parent 8f6f38c97c
commit 89f20140c0
3 changed files with 13 additions and 83 deletions

View File

@ -76,13 +76,11 @@ class zulip::common {
# https://github.com/wal-g/wal-g/releases
'wal-g' => {
'version' => '2.0.1',
'sha256' => {
'amd64' => '2640cb9110e802bf971efdc9b7a35515af7757e06693bf5c81bd4915d8d42b9c',
# aarch64 builds from source, below
'version' => '2.0.1',
'sha256' => {
'amd64' => '2640cb9110e802bf971efdc9b7a35515af7757e06693bf5c81bd4915d8d42b9c',
'aarch64' => '9782bd6f4f08ec26d0f2f5f8fd8f9531e4fe39f14ef5f764cbec08e93da2bbcc',
},
# This is a Git commit hash, not a sha256sum, for when building from source.
'git_commit_id' => 'b7d53dd74d92dd92dce224190361ad0607d680e2',
},
### zulip_ops packages

View File

@ -2,52 +2,19 @@
#
class zulip::wal_g {
$wal_g_version = $zulip::common::versions['wal-g']['version']
$wal_g_binary_hash = $zulip::common::versions['wal-g']['sha256'][$::os['architecture']]
$wal_g_commit_id = $zulip::common::versions['wal-g']['git_commit_id']
$bin = "/srv/zulip-wal-g-${wal_g_version}"
if $wal_g_binary_hash != undef {
# We have a binary for this arch
$package = "wal-g-pg-ubuntu-20.04-${zulip::common::goarch}"
# This tarball contains only a single file, which is extracted as $bin
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",
tarball_prefix => $package,
before => File['/usr/local/bin/wal-g'],
}
} else {
include zulip::golang
$source_dir = "/srv/zulip-wal-g-src-${wal_g_version}"
exec { 'clone wal-g':
command => "git clone https://github.com/wal-g/wal-g.git --branch v${wal_g_version} ${source_dir}",
cwd => '/srv',
creates => $source_dir,
require => Package['git'],
}
exec { 'compile wal-g':
command => "${::zulip_scripts_path}/lib/build-wal-g ${wal_g_version} ${wal_g_commit_id}",
environment => ["GOBIN=${zulip::golang::dir}/bin"],
cwd => $source_dir,
creates => $bin,
require => [
Zulip::External_Dep['golang'],
Exec['clone wal-g'],
],
timeout => 600,
before => File['/usr/local/bin/wal-g'],
}
tidy { '/srv/zulip-wal-g-*':
path => '/srv/',
recurse => 1,
rmdirs => true,
matches => 'zulip-wal-g-*',
require => Exec['compile wal-g'],
}
$package = "wal-g-pg-ubuntu-20.04-${zulip::common::goarch}"
# This tarball contains only a single file, which is extracted as $bin
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",
tarball_prefix => $package,
}
file { '/usr/local/bin/wal-g':
ensure => link,
target => $bin,
ensure => link,
target => $bin,
require => Zulip::External_Dep['wal-g'],
}
# We used to install versions into /usr/local/bin/wal-g-VERSION,
# until we moved to using Zulip::External_Dep which places them in

View File

@ -1,35 +0,0 @@
#!/usr/bin/env bash
set -eux
apt-get install -y \
liblzo2-dev \
libbrotli-dev \
libsodium-dev \
build-essential \
gcc \
cmake \
libc-dev
tmpdir="$(mktemp -d)"
trap 'rm -r "$tmpdir"' EXIT
export GOCACHE="$tmpdir/cache"
export GOPATH="$tmpdir/build"
src_dir="/srv/zulip-wal-g-src-$1"
dst="/srv/zulip-wal-g-$1"
cd "$src_dir"
if [ "$(git rev-parse HEAD)" != "$2" ]; then
echo "Commit tag has changed; expected $2, got $(git rev-parse HEAD)"
exit 1
fi
export PATH="$PATH:$GOBIN"
export USE_LZO=1
export USE_LIBSODIUM=1
make deps pg_build
mv "main/pg/wal-g" "$dst"