aaronparker / evergreen

Create evergreen Windows image build pipelines with the latest version numbers and download URLs for common applications
http://stealthpuppy.com/evergreen/
MIT License
375 stars 64 forks source link

[New app]: WinFSP #740

Closed alex-harvey-z3q closed 1 week ago

alex-harvey-z3q commented 2 weeks ago

What is the new application?

https://winfsp.dev/rel/

Please see also: https://github.com/DanGough/Nevergreen/issues/119#issuecomment-2352369966

Vendor site

https://winfsp.dev/rel/

Does the vendor require a sign-in to download the app?

No

Does the application include an updater?

No

Have you reviewed the list of supported applications?

alex-harvey-z3q commented 2 weeks ago

If anyone could provide some basic assistance I'd be then happy to try to raise the PR myself.

AScott-WWF commented 2 weeks ago

Hi again @alex-harvey-z3q

For Github repo based downloads, You would need to create an App .ps1 file and Manifest .json file configured simlar to the two files below.

Here are the two files you would need for WinFSP (This is a modified version of the 7-Zip files) Until this is included with a future release of Evergreen you would need to place the App .ps1 file in your Evergreen modules \App folder and the Manifest .json file in your Evergreen Modules \Manifest folder.

@aaronparker maybe this app can be included in a future release?

App script Get-WinFSP.ps1:

Function Get-WinFSP {
    <#
        .SYNOPSIS
            Get the current version and download URL for WinSFP.

        .NOTES
            Site: 
            Author: 
            Twitter: 
    #>
    [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])
    )

    # Pass the repo releases API URL and return a formatted object
    $params = @{
        Uri          = $res.Get.Uri
        MatchVersion = $res.Get.MatchVersion
        Filter       = $res.Get.MatchFileTypes
    }
    $object = Get-GitHubRepoRelease @params
    Write-Output -InputObject $object
}

Manifest: WinSFP.json

{
    "Name": "WinFSP",
    "Source": "https://winfsp.dev/rel/",
    "Get": {
        "Uri": "https://api.github.com/repos/winfsp/winfsp/releases/latest",
        "MatchVersion": "(\\d+(\\.\\d+){1,4}).*",
        "MatchFileTypes": "\\.msi$|\\.zip$"
    },
    "Install": {
        "Setup": "winfsp-*.msi",
        "Physical": {
            "Arguments": "",
            "PostInstall": []
        },
        "Virtual": {
            "Arguments": "",
            "PostInstall": []
        }
    }
}

Verbose output:

