Skip to content

Commit

Permalink
remove temp path from choco build
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 17, 2024
1 parent c4744e7 commit 33a2c58
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
10 changes: 2 additions & 8 deletions .gitlab/choco_build/choco_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# choco_build stage
# Contains jobs which build the chocolatey Agent package.

# The online version of the choco job gets the msi package through the gitlab artifacts
# The choco job gets the msi package through the gitlab artifacts
.windows_choco_7_x64:
rules:
!reference [.on_deploy_stable_or_beta_repo_branch]
Expand All @@ -13,11 +13,7 @@
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 @@ -26,10 +22,8 @@
-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 -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 Down
22 changes: 10 additions & 12 deletions tasks/winbuildscripts/Generate-Chocolatey-Package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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 -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.
Expand All @@ -26,7 +26,7 @@ Generates a chocolatey package for PR/devel build 7.62.0-devel.git.276.e59b1b3.p
The generated chocolatey package requires the MSI be uploaded to the dd-agent-mstesting bucket.
#>
Param(
[Parameter(Mandatory=$false)]
[Parameter(Mandatory=$true)]
[String]
$msiDirectory,

Expand Down Expand Up @@ -79,16 +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"
$nuspecFile = "datadog-agent.nuspec"
} elseif ($Flavor -eq "datadog-fips-agent") {
$artifactName = "datadog-fips-agent"
$packageSource = "$repoRoot\chocolatey\datadog-fips-agent"
$nuspecFile = "datadog-fips-agent.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 Down Expand Up @@ -141,16 +139,16 @@ try {

# Template the install script with the URL and checksum
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"
$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
}
$checksum = (Get-FileHash $tempMsi -Algorithm SHA256).Hash
$checksum = (Get-FileHash $msiPath -Algorithm SHA256).Hash
}
catch {
Write-Host "Error: Could not generate checksum for package $($tempMsi): $($_)"
Write-Host "Error: Could not generate checksum for package $($msiPath): $($_)"
exit 1
}
# Set the $url in the install script
Expand Down

0 comments on commit 33a2c58

Please sign in to comment.