jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
9.18k stars 248 forks source link

mise shows latest kubectl as outdated #2580

Closed RafalSkolasinski closed 4 days ago

RafalSkolasinski commented 6 days ago

Describe the bug

Mise reports newest kubectl as outdated

$ mise list kubectl
Tool     Version            Config Source              Requested
kubectl  1.31.0                                                 
kubectl  1.31.1 (outdated)  ~/.config/mise/config.toml latest 

To Reproduce

Expected behavior

1.31.1 is not marked as outdated

mise doctor output

version: 2024.9.3 linux-x64 (e0d1317 2024-09-12)
activated: yes
shims_on_path: no

build_info: 
  Target: x86_64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Thu, 12 Sep 2024 23:07:12 +0000
  Rust Version: rustc 1.81.0 (eeb90cda1 2024-09-04)
  Profile: release

shell: 
  /usr/bin/fish
  fish, version 3.7.0

dirs: 
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/.cache/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files: 
  ~/.config/mise/config.toml

backends: 
  cargo
  core
  go
  npm
  pipx
  spm
  ubi
  vfox

plugins: 
  argo           ssh://git@github.com/sudermanjr/asdf-argo.git#2ed321a
  awscli         ssh://git@github.com/MetricMike/asdf-awscli.git#ac99537
  chezmoi        ssh://git@github.com/joke/asdf-chezmoi.git#53f30be
  github-cli     ssh://git@github.com/bartlomiejdanek/asdf-github-cli.git#e0605b7
  golangci-lint  ssh://git@github.com/hypnoglow/asdf-golangci-lint.git#fee877b
  gomigrate      ssh://git@github.com/joschi/asdf-gomigrate.git#8f146c0
  grpcurl        ssh://git@github.com/asdf-community/asdf-grpcurl.git#10d4810
  helm           ssh://git@github.com/Antiarchitect/asdf-helm.git#091d00f
  istioctl       ssh://git@github.com/virtualstaticvoid/asdf-istioctl.git#6ec43e8
  k3d            ssh://git@github.com/spencergilbert/asdf-k3d.git#5b0e5b9
  k9s            ssh://git@github.com/looztra/asdf-k9s.git#78643d7
  kafka          ssh://git@github.com/ueisele/asdf-kafka.git#6c9dbc6
  kind           ssh://git@github.com/johnlayton/asdf-kind.git#1201d8c
  kubebuilder    ssh://git@github.com/virtualstaticvoid/asdf-kubebuilder.git#d37b7e7
  kubectl        ssh://git@github.com/asdf-community/asdf-kubectl.git#2fb3b57
  kubectx        https://gitlab.com/wt0f/asdf-kubectx.git#8c0b4aa
  kustomize      ssh://git@github.com/Banno/asdf-kustomize.git#8e929af
  minikube       ssh://git@github.com/alvarobp/asdf-minikube.git#2324ba7
  mockery        ssh://git@github.com/cabify/asdf-mockery.git#1cb81d6
  operator-sdk   ssh://git@github.com/Medium/asdf-operator-sdk.git#38896cb
  poetry         ssh://git@github.com/mise-plugins/mise-poetry.git#431c335
  rbac-lookup    ssh://git@github.com/looztra/asdf-rbac-lookup.git#4d9ceb3
  rclone         ssh://git@github.com/johnlayton/asdf-rclone.git#6a87924
  usage          ssh://git@github.com/jdx/mise-usage.git#fe3888a

toolset: 
  usage@0.3.1           
  go@1.23.1             
  node@20.17.0          
  kubebuilder@4.2.0     
  python@3.12.6         
  kind@0.24.0           
  kubectl@1.31.1        
  k9s@0.32.5            
  helm@3.15.4           
  chezmoi@2.52.2        
  java@temurin-17.0.11+9  
  github-cli@2.56.0     
  awscli@2.17.51        
  kubectx@0.9.5         
  gomigrate@4.18.1      

env_vars: 
  MISE_SHELL=fish

settings: 
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf = true
  asdf_compat = false
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_hints = []
  disable_tools = []
  experimental = false
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  http_timeout = 30
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  libgit2 = true
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  pipx_uvx = false
  plugin_autoupdate_last_check_duration = "7d"
  python_default_packages_file = "~/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  use_versions_host = true
  verbose = false
  vfox = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = false

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

No warnings found
No problems found

Additional context Add any other context about the problem here. Consider running mise with --debug or --trace for extra debug info.

roele commented 5 days ago

Might be related to #2265 (takes up to 6h for new versions to be picked up) or the local cache. Have you tried mise cache clear already?

RafalSkolasinski commented 5 days ago

Have you tried mise cache clear already? Tried it now, still the same.

roele commented 5 days ago

Problem seems to be in the asdf-kubectl plugin. The command mise latest kubectl shows 1.31.0 whereas the latest version is 1.31.1.

The latest-stable shell script (respectively its curl command) also shows this version.

curl -L -s https://dl.k8s.io/release/stable.txt | cut -c 2- -

Nevertheless mise should probably handle this case and not mark the version as outdated if it is newer than the latest available version reported.

jdx commented 4 days ago

Nevertheless mise should probably handle this case and not mark the version as outdated if it is newer than the latest available version reported.

Maybe what we could do is have a method on the backends like is_latest(v: &str) which would dispatch to each plugin rather than just doing v == latest. Then inside that logic we could default to some semver code or have special overrides similar to what we've done for version prefixing with ruby/java.

or perhaps this code should just use that same fuzzy logic we use with ruby/java and compare where the current version is within the list. If our version is newer than latest we could not display the latest field.

roele commented 4 days ago

Currently not able to reproduce this behaviour and at some point i already addressed this at least partially.

https://github.com/jdx/mise/blob/b9f5ac22905c47d776c91ee3f950328656909085/src/toolset/mod.rs#L335

RafalSkolasinski commented 4 days ago

It also stopped happening for me ;/ Unless you want to keep it open for investigation I am good with closing it.