Creates the Chocolatey package for Velero CLI.
Register for a Chocolatey account here.
Copy your API Key from your Account > Get API key page.
The Chocolatey installation script requires the correct download URL and checksum for the Windows version of Velero.
Use either the PowerShell or manual method below:
# Get the latest release of Velero
$veleroReleases = Invoke-RestMethod -Uri 'https://api.github.com/repos/vmware-tanzu/velero/releases'
$latestRelease = $veleroReleases[0]
# Get the CHECKSUM asset content
$checksumAsset = $latestRelease.assets | Where-Object { $_.name -eq 'CHECKSUM' }
$checksumAssetUrl = $checksumAsset.browser_download_url
$checksumAssetContent = Invoke-RestMethod -Uri $checksumAssetUrl
# Get the CHECKSUM value for the Windows Velero release
$match = $checksumAssetContent | Select-String -Pattern '(.*)(?= .*-windows-amd64.tar.gz)'
if ($match) {
$windowsAssetChecksum = $match.Matches[0].Value
Write-Output "The CHECKSUM value for the Windows Velero release is: [$windowsAssetChecksum]"
}
- The latest release is listed here: https://github.com/vmware-tanzu/velero/releases/latest
- Search for the
velero-v<VERSION>-windows-amd64.tar.gz
Windows binary asset, and note the download URL. - Download the
CHECKSUM
asset and note the checksum value forvelero-v<VERSION>-windows-amd64.tar.gz
.
# view help
choco new -h
# create new velero package files
choco new --name velero --version=<VERSION> --maintainer="Adam Rush"
- Edit the
velero/velero.nuspec
configuration file, ensuring correct<version>
and other metadata. - Edit the
velero/tools/chocolateyinstall.ps1
install script, ensuring the$version
and$packageArgs.checksum64
vars are correct forwindows-amd64
. $packageArgs.url64bit
may need to be updated if the asset name or download URL changes.
# view help
choco pack -h
# create velero NuGet package
choco pack
# view help
choco install -h
# install from local Nuget package
# eg: velero.<VERSION>.nupkg exists in current folder
choco install velero --source .
# [OPTIONAL] test upgrade if previous version is already installed
choco upgrade velero --source .
# check version
velero version --client-only
# uninstall
choco uninstall velero
# copy your API Key from the My Account page: https://chocolatey.org/account/
choco apikey --key <YOUR_API_KEY> --source https://push.chocolatey.org/
# view help
choco push -h
# publish Nuget package
# eg: velero.<VERSION>.nupkg exists in current folder
choco push velero.<VERSION>.nupkg --source https://push.chocolatey.org/
# [OPTIONAL]
# once a package is approved, it's immutable, therefore you cannot push this same version.
# push a fixed version by appending the date (velero.<VERSION>.<DATE>.nupkg), eg:
choco push velero.1.5.1.20200919.nupkg --source https://push.chocolatey.org/
Once you submit the package, Chocolatey will run automated Validation and Verification tests.
You may receive comments like the following:
- The iconUrl should be added if there is one. Please correct this in the nuspec, if applicable.
- The licenseUrl should be added if there is one. Please correct this in the nuspec, if applicable.
Make the suggested changes, then create a new NuGet package and publish as before, ensuring you use the same version.