Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unused choco related files #32310

Merged
merged 3 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@
/.gitlab/powershell_script_deploy @DataDog/agent-delivery @DataDog/windows-agent

/.gitlab/choco_build/choco_build.yml @DataDog/agent-delivery @DataDog/windows-agent
/.gitlab/choco_deploy/choco_deploy.yml @DataDog/agent-delivery @DataDog/windows-agent

/.gitlab/integration_test/windows.yml @DataDog/agent-devx-infra @DataDog/windows-agent

Expand Down
3 changes: 1 addition & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ include:
- .gitlab/check_deploy/check_deploy.yml
- .gitlab/check_merge/do_not_merge.yml
- .gitlab/choco_build/choco_build.yml
- .gitlab/choco_deploy/choco_deploy.yml
- .gitlab/powershell_script_signing/powershell_script_signing.yml
- .gitlab/powershell_script_deploy/powershell_script_deploy.yml
- .gitlab/common/shared.yml
Expand Down Expand Up @@ -86,7 +85,7 @@ stages:
- deploy_dca
- choco_and_install_script_build
- trigger_release
- choco_and_install_script_deploy
- install_script_deploy
- internal_image_deploy
- e2e_deploy
- install_script_testing
Expand Down
1 change: 0 additions & 1 deletion .gitlab/.ci-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ job-owners:
- new-e2e-unit-tests
- ot_agent_deb-arm64-a7
- ot_agent_deb-x64-a7
- publish_choco_7_x64
- publish_fakeintake
- publish_fakeintake_latest
- rc_kubernetes_deploy
Expand Down
46 changes: 7 additions & 39 deletions .gitlab/choco_build/choco_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,8 @@
# choco_build stage
# Contains jobs which build the chocolatey Agent package.

# Not currently used in the pipeline.
windows_choco_offline_7_x64:
rules:
!reference [.manual]
stage: choco_and_install_script_build
tags: ["runner:windows-docker", "windowsversion:1809"]
needs: ["windows_msi_and_bosh_zip_x64-a7"]
variables:
ARCH: "x64"
script:
- $ErrorActionPreference = "Stop"
- Get-ChildItem omnibus\pkg
- copy omnibus\pkg\*.msi .\chocolatey\datadog-agent\offline\tools\
- >
docker run --rm
-v "$(Get-Location):c:\mnt"
-e AWS_NETWORKING=true
registry.ddbuild.io/ci/datadog-agent-buildimages/windows_1809_${ARCH}${Env:DATADOG_AGENT_WINBUILDIMAGES_SUFFIX}:${Env:DATADOG_AGENT_WINBUILDIMAGES}
powershell.exe -C "C:\mnt\tasks\winbuildscripts\Generate-Chocolatey-Package.ps1 -InstallMethod offline -Flavor $FLAVOR -InstallDeps 1"
- If ($lastExitCode -ne "0") { throw "Previous command returned $lastExitCode" }
- copy build-out\*.nupkg omnibus\pkg
artifacts:
expire_in: 2 weeks
paths:
- omnibus/pkg

