Skip to content

Commit

Permalink
move DD_GO_TOOLCHAIN into omnibus
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkb7 committed Dec 2, 2024
1 parent ac77f9c commit 0e6d336
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 26 deletions.
2 changes: 0 additions & 2 deletions .gitlab/package_build/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
-e BUNDLE_MIRROR__RUBYGEMS__ORG=${BUNDLE_MIRROR__RUBYGEMS__ORG}
-e PIP_INDEX_URL=${PIP_INDEX_URL}
-e API_KEY_ORG2=${API_KEY_ORG2}
-e DD_GO_TOOLCHAIN=${DD_GO_TOOLCHAIN}
-e AGENT_FLAVOR=${AGENT_FLAVOR}
registry.ddbuild.io/ci/datadog-agent-buildimages/windows_1809_${ARCH}${Env:DATADOG_AGENT_WINBUILDIMAGES_SUFFIX}:${Env:DATADOG_AGENT_WINBUILDIMAGES}
c:\mnt\tasks\winbuildscripts\buildwin.bat
Expand Down Expand Up @@ -74,7 +73,6 @@ windows_msi_and_bosh_zip_x64-a7-fips:
variables:
ARCH: "x64"
AGENT_FLAVOR: fips
DD_GO_TOOLCHAIN: msgo
before_script:
- set RELEASE_VERSION $RELEASE_VERSION_7
timeout: 2h
Expand Down
18 changes: 14 additions & 4 deletions omnibus/config/software/datadog-agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

# set GOPATH on the omnibus source dir for this software
gopath = Pathname.new(project_dir) + '../../../..'
msgoroot = "/usr/local/msgo"
flavor_arg = ENV['AGENT_FLAVOR']
fips_args = fips_mode? ? "--fips-mode" : ""
if windows_target?
Expand Down Expand Up @@ -62,9 +61,20 @@
env = with_standard_compiler_flags(with_embedded_path(env))

# Use msgo toolchain when fips mode is enabled
if fips_mode? && !windows_target?
env["GOROOT"] = msgoroot
env["PATH"] = "#{msgoroot}/bin:#{env['PATH']}"
if fips_mode?
if windows_target?
go_version = ENV['GO_VERSION'] || File.read('.go-version').strip
if go_version.empty?
raise "GO_VERSION is not set and .go-version file is not present"
end
msgoroot = "C:\\msgo\\#{go_version}\\go"
env["GOROOT"] = msgoroot
env["PATH"] = "#{msgoroot}\\bin;#{env['PATH']}"
else
msgoroot = "/usr/local/msgo"
env["GOROOT"] = msgoroot
env["PATH"] = "#{msgoroot}/bin:#{env['PATH']}"
end
end

# we assume the go deps are already installed before running omnibus
Expand Down
20 changes: 0 additions & 20 deletions tasks/winbuildscripts/dobuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,8 @@ set REPO_ROOT=%~p0\..\..
pushd .
cd %REPO_ROOT% || exit /b 100

REM Read .go-version file to get the default go version
if NOT DEFINED GO_VERSION set /p GO_VERSION=<.go-version
REM Set the GOPATH based on DD_GO_TOOLCHAIN
if "%DD_GO_TOOLCHAIN%" == "msgo" (
set GOROOT=C:\msgo\%GO_VERSION%\go
)
if DEFINED GOROOT (
if NOT EXIST %GOROOT%\bin\go.exe (
echo go.exe not found in %GOROOT%
exit /b 110
)
) else (
goto goroot_path_set
)
REM Use label to avoid improper expansion of PATH in IF block
REM Put at front of path to take precedence over other go installations
SET PATH=%GOROOT%\bin;%PATH%
:goroot_path_set

SET PATH=%PATH%;%GOPATH%\bin

@echo GOROOT %GOROOT%
@echo GOPATH %GOPATH%
@echo PATH %PATH%
@echo VSTUDIO_ROOT %VSTUDIO_ROOT%
Expand Down

0 comments on commit 0e6d336

Please sign in to comment.