Skip to content
Snippets Groups Projects
Commit 5d1d43af20db authored by Clemens Beck's avatar Clemens Beck
Browse files

Go builds: Use local toolchain

Use the local Go toolchain (the Go version included in the Omnibus
builder images) for all Go builds. This prevents us from
accidentally building Go binaries with another Go version.

Go toolchain documentation: https://go.dev/doc/toolchain
parent 099c6d270b7d
No related branches found
No related tags found
3 merge requests!128heptapod#1534: making 1.5 the oldstable,!125heptapod#1494: make 1.5 the new stable,!123Omnibus GitLab for upstream 16.10
......@@ -38,6 +38,7 @@
env = {
'GOPATH' => "#{Omnibus::Config.source_dir}/alertmanager",
'GO111MODULE' => 'on',
'GOTOOLCHAIN' => 'local',
}
exporter_source_dir = "#{Omnibus::Config.source_dir}/alertmanager"
cwd = "#{exporter_source_dir}/src/#{go_source}"
......
......@@ -33,4 +33,5 @@
build do
env = {}
env['GOPATH'] = "#{Omnibus::Config.source_dir}/consul"
env['GOTOOLCHAIN'] = 'local'
env['PATH'] = "#{Gitlab::Util.get_env('PATH')}:#{env['GOPATH']}/bin"
......@@ -36,4 +37,5 @@
env['PATH'] = "#{Gitlab::Util.get_env('PATH')}:#{env['GOPATH']}/bin"
command 'make dev', env: env
mkdir "#{install_dir}/embedded/bin"
copy 'bin/consul', "#{install_dir}/embedded/bin/"
......
......@@ -29,7 +29,10 @@
relative_path 'src/gitlab.com/gitlab-org/docker-distribution-pruner'
build do
env = { 'GOPATH' => "#{Omnibus::Config.source_dir}/docker-distribution-pruner" }
env = {
'GOPATH' => "#{Omnibus::Config.source_dir}/docker-distribution-pruner",
'GOTOOLCHAIN' => 'local',
}
command "go build -ldflags '-s -w' ./cmds/docker-distribution-pruner", env: env
......
......@@ -29,9 +29,12 @@
relative_path 'src/gitlab.com/gitlab-org/gitlab-pages'
build do
# This is required for GO15VENDOREXPERIMENT=1 to work properly,
# since it requires the package to be in $GOPATH/src/package
env = { 'GOPATH' => "#{Omnibus::Config.source_dir}/gitlab-pages" }
env = {
# This is required for GO15VENDOREXPERIMENT=1 to work properly,
# since it requires the package to be in $GOPATH/src/package
'GOPATH' => "#{Omnibus::Config.source_dir}/gitlab-pages",
'GOTOOLCHAIN' => 'local',
}
# Pages compiles with CGO_ENABLED=0 by default, so we need to activate
# FIPS mode explicitly.
......
......@@ -28,6 +28,7 @@
build do
env = {
'GOPATH' => "#{Omnibus::Config.source_dir}/go-crond",
'GOTOOLCHAIN' => 'local',
}
make 'build', env: env
......
......@@ -37,6 +37,7 @@
'GOPATH' => "#{Omnibus::Config.source_dir}/node-exporter",
'CGO_ENABLED' => '0', # Details: https://github.com/prometheus/node_exporter/issues/870
'GO111MODULE' => 'on',
'GOTOOLCHAIN' => 'local',
}
prom_version = Prometheus::VersionFlags.new(version)
......
......@@ -37,6 +37,7 @@
env = {
'GOPATH' => "#{Omnibus::Config.source_dir}/pgbouncer-exporter",
'GO111MODULE' => 'on',
'GOTOOLCHAIN' => 'local',
}
prom_version = Prometheus::VersionFlags.new(version)
......
......@@ -34,6 +34,7 @@
build do
env = {
'GOPATH' => "#{Omnibus::Config.source_dir}/postgres-exporter",
'GOTOOLCHAIN' => 'local',
}
prom_version = Prometheus::VersionFlags.new(version)
......
......@@ -39,6 +39,7 @@
env = {
'GOPATH' => prometheus_source_dir,
'GO111MODULE' => 'on',
'GOTOOLCHAIN' => 'local',
}
prom_version = Prometheus::VersionFlags.new(version)
......
......@@ -34,6 +34,7 @@
env = {
'GOPATH' => "#{Omnibus::Config.source_dir}/redis-exporter",
'GO111MODULE' => 'on',
'GOTOOLCHAIN' => 'local',
}
ldflags = [
......
......@@ -36,7 +36,8 @@
cwd = "#{registry_source_dir}/#{relative_path}"
env = {
'GOPATH' => registry_source_dir,
'BUILDTAGS' => 'include_gcs include_oss'
'BUILDTAGS' => 'include_gcs include_oss',
'GOTOOLCHAIN' => 'local',
}
make "build", env: env, cwd: cwd
......
......@@ -34,6 +34,7 @@
env = with_standard_compiler_flags(with_embedded_path)
env['GOPATH'] = "#{Omnibus::Config.source_dir}/spamcheck"
env['PATH'] = "#{env['PATH']}:#{env['GOPATH']}/bin"
env['GOTOOLCHAIN'] = 'local'
mkdir "#{install_dir}/embedded/service"
mkdir "#{install_dir}/embedded/bin"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment