-
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
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 | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -21,6 +21,22 @@ This can also be used to compare two revisions/versions of your helm release. | |||||||
| helm plugin install https://github.com/databus23/helm-diff | ||||||||
| ``` | ||||||||
|
|
||||||||
| ### Installing offline | ||||||||
| If installing this in an offline/airgapped environment, download the bin `.tgz` from [releases](https://github.com/databus23/helm-diff/releases). Set `HELM_DIFF_BIN_TGZ` to the absolute path to the bin `.tgz`: | ||||||||
|
|
||||||||
| **POSIX shell:** | ||||||||
| ```sh | ||||||||
| export HELM_DIFF_BIN_TGZ=/path/to/helm-diff-bin.tgz | ||||||||
| ``` | ||||||||
|
|
||||||||
| **PowerShell:** | ||||||||
| ```powershell | ||||||||
| $env:HELM_DIFF_BIN_TGZ = "C:\path\to\helm-diff-bin.tgz" | ||||||||
| ``` | ||||||||
|
|
||||||||
| Now, run `helm plugin install /path/to/helm-diff/`. | ||||||||
|
||||||||
| Now, run `helm plugin install /path/to/helm-diff/`. | |
| Now, run `helm plugin install /path/to/helm-diff/`. | |
| Here, `/path/to/helm-diff/` must be a local copy of the Helm Diff plugin source directory (including `plugin.yaml` and the install scripts), for example from a repo you cloned or a source archive you downloaded earlier and transferred into the offline environment. |
| 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,32 +40,42 @@ 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 . | ||
| Pop-Location | ||
|
|
||
| New-Item -ItemType Directory -Path $Destination -Force | ||
| Copy-Item -Path (Join-Path $ArchiveDirectory "diff" "bin" "diff.exe") -Destination $Destination -Force | ||
| } | ||
|
|
||
| $ErrorActionPreference = "Stop" | ||
|
|
||
| $archiveName = "helm-diff.tgz" | ||
| $arch = Get-Architecture | ||
| $version = Get-Version -Update $Update | ||
| $tmpDir = New-TemporaryDirectory | ||
|
Comment on lines
56
to
59
|
||
|
|
||
| trap { Remove-Item -path $tmpDir -Recurse -Force } | ||
|
|
||
| $url = Get-Url -Version $version -Architecture $arch | ||
| $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 | ||
| Write-Host "HELM_DIFF_BIN_TGZ not set. Proceeding with online installation." | ||
| $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") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The offline install docs say to download a “bin .tgz” but the release assets are platform-specific (e.g.,
helm-diff-<os>-<arch>.tgz) and the GitHub release page also includes source archives. Please clarify which exact asset to download to avoid users grabbing the source tarball or the wrong OS/arch package, and make the example filename match the actual release naming.