Linkerd CLI Chocolatey Package (#4205)

* Add Linkerd CLI Chocolatey Package

This PR partially fixes #3063 by building a chocolatey package for Linkerd2's Windows CLI
It adds the build scripts for the Linkerd chocolatey package and based on discussions in
https://github.com/linkerd/linkerd2/pull/3921

Signed-off-by: Animesh Narayan Dangwal <animesh.leo@gmail.com>
This commit is contained in:
drholmie 2020-04-29 22:11:54 +05:30 committed by GitHub
parent 66ec92aa09
commit 7a560a723d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 67 additions and 0 deletions

View File

@ -113,4 +113,6 @@ jobs:
! -name test-scale \
! -name update-go-deps-shas \
! -name web \
! -name *.nuspec \
! -name *.ps1 \
| xargs -I {} bin/shellcheck -x {}

32
bin/win/linkerd.nuspec Normal file
View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>linkerd</id>
<version>${LINKERD_VERSION}</version>
<title>Linkerd</title>
<authors>Linkerd</authors>
<summary>Ultralight service mesh for Kubernetes and beyond</summary>
<description>
Linkerd is an ultralight service mesh for Kubernetes.
It gives you observability, reliability, and security without requiring any code changes.
Package Parameters
- `path`: Specify path for linkerd-cli installation. If not specified, uses environment variable `linkerdPath`. Uses default chocolatey install path if none provided.
- `checksum`: Specify the checksum for linkerd-cli. If not specified, uses environment variable `linkerdCheckSum`. Defaults to `null` if no checksum provided and skips verification. Do ensure to use the correct checksum for the version of install.
</description>
<projectUrl>https://github.com/linkerd/linkerd2</projectUrl>
<licenseUrl>https://github.com/linkerd/linkerd2/blob/master/LICENSE</licenseUrl>
<releaseNotes>https://github.com/linkerd/linkerd2/releases</releaseNotes>
<docsUrl>https://linkerd.io/docs</docsUrl>
<dependencies>
<dependency id="chocolatey-core.extension" version="1.1.0" />
</dependencies>
</metadata>
<files>
<file src="bin\win\tools\**" target="tools" />
</files>
</package>

View File

@ -0,0 +1,33 @@
$ErrorActionPreference = 'Stop';
$toolsPath = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$version = $env:chocolateyPackageVersion
$pp = Get-PackageParameters
if ($null -ne $pp['path']){
$lpath = $pp['path']
}
elseif (Test-Path env:linkerdPath) {
$lpath = $env:linkerdPath
}
else {
$lpath = $toolsPath
}
if ($null -ne $pp['checksum']){
$checksum = $pp['checksum']
}
else{
$checksum = $env:linkerdCheckSum
}
$packageArgs = @{
packageName = 'linkerd'
fileFullPath = "$lpath\linkerd.exe"
url64 = "https://github.com/linkerd/linkerd2/releases/download/stable-$version/linkerd2-cli-stable-$version-windows.exe"
checksum = $checksum
checksumType = 'sha256'
}
Get-ChocolateyWebFile @packageArgs
Install-ChocolateyPath $packageArgs.fileFullPath 'User'