# The online version of the choco job gets the msi package through the gitlab artifacts
.windows_choco_online_7_x64:
# The choco job gets the msi package through the gitlab artifacts
.windows_choco_7_x64:
rules:
!reference [.on_deploy_stable_or_beta_repo_branch]
stage: choco_and_install_script_build
Expand All @@ -39,11 +13,7 @@ windows_choco_offline_7_x64:
script:
- '$_instance_id = (iwr -UseBasicParsing http://169.254.169.254/latest/meta-data/instance-id).content ; Write-Host "Running on instance $($_instance_id)"'
- $ErrorActionPreference = "Stop"
- mkdir temp\
- copy omnibus\pkg\*.msi temp\
- if (Test-Path omnibus) { remove-item -recurse -force omnibus }
- if (Test-Path build-out) { remove-item -recurse -force build-out }
- mkdir omnibus\pkg
- >
docker run --rm
-v "$(Get-Location):c:\mnt"
Expand All @@ -52,10 +22,8 @@ windows_choco_offline_7_x64:
-e BUCKET_BRANCH="$BUCKET_BRANCH"
-e AWS_NETWORKING=true
registry.ddbuild.io/ci/datadog-agent-buildimages/windows_1809_${ARCH}${Env:DATADOG_AGENT_WINBUILDIMAGES_SUFFIX}:${Env:DATADOG_AGENT_WINBUILDIMAGES}
powershell.exe -C "C:\mnt\tasks\winbuildscripts\Generate-Chocolatey-Package.ps1 -InstallMethod online -MSIDirectory c:\mnt\temp -Flavor $FLAVOR -InstallDeps 1"
powershell.exe -C "C:\mnt\tasks\winbuildscripts\Generate-Chocolatey-Package.ps1 -MSIDirectory c:\mnt\omnibus\pkg -Flavor $FLAVOR -InstallDeps 1"
- If ($lastExitCode -ne "0") { throw "Previous command returned $lastExitCode" }
- Remove-Item -Path "temp\" -Recurse -Force
- copy build-out\*.nupkg omnibus\pkg
- $CopyNupkgToS3 = "$S3_CP_CMD --recursive --exclude '*' --include '*.nupkg' build-out $S3_RELEASE_ARTIFACTS_URI/choco/nupkg"
- Invoke-Expression $CopyNupkgToS3
artifacts:
Expand All @@ -65,8 +33,8 @@ windows_choco_offline_7_x64:
# Sometimes Chocolatey is flakey
retry: 2

windows_choco_online_7_x64:
extends: .windows_choco_online_7_x64
windows_choco_7_x64:
extends: .windows_choco_7_x64
# On dev/PR branches:
# - if the job is run manually it will create a package, but before the
# package can be installed, the deploy_windows_testing-a7 job must
Expand All @@ -75,8 +43,8 @@ windows_choco_online_7_x64:
variables:
FLAVOR: "datadog-agent"

