From 6f3d8c810ff5694407e1bcfe6e76dd6045a5bf0c Mon Sep 17 00:00:00 2001 From: Alexandre Menasria <47357713+amenasria@users.noreply.github.com> Date: Fri, 14 Jun 2024 15:23:12 +0200 Subject: [PATCH] [CI] Add the dotnet linter to our Gitlab CI (#26611) --- .gitlab-ci.yml | 10 +++++----- tasks/winbuildscripts/lint.ps1 | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 42970b4eb8e1b..ddecc0538efca 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -164,15 +164,15 @@ variables: # To use images from datadog-agent-buildimages dev branches, set the corresponding # SUFFIX variable to _test_only DATADOG_AGENT_BUILDIMAGES_SUFFIX: "" - DATADOG_AGENT_BUILDIMAGES: v35901572-a9447181 + DATADOG_AGENT_BUILDIMAGES: v36675054-482032aa DATADOG_AGENT_WINBUILDIMAGES_SUFFIX: "" - DATADOG_AGENT_WINBUILDIMAGES: v35901572-a9447181 + DATADOG_AGENT_WINBUILDIMAGES: v36675054-482032aa DATADOG_AGENT_ARMBUILDIMAGES_SUFFIX: "" - DATADOG_AGENT_ARMBUILDIMAGES: v35901572-a9447181 + DATADOG_AGENT_ARMBUILDIMAGES: v36675054-482032aa DATADOG_AGENT_SYSPROBE_BUILDIMAGES_SUFFIX: "" - DATADOG_AGENT_SYSPROBE_BUILDIMAGES: v35901572-a9447181 + DATADOG_AGENT_SYSPROBE_BUILDIMAGES: v36675054-482032aa DATADOG_AGENT_BTF_GEN_BUILDIMAGES_SUFFIX: "" - DATADOG_AGENT_BTF_GEN_BUILDIMAGES: v35901572-a9447181 + DATADOG_AGENT_BTF_GEN_BUILDIMAGES: v36675054-482032aa DATADOG_AGENT_EMBEDDED_PATH: /opt/datadog-agent/embedded DEB_GPG_KEY_ID: c0962c7d diff --git a/tasks/winbuildscripts/lint.ps1 b/tasks/winbuildscripts/lint.ps1 index 5c11055308c99..fbc3e8ed54d3e 100644 --- a/tasks/winbuildscripts/lint.ps1 +++ b/tasks/winbuildscripts/lint.ps1 @@ -20,11 +20,23 @@ if($err -ne 0){ } & inv -e install-tools -& inv -e linter.go +& inv -e linter.go $err = $LASTEXITCODE -Write-Host Lint result is $err +Write-Host Go linter result is $err if($err -ne 0){ - Write-Host -ForegroundColor Red "lint failed $err" + Write-Host -ForegroundColor Red "go linter failed $err" [Environment]::Exit($err) } + +$timeTaken = Measure-Command { + & dotnet format --verify-no-changes .\\tools\\windows\\DatadogAgentInstaller + $err = $LASTEXITCODE + Write-Host Dotnet linter result is $err + if($err -ne 0){ + Write-Host -ForegroundColor Red "dotnet linter failed $err" + [Environment]::Exit($err) + } +} + +Write-Host "Dotnet linter run time: $($timeTaken.TotalSeconds) seconds"