Skip to content

Commit

Permalink
Move the Nuke arguments into the gitlab file (#6611)
Browse files Browse the repository at this point in the history
## Summary of changes

Allow specifying the Nuke targets to run in the gitlab file

## Reason for change

Currently they're baked into the build image. That means if we need to
change the args, we need to build a whole new image

## Implementation details

Pass the arguments as commands in the `docker run` call. These get
passed as arguments to the `entrypoint.bat` script. The script then
reads the args and splats them into the Nuke call.

## Test coverage

I've tested the splatting, but an end-to-end test requires rebuilding
the image. The good news is that this change works with the old image
(it's a no-op) so it's safe to merge anyway.

## Other details

That docker line was getting a bit hefty, so split it for "readability"
  • Loading branch information
andrewlock authored Jan 31, 2025
1 parent 80f33bc commit 642f1cb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
12 changes: 11 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,17 @@ build:
script:
- if (Test-Path build-out) { remove-item -recurse -force build-out }
- if (Test-Path artifacts-out) { remove-item -recurse -force artifacts-out }
- docker run --rm -m 8192M -v "$(Get-Location):c:\mnt" -e CI_JOB_ID=${CI_JOB_ID} -e ENABLE_MULTIPROCESSOR_COMPILATION=false -e WINDOWS_BUILDER=true -e AWS_NETWORKING=true -e SIGN_WINDOWS=true -e NUGET_CERT_REVOCATION_MODE=offline datadog/dd-trace-dotnet-docker-build:9-0-102
- |
docker run --rm -m 8192M `
-v "$(Get-Location):c:\mnt" `
-e CI_JOB_ID=${CI_JOB_ID} `
-e ENABLE_MULTIPROCESSOR_COMPILATION=false `
-e WINDOWS_BUILDER=true `
-e AWS_NETWORKING=true `
-e SIGN_WINDOWS=true `
-e NUGET_CERT_REVOCATION_MODE=offline `
datadog/dd-trace-dotnet-docker-build:9-0-102 `
Info Clean BuildTracerHome BuildProfilerHome BuildNativeLoader BuildDdDotnet PackageTracerHome ZipSymbols SignDlls SignMsi
- mkdir artifacts-out
- xcopy /e/s build-out\${CI_JOB_ID}\*.* artifacts-out
- remove-item -recurse -force build-out\${CI_JOB_ID}
Expand Down
10 changes: 9 additions & 1 deletion tracer/build/_build/docker/gitlab/entrypoint.bat
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ cd c:\mnt\
mklink /d dd-trace-dotnet C:\mnt
mklink /d _build C:\_build

dotnet run --project tracer/build/_build/_build.csproj -- Info Clean BuildTracerHome BuildProfilerHome BuildNativeLoader BuildDdDotnet PackageTracerHome ZipSymbols SignDlls SignMsi --Artifacts "build-out\%CI_JOB_ID%"
:: Check if Nuke arguments were provided, if not, fail
set "nuke_args=%*"

if "%nuke_args%"=="" (
echo ERROR: No nuke arguments provided!
exit /b 1
)

dotnet run --project tracer/build/_build/_build.csproj -- %nuke_args% --Artifacts "build-out\%CI_JOB_ID%"

IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%

Expand Down
4 changes: 2 additions & 2 deletions tracer/build/_build/docker/gitlab/gitlab.windows.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ RUN powershell -Command .\install_wix.ps1 -Version $ENV:WIX_VERSION -Sha256 $ENV
# Install .NET 9
# To find these links, visit https://dotnet.microsoft.com/en-us/download, click the Windows, x64 installer, and grab the download url + SHA512 hash
ENV DOTNET_VERSION="9.0.102" \
DOTNET_DOWNLOAD_URL="https://download.visualstudio.microsoft.com/download/pr/10bb041d-e705-473e-9654-27c0e038f5bd/447c0c10654c2949872fa6154b8c27b5/dotnet-sdk-9.0.102-win-x64.exe" \
DOTNET_SHA512="a12ee028f7dff8f330dbe1914534d237eb6e19cc105139ce5de69df1b4b07ee3c1a3e396574ca776a452e805052e799df14a348ace50191af514c9dc4705ecf0"
DOTNET_DOWNLOAD_URL="https://download.visualstudio.microsoft.com/download/pr/5f46239c-783c-4d49-a4a2-cd5b0a47ec51/9b72af54efd90a3874b63e4dd43855e7/dotnet-sdk-9.0.102-win-x64.exe" \
DOTNET_SHA512="91505782b13937392bd73d1531c01807275ef476f9e37f8ef22c2cee4b19be8282207149b4eb958668dee0c05cef02b0a6bc375b71e8e94864c3d89dea7ba534"

COPY install_dotnet.ps1 .
RUN powershell -Command .\install_dotnet.ps1 -Version $ENV:DOTNET_VERSION -Sha512 $ENV:DOTNET_SHA512 $ENV:DOTNET_DOWNLOAD_URL
Expand Down

0 comments on commit 642f1cb

Please sign in to comment.