Skip to content

Commit

Permalink
Add 1PasswordCLI #589
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronparker committed Mar 26, 2024
1 parent c5e4d8e commit ae0524a
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Evergreen/Apps/Get-1PasswordCLI.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
function Get-1PasswordCLI {
<#
.NOTES
Author: Aaron Parker
Twitter: @stealthpuppy
#>
[OutputType([System.Management.Automation.PSObject])]
[CmdletBinding(SupportsShouldProcess = $false)]
param (
[Parameter(Mandatory = $false, Position = 0)]
[ValidateNotNull()]
[System.Management.Automation.PSObject]
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
)

# Get latest version and download latest release via update API
$params = @{
Uri = $res.Get.Update.Uri
ContentType = $res.Get.Update.ContentType
}
$updateFeed = Invoke-EvergreenRestMethod @params
if ($updateFeed.available -eq 1) {

# Output the object to the pipeline
foreach ($Architecture in $res.Get.Download.Uri.GetEnumerator()) {
$PSObject = [PSCustomObject] @{
Version = $updateFeed.version
Architecture = $Architecture.Name
URI = $res.Get.Download.Uri[$Architecture.Name] -replace $res.Get.Download.ReplaceText, $updateFeed.version
}
Write-Output -InputObject $PSObject
}
}
else {
Write-Warning -Message "$($MyInvocation.MyCommand): failed to find an available from: $($res.Get.Update.Uri)."
}
}
28 changes: 28 additions & 0 deletions Evergreen/Manifests/1PasswordCLI.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"Name": "1Password CLI",
"Source": "https://developer.1password.com/docs/cli/",
"Get": {
"Update": {
"Uri": "https://app-updates.agilebits.com/check/2/10.0.2009/amd64/CLI2/en/2230/A1/N",
"ContentType": "application/json; charset=utf-8"
},
"Download": {
"Uri": {
"x64": "https://cache.agilebits.com/dist/1P/op2/pkg/v#version/op_windows_amd64_v#version.zip",
"x86": "https://cache.agilebits.com/dist/1P/op2/pkg/v#version/op_windows_386_v#version.zip"
},
"ReplaceText": "#version"
}
},
"Install": {
"Setup": "",
"Physical": {
"Arguments": "",
"PostInstall": []
},
"Virtual": {
"Arguments": "",
"PostInstall": []
}
}
}

0 comments on commit ae0524a

Please sign in to comment.