ScoopInstaller / Scoop

A command-line installer for Windows.
https://scoop.sh
Other
20.95k stars 1.39k forks source link

[Bug] scoop does not detect newer versions for internal repos #5418

Closed papanito closed 1 year ago

papanito commented 1 year ago

Bug Report

Current Behavior

I installed a older version of kubectl like scoop install kubectl@1.24.0 and then want to update to latest, which is 1.26.1, but that does not work

PS C:\Users\papanito> scoop search kubectl
Results from local buckets...

Name    Version Source Binaries
----    ------- ------ --------
kubectl 1.26.2  main

PS C:\Users\papanito> scoop updatekubectl
WARN  'kubectl' (1.24.0) is already installed.
Use 'scoop update kubectl' to install a new version.

Also scoop does not recognize that there is a new version

PS C:\Users\papanito> scoop update
Updating Scoop...
warning: git-credential-manager-core was renamed to git-credential-manager
warning: see https://aka.ms/gcm/rename for more information
Updating 'main' bucket...
Scoop was updated successfully!

Expected Behavior

Scoop is able to update to newer app versions.

Additional context/output

We use only an internal bucket. The internal bucket pulls software from an Artifactory, which proxies necessary repos, e.g.

{
    "version": "1.26.2",
    "description": "Control the Kubernetes cluster manager.",
    "homepage": "https://kubernetes.io/docs/user-guide/kubectl-overview/",
    "license": "Apache-2.0",
    "architecture": {
        "64bit": {
            "url": "https://artifactory.intra/remote-generic-kubernetes-release/release/v1.26.2/kubernetes-client-windows-amd64.tar.gz",
            "hash": "fc6ce69c9f7b6512961c951102a2ce3ac896a5e9e789eb7c6b1ee90aa8ab3cd0"
        },
        "32bit": {
            "url": "https://artifactory.intra/remote-generic-kubernetes-release/release/v1.26.2/kubernetes-client-windows-386.tar.gz",
            "hash": "2db6940eaae54c19bad2b30aa932a9dda42f22c0ddd15cf8eb5a3ab58eab69d1"
        }
    },
    "extract_dir": "kubernetes\\client",
    "bin": "bin\\kubectl.exe",
    "checkver": {
        "url": "https://artifactory.intra/remote-generic-kubernetes-release/release/stable.txt",
        "regex": "v([\\d.]+)"
    },
    "autoupdate": {
        "architecture": {
            "64bit": {
                "url": "https://artifactory.intra/remote-generic-kubernetes-release/release/v$version/kubernetes-client-windows-amd64.tar.gz"
            },
            "32bit": {
                "url": "https://artifactory.intra/remote-generic-kubernetes-release/release/v$version/kubernetes-client-windows-386.tar.gz"
            }
        },
        "hash": {
            "url": "$url.sha1"
        }
    }
}

As you can see the config even points to 1.26.2 not 1.24.0 but still no updates are recognized.

Also the checkver points to a readable text file which contains 1.26.2

I currently have this workaround is to do a cleanup and then an install with specific version

PS C:\Users\papanito> scoop cleanup kubectl
kubectl is already clean
PS C:\Users\papanito> scoop update kubectl
kubectl: 1.24.0 (latest version)
Latest versions for all apps are installed! For more information try 'scoop status'
PS C:\Users\papanito> scoop install kubectl@1.26.2
Installing 'kubectl' (1.26.2) [64bit]
Loading kubernetes-client-windows-amd64.tar.gz from cache
Checking hash of kubernetes-client-windows-amd64.tar.gz ... ok.
Extracting kubernetes-client-windows-amd64.tar.gz ... done.
Linking ~\scoop\apps\kubectl\current => ~\scoop\apps\kubectl\1.26.2
Creating shim for 'kubectl'.
'kubectl' (1.26.2) was installed successfully!

Possible Solution

System details

Windows version: Windows Server 2022

OS architecture: 64bit

PowerShell version:

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      20348  1366

Additional software: [(optional) e.g. ConEmu, Git]

Scoop Configuration

{
    "last_update":  "2023-03-03T10:45:28.7544240+01:00",
    "scoop_branch":  "master",
    "scoop_repo":  "https://github.com/ScoopInstaller/Scoop"
}
r15ch13 commented 1 year ago

Run scoop uninstall kubectl and scoop install kubectl without specifying a version to install the latest version from the bucket.

This happens because installing older versions gets handled differently. When you run scoop install kubectl@1.24.0 Scoop creates a local copy of the JSON file in ~/scoop/workspace. It uses this JSON for installing the program and will store the location as the source. (See ~/scoop/apps/kubectl/current/install.json it contains the path to the local JSON file, which would normally contain the main-bucket).

papanito commented 1 year ago

Good to know. I checked the docu but maybe I missed it... otherwise I can add something to the docu, may help others as well.