-
Notifications
You must be signed in to change notification settings - Fork 323
adding airgap install instructions #964
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
base: master
Are you sure you want to change the base?
Changes from all commits
28e4cf4
387dc7a
64005a2
4339efa
0dc6967
39353d7
09b4759
77f3dcc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,27 +4,22 @@ param ( | |
|
|
||
| function Get-Architecture { | ||
| $architecture = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture | ||
|
|
||
| $arch = switch ($architecture) { | ||
| "X64" { "amd64" } | ||
| "X64" { "amd64" } | ||
| "Arm64" { "arm64" } | ||
| Default { "" } | ||
| } | ||
|
|
||
| if ($arch -eq "") { | ||
| throw "Unsupported architecture: ${architecture}" | ||
| } | ||
|
|
||
| return $arch | ||
| } | ||
|
|
||
| function Get-Version { | ||
| param ([Parameter(Mandatory=$true)][bool] $Update) | ||
|
|
||
| if ($Update) { | ||
| return "latest" | ||
| } | ||
|
|
||
| return git describe --tags --exact-match 2>$null || "latest" | ||
| } | ||
|
|
||
|
|
@@ -37,7 +32,6 @@ function New-TemporaryDirectory { | |
|
|
||
| function Get-Url { | ||
| param ([Parameter(Mandatory=$true)][string] $Version, [Parameter(Mandatory=$true)][string] $Architecture) | ||
|
|
||
| if ($Version -eq "latest") { | ||
| return "https://github.com/databus23/helm-diff/releases/latest/download/helm-diff-windows-${Architecture}.tgz" | ||
| } | ||
|
|
@@ -46,17 +40,14 @@ function Get-Url { | |
|
|
||
| function Download-Plugin { | ||
| param ([Parameter(Mandatory=$true)][string] $Url, [Parameter(Mandatory=$true)][string] $Output) | ||
|
|
||
| Invoke-WebRequest -OutFile $Output $Url | ||
| } | ||
|
|
||
| function Install-Plugin { | ||
| param ([Parameter(Mandatory=$true)][string] $ArchiveDirectory, [Parameter(Mandatory=$true)][string] $ArchiveName, [Parameter(Mandatory=$true)][string] $Destination) | ||
|
|
||
| Push-Location $ArchiveDirectory | ||
| tar -xzf $ArchiveName -C . | ||
| tar -xzf $ArchiveName -C . | ||
| Pop-Location | ||
|
|
||
| New-Item -ItemType Directory -Path $Destination -Force | ||
| Copy-Item -Path (Join-Path $ArchiveDirectory "diff" "bin" "diff.exe") -Destination $Destination -Force | ||
| } | ||
|
|
@@ -65,13 +56,23 @@ $ErrorActionPreference = "Stop" | |
|
|
||
| $archiveName = "helm-diff.tgz" | ||
| $arch = Get-Architecture | ||
| $version = Get-Version -Update $Update | ||
| $tmpDir = New-TemporaryDirectory | ||
|
Comment on lines
57
to
59
|
||
|
|
||
| trap { Remove-Item -path $tmpDir -Recurse -Force } | ||
|
|
||
| $url = Get-Url -Version $version -Architecture $arch | ||
| trap { Remove-Item -path $tmpDir -Recurse -Force } | ||
| $output = Join-Path $tmpDir $archiveName | ||
|
|
||
| Download-Plugin -Url $url -Output $output | ||
| Install-Plugin -ArchiveDirectory $tmpDir -ArchiveName $archiveName -Destination (Join-Path $env:HELM_PLUGIN_DIR "bin") | ||
| # Check for offline installation via environment variable | ||
| if ($env:HELM_DIFF_BIN_TGZ) { | ||
| Write-Host "HELM_DIFF_BIN_TGZ is set. Using local package at: $($env:HELM_DIFF_BIN_TGZ)" | ||
| if (-not (Test-Path $env:HELM_DIFF_BIN_TGZ -PathType Leaf)) { | ||
| throw "Offline installation failed: File not found at '$($env:HELM_DIFF_BIN_TGZ)'" | ||
| } | ||
| Copy-Item -Path $env:HELM_DIFF_BIN_TGZ -Destination $output | ||
| } | ||
| else { | ||
| # Proceed with online installation | ||
| $version = Get-Version -Update $Update | ||
| $url = Get-Url -Version $version -Architecture $arch | ||
| Download-Plugin -Url $url -Output $output | ||
| } | ||
|
|
||
| Install-Plugin -ArchiveDirectory $tmpDir -ArchiveName $archiveName -Destination (Join-Path $env:HELM_PLUGIN_DIR "bin") | ||
Uh oh!
There was an error while loading. Please reload this page.