puppet: Factor out golang variables.

(cherry picked from commit 93af6c7f06)
This commit is contained in:
Alex Vandiver
2021-11-17 11:21:39 -08:00
parent f01cbba0ce
commit 11924f4b66
2 changed files with 7 additions and 3 deletions

View File

@@ -2,17 +2,21 @@
# #
class zulip::golang { class zulip::golang {
$version = '1.17.3' $version = '1.17.3'
$dir = "/srv/golang-${version}/"
$bin = '/srv/golang/bin/go'
zulip::sha256_tarball_to { 'golang': zulip::sha256_tarball_to { 'golang':
url => "https://golang.org/dl/go${version}.linux-amd64.tar.gz", url => "https://golang.org/dl/go${version}.linux-amd64.tar.gz",
sha256 => '550f9845451c0c94be679faf116291e7807a8d78b43149f9506c1b15eb89008c', sha256 => '550f9845451c0c94be679faf116291e7807a8d78b43149f9506c1b15eb89008c',
install => { install => {
'go/' => "/srv/golang-${version}/", 'go/' => $dir,
}, },
} }
file { '/srv/golang': file { '/srv/golang':
ensure => 'link', ensure => 'link',
target => "/srv/golang-${version}/", target => $dir,
require => Zulip::Sha256_tarball_to['golang'], require => Zulip::Sha256_tarball_to['golang'],
} }
} }

View File

@@ -14,7 +14,7 @@ class zulip::profile::smokescreen {
}, },
} }
exec { 'compile smokescreen': exec { 'compile smokescreen':
command => "/srv/golang/bin/go build -o /usr/local/bin/smokescreen-${version}", command => "${zulip::golang::bin} build -o /usr/local/bin/smokescreen-${version}",
cwd => "/srv/smokescreen-src-${version}/", cwd => "/srv/smokescreen-src-${version}/",
# GOCACHE is required; nothing is written to GOPATH, but it is required to be set # GOCACHE is required; nothing is written to GOPATH, but it is required to be set
environment => ['GOCACHE=/tmp/gocache', 'GOPATH=/root/go'], environment => ['GOCACHE=/tmp/gocache', 'GOPATH=/root/go'],