Get-EvergreenApp WinFSP -Verbose
VERBOSE: Function path: C:\Program Files\WindowsPowerShell\Modules\Evergreen\2409.1352\Apps\Get-WinFSP.ps1
VERBOSE: Function exists: C:\Program Files\WindowsPowerShell\Modules\Evergreen\2409.1352\Apps\Get-WinFSP.ps1.
VERBOSE: Dot sourcing: C:\Program Files\WindowsPowerShell\Modules\Evergreen\2409.1352\Apps\Get-WinFSP.ps1.
VERBOSE: Get-FunctionResource: read application resource strings from [C:\Program Files\WindowsPowerShell\Modules\Evergreen\2409.1352\Manifests\WinFSP.json]
VERBOSE: Calling: Get-WinFSP.
VERBOSE: Get-GitHubRateLimit: Checking for how many requests to the GitHub API we have left.
VERBOSE: Requested HTTP/1.1 GET with 0-byte payload
VERBOSE: Received HTTP/1.1 465-byte response of content type application/json
VERBOSE: Content encoding: utf-8
VERBOSE: Get-GitHubRateLimit: We have 58 requests left to the GitHub API in this window.
VERBOSE: Get-GitHubRateLimit: Rate limit window resets at: 16/09/2024 15:25.
VERBOSE: Get-GitHubRepoRelease: Set TLS to 1.2.
VERBOSE: Get-GitHubRepoRelease: Invoke-WebRequest parameter: UseBasicParsing: True.
VERBOSE: Get-GitHubRepoRelease: Invoke-WebRequest parameter: Uri: https://api.github.com/repos/winfsp/winfsp/releases/latest.
VERBOSE: Get-GitHubRepoRelease: Invoke-WebRequest parameter: DisableKeepAlive: True.
VERBOSE: Get-GitHubRepoRelease: Invoke-WebRequest parameter: UserAgent: github-aaronparker-evergreen.
VERBOSE: Get-GitHubRepoRelease: Invoke-WebRequest parameter: ErrorAction: Stop.
VERBOSE: Get-GitHubRepoRelease: Invoke-WebRequest parameter: MaximumRedirection: 0.
VERBOSE: Get-GitHubRepoRelease: Invoke-WebRequest parameter: ContentType: application/vnd.github.v3+json.
VERBOSE: Get-GitHubRepoRelease: Get GitHub release from: https://api.github.com/repos/winfsp/winfsp/releases/latest.
VERBOSE: Requested HTTP/1.1 GET with 0-byte payload
VERBOSE: Received HTTP/1.1 response of content type application/json of unknown size
VERBOSE: Content encoding: utf-8
VERBOSE: Get-GitHubRepoRelease: Validating GitHub release object.
VERBOSE: Get-GitHubRepoRelease: Validated successfully.
VERBOSE: Get-GitHubRepoRelease: Found 1 release/s.
VERBOSE: Get-GitHubRepoRelease: Found 2 asset/s.
VERBOSE: Get-GitHubRepoRelease: Match \.msi$|\.zip$ to https://github.com/winfsp/winfsp/releases/download/v2.0/winfsp-2.0.23075.msi.
VERBOSE: Get-GitHubRepoRelease: Building Windows release output object with: https://github.com/winfsp/winfsp/releases/download/v2.0/winfsp-2.0.23075.msi.
VERBOSE: Get-GitHubRepoRelease: Matching version number against: v2.0.
VERBOSE: Get-GitHubRepoRelease: Found version number: 2.0.
VERBOSE: ConvertTo-DateTime: Converting: [03/16/2023 10:44:03].
VERBOSE: ConvertTo-DateTime: Attempting to convert date format to: en-GB.
VERBOSE: ConvertTo-DateTime: Returning date: [16/03/2023].
VERBOSE: Get-Architecture: Architecture not found in winfsp-2.0.23075.msi, defaulting to x86.
VERBOSE: Get-InstallerType: Installer type not found in https://github.com/winfsp/winfsp/releases/download/v2.0/winfsp-2.0.23075.msi, defaulting to 'Default'.
VERBOSE: Get-GitHubRepoRelease: Match \.msi$|\.zip$ to https://github.com/winfsp/winfsp/releases/download/v2.0/winfsp-tests-2.0.23075.zip.
VERBOSE: Get-GitHubRepoRelease: Building Windows release output object with: https://github.com/winfsp/winfsp/releases/download/v2.0/winfsp-tests-2.0.23075.zip.
VERBOSE: Get-GitHubRepoRelease: Matching version number against: v2.0.
VERBOSE: Get-GitHubRepoRelease: Found version number: 2.0.
VERBOSE: ConvertTo-DateTime: Converting: [03/16/2023 10:44:03].
VERBOSE: ConvertTo-DateTime: Attempting to convert date format to: en-GB.
VERBOSE: ConvertTo-DateTime: Returning date: [16/03/2023].
VERBOSE: Get-Architecture: Architecture not found in winfsp-tests-2.0.23075.zip, defaulting to x86.
VERBOSE: Get-InstallerType: Installer type not found in https://github.com/winfsp/winfsp/releases/download/v2.0/winfsp-tests-2.0.23075.zip, defaulting to 'Default'.

Version       : 2.0
Date          : 16/03/2023
Size          : 2207744
Architecture  : x86
InstallerType : Default
Type          : msi
URI           : https://github.com/winfsp/winfsp/releases/download/v2.0/winfsp-2.0.23075.msi

Version       : 2.0
Date          : 16/03/2023
Size          : 665780
Architecture  : x86
InstallerType : Default
Type          : zip
URI           : https://github.com/winfsp/winfsp/releases/download/v2.0/winfsp-tests-2.0.23075.zip
aaronparker commented 2 weeks ago

Each app has a function and a manifest file. There's a bunch of apps that gather details from a GitHub repository, you can use 7-Zip as an example: https://github.com/aaronparker/evergreen/blob/main/Evergreen/Apps/Get-7Zip.ps1

WinFSP is available from here: https://github.com/winfsp/winfsp

alex-harvey-z3q commented 2 weeks ago

Thanks @aaronparker and @AScott-WWF

@AScott-WWF — was selection of the tests zip file there an accident or intentional?

aaronparker commented 2 weeks ago

The problem with this app though is that the release title is WinFSP 2023, the tag on the release is v2.0 and the actual version number is 2.0.23075

AScott-WWF commented 2 weeks ago

The problem with this app though is that the release title is WinFSP 2023, the tag on the release is v2.0 and the actual version number is 2.0.23075

😂Don't you just love vendors with consistency