Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions windowspkg/linkerd2-cli/linkerd2-cli.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>linkerd2-cli</id>
<version>2.6.1</version>

<title>linkerd2-cli (Install)</title>
<authors>__REPLACE_AUTHORS_OF_SOFTWARE_COMMA_SEPARATED__</authors>
<tags>linkerd2-cli SPACE_SEPARATED</tags>
<summary>__REPLACE__</summary>
<description>__REPLACE__MarkDown_Okay </description>
<dependencies>
<dependency id="chocolatey-core.extension" version="1.1.0" />
</dependencies>
</metadata>

<files>
<file src="tools\**" target="tools" />
</files>
</package>
11 changes: 11 additions & 0 deletions windowspkg/linkerd2-cli/tools/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

Note: Include this file if including binaries you have the right to distribute.
Otherwise delete. this file.

===DELETE ABOVE THIS LINE AND THIS LINE===

From: <insert applicable license url here>

LICENSE

<Insert License Here>
13 changes: 13 additions & 0 deletions windowspkg/linkerd2-cli/tools/VERIFICATION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

Note: Include this file if including binaries you have the right to distribute.
Otherwise delete. this file. If you are the software author, you can change this
mention you are the author of the software.

===DELETE ABOVE THIS LINE AND THIS LINE===

VERIFICATION
Verification is intended to assist the Chocolatey moderators and community
in verifying that this package's contents are trustworthy.

<Include details of how to verify checksum contents>
<If software vendor, explain that here - checksum verification instructions are optional>
14 changes: 14 additions & 0 deletions windowspkg/linkerd2-cli/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$ErrorActionPreference = 'Stop';
$toolsPath = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"

$packageArgs = @{

packageName = 'linkerd'
fileFullPath = "$toolsPath\linkerd.exe"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to set this value from an env var so that user can decide where to download the .exe to?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, if required the script can also accept command line arguments for the path. Should I accommodate for that as well?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even better! Thanks!

url = 'https://github.com/linkerd/linkerd2/releases/download/stable-2.6.1/linkerd2-cli-stable-2.6.1-windows.exe'
Comment thread
ihcsim marked this conversation as resolved.
checksum = '4ed915b10c2a76070d40bf3223f09e742777105914acaeadfc83d99ef6cf1798'
checksumType = 'sha256'
}

Get-ChocolateyWebFile @packageArgs
Install-ChocolateyPath $packageArgs.fileFullPath 'Machine'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, this adds the tools\linkerd.exe path to the global $PATH, right? Can we use the User path type so that the script doesn't require UAC/admin privileges on the machine?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! that's a good catch. Thanks for pointing that out :) Will look into and modify the script to allow for use without admin privileges.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe if you use the Install-Chocolatey* family of commands, ShimGen should make a shim in the ProgramData/chocolatey/bin folder automatically, hence not requiring a modification of the path variable. It's for example how Helm does it:

$packageName = 'kubernetes-helm'
$toolsDir =  "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$tempDir = "$toolsDir\temp"

$packageArgs = @{
    PackageName    = $packageName
    Url64bit       = 'https://get.helm.sh/helm-v3.1.1-windows-amd64.zip'
    Checksum64     = '5efc1c7bdea42a17a1ea197a3a2e47c8f1b0a5464894b98ae73a4c0620163040'
    ChecksumType64 = 'sha256'
    UnzipLocation  = $toolsDir
}

# Download and unzip into a temp folder
Install-ChocolateyZipPackage @packageArgs

That zip is a file with an windows-amd64 folder in it with helm.exe, LICENCE and README.md in it. Rather straightforward.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! That's a interesting way to do it. Although currently Linkerd doesn't make a zip folder for the windows package. Will look into this to find analogous ways for how it currently is (if any). Thank you for suggesting this :)