-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated Docker file to build Ops Agent Windows tarball. (#1905)
- Loading branch information
1 parent
814d004
commit 035a837
Showing
3 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
Param( | ||
[Parameter(Mandatory=$false)][string]$DestDir, | ||
[Parameter(Mandatory=$false)][string]$Arch | ||
) | ||
|
||
if (!$DestDir) { | ||
$DestDir = '.' | ||
} | ||
|
||
# Read PKG_VERSION from VERSION file. | ||
$PkgVersion = Select-String -Path "VERSION" -Pattern '^PKG_VERSION="(.*)"$' | %{$_.Matches.Groups[1].Value} | ||
|
||
# If ARCH is not supplied, set default value based on user's system. | ||
if (!$Arch) { | ||
$Arch = (&{If([System.Environment]::Is64BitProcess) {'x86_64'} Else {'x86'}}) | ||
} | ||
|
||
# Set GOARCH based on ARCH. | ||
switch ($Arch) { | ||
'x86_64' { $GoArch = 'amd64'; break} | ||
'x86' { $GoArch = '386'; break} | ||
default { Throw 'Arch must be set to one of: x86, x86_64' } | ||
} | ||
|
||
# Create the license directory | ||
$LicenseDir = "$DestDir\THIRD_PARTY_LICENSES" | ||
$Subfolder = "$LicenseDir\subfolder" | ||
|
||
New-Item -ItemType Directory -Path $LicenseDir -Force | Out-Null | ||
New-Item -ItemType Directory -Path $Subfolder -Force | Out-Null | ||
|
||
"license to be added" | Out-File "$LicenseDir\text1.txt" | ||
"license to be added" | Out-File "$Subfolder\text2.txt" | ||
|
||
$TarFileName = "google-cloud-ops-agent-plugin-$PkgVersion-windows-$Arch.tar.gz" # Define tar file name | ||
|
||
$FilesToInclude = @( | ||
"msvcp140.dll", | ||
"vccorlib140.dll", | ||
"vcruntime140.dll", | ||
"fluent-bit.exe", | ||
"fluent-bit.dll", | ||
"opentelemetry-java-contrib-jmx-metrics.jar", | ||
"google-cloud-metrics-agent_windows_${GoArch}.exe", | ||
"google-cloud-ops-agent-wrapper.exe" | ||
"plugin.exe" | ||
"THIRD_PARTY_LICENSES" | ||
) | ||
|
||
# Create the tar archive | ||
& tar -cvzf "$DestDir\$TarFileName" -C "$DestDir" $FilesToInclude | ||
|
||
Write-Host "Tar archive created: $($DestDir)\$TarFileName" |