windows_choco_online_7_x64-fips:
extends: .windows_choco_online_7_x64
windows_choco_7_x64-fips:
extends: .windows_choco_7_x64
# On dev/PR branches:
# - if the job is run manually it will create a package, but before the
# package can be installed, the deploy_windows_testing-a7-fips job must
Expand Down
32 changes: 0 additions & 32 deletions .gitlab/choco_deploy/choco_deploy.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
powershell_script_deploy:
image: registry.ddbuild.io/ci/datadog-agent-buildimages/gitlab_agent_deploy$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES
tags: ["arch:amd64"]
stage: choco_and_install_script_deploy
stage: install_script_deploy
rules:
!reference [.manual]
needs: ["powershell_script_signing"]
Expand All @@ -19,7 +19,7 @@ powershell_script_deploy:
windows_bootstrapper_deploy:
image: registry.ddbuild.io/ci/datadog-agent-buildimages/gitlab_agent_deploy$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES
tags: ["arch:amd64"]
stage: choco_and_install_script_deploy
stage: install_script_deploy
rules:
!reference [.manual]
needs: ["windows-installer-amd64"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>datadog-agent</id>
Expand Down
31 changes: 0 additions & 31 deletions chocolatey/datadog-agent/offline/datadog-agent-offline.nuspec

This file was deleted.

29 changes: 0 additions & 29 deletions chocolatey/datadog-agent/offline/tools/chocolateyinstall.ps1

This file was deleted.

5 changes: 0 additions & 5 deletions chocolatey/datadog-agent/online/tools/VERIFICATION.txt

This file was deleted.

86 changes: 34 additions & 52 deletions tasks/winbuildscripts/Generate-Chocolatey-Package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
.SYNOPSIS
Generates a Chocolatey package for the Datadog Agent.

.PARAMETER installMethod
Specifies the installation method. Valid values are "offline" and "online". This parameter is mandatory.

.PARAMETER msiDirectory
Specifies the directory containing the MSI file that will be used to calculate the checksum. This parameter is mandatory when the installMethod is "online".
Specifies the directory containing the MSI file that will be used to calculate the checksum.

.PARAMETER Flavor
Specifies the flavor of the Datadog Agent. The default value is "datadog-agent".
Expand All @@ -18,23 +15,18 @@ Overrides the Agent version when building packages locally for testing.
Indicates whether to install dependencies. The default value is $true.

.EXAMPLE
.\Generate-Chocolatey-Package.ps1 -installMethod online -Flavor datadog-agent -VersionOverride "7.62.0" -msiDirectory C:\mnt\omnibus\pkg\
.\Generate-Chocolatey-Package.ps1 -Flavor datadog-agent -VersionOverride "7.62.0" -msiDirectory C:\mnt\omnibus\pkg

Generates a chocolatey package for 7.62.0, requires the MSI file to be present in MSIDirectory.

.EXAMPLE
$env:CI_PIPELINE_ID="50910739"; .\Generate-Chocolatey-Package.ps1 -installMethod online -Flavor datadog-agent -VersionOverride "7.62.0-devel.git.276.e59b1b3.pipeline.50910739" -msiDirectory C:\mnt\omnibus\pkg
$env:CI_PIPELINE_ID="50910739"; .\Generate-Chocolatey-Package.ps1 -Flavor datadog-agent -VersionOverride "7.62.0-devel.git.276.e59b1b3.pipeline.50910739" -msiDirectory C:\mnt\omnibus\pkg

Generates a chocolatey package for PR/devel build 7.62.0-devel.git.276.e59b1b3.pipeline.50910739, requires the MSI file to be present in MSIDirectory.
The generated chocolatey package requires the MSI be uploaded to the dd-agent-mstesting bucket.
#>
Param(
[Parameter(Mandatory=$true)]
[ValidateSet("offline", "online")]
[String]
$installMethod,

[Parameter(Mandatory=$false)]
[String]
$msiDirectory,

Expand Down Expand Up @@ -69,7 +61,7 @@ if (![string]::IsNullOrEmpty($VersionOverride)) {
}
$copyright = "Datadog {0}" -f (Get-Date).Year

$releasePattern = "(\d+\.\d+\.\d+)"
$releasePattern = "(\d+\.\d+\.\d+)$"
sabrina-datadog marked this conversation as resolved.
Show resolved Hide resolved
$releaseCandidatePattern = "(\d+\.\d+\.\d+)-rc\.(\d+)"
$develPattern = "(\d+\.\d+\.\d+)-devel\.git\.\d+\.(.+)"

Expand All @@ -87,20 +79,14 @@ try {
# For historical reasons, use a different artifact name for the datadog-agent flavor
# See agent-release-management for more details
$artifactName = "ddagent-cli"
$packageSource = "$repoRoot\chocolatey\datadog-agent\$installMethod"
$nuspecFile = "datadog-agent-$installMethod.nuspec"
} elseif ($Flavor -eq "datadog-fips-agent") {
if ($installMethod -eq "offline") {
Write-Error "Offline install method not supported for flavor $Flavor"
exit 1
}
$artifactName = "datadog-fips-agent"
$packageSource = "$repoRoot\chocolatey\datadog-fips-agent\online"
$nuspecFile = "datadog-fips-agent-online.nuspec"
} else {
Write-Error "Unknown flavor $Flavor"
exit 1
}

$packageSource = "$repoRoot\chocolatey\$Flavor"
$nuspecFile = "$Flavor.nuspec"

# These files/directories are referenced in the nuspec file
$licensePath = "tools\LICENSE.txt"
Expand All @@ -118,24 +104,22 @@ try {
$releaseNotes = "https://github.com/DataDog/datadog-agent/releases/tag/{0}-rc.{1}" -f $agentVersionMatches.Matches.Groups[1], $agentVersionMatches.Matches.Groups[2]
$url = "https://s3.amazonaws.com/dd-agent-mstesting/builds/beta/$artifactName-$($agentVersionMatches.Matches.Groups[1])-rc.$($agentVersionMatches.Matches.Groups[2]).msi"
} elseif ($rawAgentVersion -match $develPattern) {
if ($installMethod -eq "online") {
# For devel builds/branches, use the dd-agent-mstesting bucket URL
# This allows us to build and test the package in PRs, and locally
# by using the `-VersionOverride` param.
if ([string]::IsNullOrEmpty($env:CI_PIPELINE_ID)) {
Write-Error "CI_PIPELINE_ID is not set, aborting"
exit 1
} else {
if ($rawAgentVersion -notmatch $env:CI_PIPELINE_ID) {
Write-Error "CI_PIPELINE_ID is not found in the agent version, aborting" -ErrorAction Continue
if ([string]::IsNullOrEmpty($env:BUCKET_BRANCH)) {
# inv agent.version requires BUCKET_BRANCH to be set when including pipeline in version
Write-Error "BUCKET_BRANCH is not set, if you are running this locally, set `$env:BUCKET_BRANCH='dev' or pass the -VersionOverride parameter" -ErrorAction Continue
}
exit 1
# For devel builds/branches, use the dd-agent-mstesting bucket URL
# This allows us to build and test the package in PRs, and locally
# by using the `-VersionOverride` param.
if ([string]::IsNullOrEmpty($env:CI_PIPELINE_ID)) {
Write-Error "CI_PIPELINE_ID is not set, aborting"
exit 1
} else {
if ($rawAgentVersion -notmatch $env:CI_PIPELINE_ID) {
Write-Error "CI_PIPELINE_ID is not found in the agent version, aborting" -ErrorAction Continue
if ([string]::IsNullOrEmpty($env:BUCKET_BRANCH)) {
# inv agent.version requires BUCKET_BRANCH to be set when including pipeline in version
Write-Error "BUCKET_BRANCH is not set, if you are running this locally, set `$env:BUCKET_BRANCH='dev' or pass the -VersionOverride parameter" -ErrorAction Continue
}
$url = "https://s3.amazonaws.com/dd-agent-mstesting/pipelines/A7/$env:CI_PIPELINE_ID/$flavor-$rawAgentVersion-1-x86_64.msi"
exit 1
}
$url = "https://s3.amazonaws.com/dd-agent-mstesting/pipelines/A7/$env:CI_PIPELINE_ID/$flavor-$rawAgentVersion-1-x86_64.msi"
}
$agentVersionMatches = $rawAgentVersion | Select-String -Pattern $develPattern
$agentVersion = "{0}-devel-{1}" -f $agentVersionMatches.Matches.Groups[1], $agentVersionMatches.Matches.Groups[2].Value
Expand All @@ -151,26 +135,24 @@ try {
exit 1
}

Write-Host "Generating Chocolatey $installMethod package $flavor version $agentVersion in $(Get-Location)"
Write-Host "Generating Chocolatey package $flavor version $agentVersion in $(Get-Location)"

# Template the install script with the URL and checksum
if ($installMethod -eq "online") {
try {
$tempMsi = Join-Path -Path "$msiDirectory" "$flavor-$rawAgentVersion-1-x86_64.msi"
if (!(Test-Path $tempMsi)) {
Write-Host "Error: Could not find MSI file in $tempMsi"
Get-ChildItem "$msiDirectory"
exit 1
}
$checksum = (Get-FileHash $tempMsi -Algorithm SHA256).Hash
}
catch {
Write-Host "Error: Could not generate checksum for package $($tempMsi): $($_)"
try {
$msiPath = Join-Path -Path "$msiDirectory" "$flavor-$rawAgentVersion-1-x86_64.msi"
if (!(Test-Path $msiPath)) {
Write-Host "Error: Could not find MSI file in $msiPath"
Get-ChildItem "$msiDirectory"
exit 1
}
# Set the $url in the install script
(Get-Content $installScript).replace('$__url_from_ci__', '"' + $url + '"').replace('$__checksum_from_ci__', '"' + $checksum + '"') | Set-Content $installScript
$checksum = (Get-FileHash $msiPath -Algorithm SHA256).Hash
}
catch {
Write-Host "Error: Could not generate checksum for package $($msiPath): $($_)"
exit 1
}
# Set the $url in the install script
(Get-Content $installScript).replace('$__url_from_ci__', '"' + $url + '"').replace('$__checksum_from_ci__', '"' + $checksum + '"') | Set-Content $installScript

Write-Host "Generated nuspec file:"
Write-Host (Get-Content $installScript | Out-String)
Expand Down
Loading
Loading