Skip to content

mise use adding tool options from backend #4842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jdx opened this issue Apr 14, 2025 · 9 comments
Open

mise use adding tool options from backend #4842

jdx opened this issue Apr 14, 2025 · 9 comments

Comments

@jdx
Copy link
Owner

jdx commented Apr 14, 2025

I thought this was fixed but apparently not

❯ mise use [email protected]
mise Installed executable into /Users/jdickey/.local/share/mise/installs/opentofu/1.6.2/tofu
mise [email protected]  ✓ installed
mise mise.toml tools: [email protected]
❯ cat mise.toml
[tools]
opentofu = { version = "1.6.2", exe = "tofu" }
@jdx jdx changed the title mise up adding tool options from backend mise use adding tool options from backend Apr 14, 2025
@roele
Copy link
Contributor

roele commented Apr 15, 2025

What exactly is the expected behaviour?

Currently the default backend for opentofu is aqua which does not define/require any options.

mise use [email protected]
mise WARN  aqua:opentofu/[email protected] can be verified with cosign but cosign is not installed
mise [email protected] ✓ installed

cat mise.toml
[tools]
opentofu = "1.6.2"

The ubi backend registry entry defines an [exe=tofu] option but this is not used with mise use ubi:opentofu/[email protected].

Is this issue about applying these registry options automatically by default?

@jdx
Copy link
Owner Author

jdx commented Apr 15, 2025

ok I was able to repro on a different machine (mise 2025.4.4):

Image

Looks like for some reason mise use is porting over the backend options from ubi?

doctor:

version: 2025.4.4 macos-arm64 (2025-04-15)
activated: no
shims_on_path: no

build_info:
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS, SELF_UPDATE
  Built: Tue, 15 Apr 2025 01:53:51 +0000
  Rust Version: rustc 1.86.0 (05f9846f8 2025-03-31) (Homebrew)
  Profile: release

shell:
  /usr/local/bin/fish
  fish, version 4.0b1

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

config_files:
  ~/.config/mise/config.toml
  /private/var/folders/03/nk908szn7b35qksv9m08v7mw0000gn/T/tmp.l6Jf8tuGYR/mise.toml

ignored_config_files: (none)

backends:
  aqua
  asdf
  cargo
  core
  dotnet
  gem
  go
  npm
  pipx
  spm
  ubi
  vfox

plugins:
  1password                     https://github.com/NeoHsu/asdf-1password-cli.git#f5d5aab
  aapt2                         https://github.com/ronnnnn/asdf-aapt2.git#79e513a
  android-sdk                   https://github.com/mise-plugins/mise-android-sdk.git#a44eb2b
  asdf-jdx-mise-tiny            https://github.com/jdx/mise-tiny.git#ce6f92f
  asdf-jtakakura-asdf-wren-cli  https://github.com/jtakakura/asdf-wren-cli.git#e130979
  asdf-neovim                   https://github.com/richin13/asdf-neovim.git#cc53c89
  jdx/mise-tiny
  bashly                        https://github.com/pcrockett/asdf-bashly.git#a02cc53
  crystal                       https://github.com/mise-plugins/mise-crystal.git#7af37cf
  jib                           https://github.com/mise-plugins/mise-jib.git#69b17a5
  neovim                        https://github.com/richin13/asdf-neovim.git#cc53c89
  nim                           https://github.com/asdf-community/asdf-nim.git#d35061b
  oci                           https://github.com/yasn77/asdf-oci.git#4b228f4
  php                           https://github.com/mise-plugins/mise-php.git#e361a2c
  pipx                          https://github.com/mise-plugins/mise-pipx.git#31db618
  poetry                        [email protected]:mise-plugins/mise-poetry.git#f2fe51c
  shfmt                         https://github.com/luizm/asdf-shfmt.git#a42c5ff
  swiftformat                   https://github.com/younke/asdf-swiftformat.git#ab1f91f
  swiftlint                     https://github.com/klundberg/asdf-swiftlint.git#447f94c
  tiny                          https://github.com/mise-plugins/mise-tiny.git#db27878
  tuist                         https://github.com/asdf-community/asdf-tuist.git#44c87b2
  xcbeautify                    https://github.com/mise-plugins/asdf-xcbeautify.git#48563a3

toolset:
  aqua:aws/[email protected]
  aqua:hashicorp/[email protected]
  aqua:jdx/[email protected]
  aqua:koalaman/[email protected]
  aqua:opentofu/[email protected]
  core:[email protected]+7
  core:[email protected]
  core:[email protected]
  npm:[email protected]
  pipx:[email protected]
  ubi:watchexec/[email protected]

path:
  ~/.mise/installs/opentofu/1.6.2
  ~/.mise/installs/awscli/2.24.10/aws-cli.pkg/Payload/aws-cli
  ~/.mise/installs/hk/0.4.1
  ~/.mise/installs/java/temurin-23.0.2+7/bin
  ~/.mise/installs/node/23.10.0/bin
  ~/.mise/installs/npm-prettier/3.5.2/bin
  ~/.mise/installs/python/3.13.1/bin
  ~/.mise/installs/shellcheck/0.10.0/shellcheck-v0.10.0
  ~/.mise/installs/terraform/1.10.5
  ~/.mise/installs/watchexec/2.2.1/bin
  ~/.mise/installs/yamllint/1.35.1/bin
  ~/.proto/shims
  ~/.proto/bin
  ~/Library/pnpm
  ~/bin
  ~/.local/bin
  ~/.cargo/bin
  ~/go/bin
  ~/Library/Application Support/JetBrains/Toolbox/scripts
  /opt/jetbrains/bin
  /opt/homebrew/bin
  /opt/homebrew/sbin
  /opt/homebrew/opt/ruby/bin
  /opt/homebrew/lib/ruby/gems/3.3.0/bin
  /home/linuxbrew/.linuxbrew/bin
  /home/jdx/.cargo/bin
  /home/jdx/go/bin
  /home/jdx/.local/bin
  /usr/local/bin
  /System/Cryptexes/App/usr/bin
  /usr/bin
  /bin
  /usr/sbin
  /sbin
  /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin
  /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin
  /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
  /Library/Apple/usr/bin
  /usr/local/MacGPG2/bin
  /Applications/Ghostty.app/Contents/MacOS

env_vars:
  MISE_FISH_AUTO_ACTIVATE=0
  MISE_CACHE_DIR=~/.mise/cache
  MISE_DATA_DIR=~/.mise
  MISE_GITHUB_TOKEN=REDACTED

settings:
  always_keep_download  true  ~/.config/mise/config.toml
  experimental          true  ~/.config/mise/config.toml
  lockfile              true  ~/.config/mise/config.toml
  use_versions_host     false ~/.config/mise/config.toml
  yes                   true  ~/.config/mise/config.toml

3 problems found:

1. plugin mint-lang/asdf-mint is not installed

2. mise is not activated, run mise help activate or
   read documentation at https://mise.jdx.dev for activation instructions.
   Alternatively, add the shims directory ~/.mise/shims to PATH.
   Using the shims directory is preferred for non-interactive setups.

3. unused shims are present, run mise reshim to remove them
   Unused shims: nimble

@jdx
Copy link
Owner Author

jdx commented Apr 15, 2025

it's 384e35e:

mise  HEAD (384e35e) (BISECTING) ❯ m tool opentofu
   Compiling mise v2025.4.2 (/Users/jdx/src/mise)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.58s
     Running `target/debug/mise tool opentofu`
Backend:            aqua:opentofu/opentofu
Installed Versions: 1.6.2 1.9.0
Active Version:     1.9.0
Requested Version:  latest
Config Source:      ~/.config/mise/config.toml
Tool Options:       exe="tofu"
mise  HEAD (384e35e) (BISECTING) ❯ git co HEAD^
Previous HEAD position was 384e35e98 feat(ubi): add support for self-hosted GitHub/GitLab (#4765)
HEAD is now at c8374c00c docs: correct `mise use` paths
mise  HEAD (c8374c0) (BISECTING) ❯ m tool opentofu
   Compiling mise v2025.4.2 (/Users/jdx/src/mise)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.98s
     Running `target/debug/mise tool opentofu`
Backend:            aqua:opentofu/opentofu
Installed Versions: 1.6.2 1.9.0
Active Version:     1.9.0
Requested Version:  latest
Config Source:      ~/.config/mise/config.toml
Tool Options:       [none]

jdx referenced this issue Apr 15, 2025
Fixes #4749

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
@jdx
Copy link
Owner Author

jdx commented Apr 15, 2025

it's very weird this seems to be importing backend options from the non-default and default registry backends. I added "aqua:opentofu/opentofu[foo=bar]", to registry.toml and got this:

mise  main  1 ❯ m tool opentofu
   Compiling mise v2025.4.4 (/Users/jdx/src/mise)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 7.70s
     Running `target/debug/mise tool opentofu`
Backend:            aqua:opentofu/opentofu[foo=bar]
Installed Versions: 1.6.2 1.9.0
Active Version:     1.9.0
Requested Version:  latest
Config Source:      ~/.config/mise/config.toml
Tool Options:       exe="tofu",foo="bar"

So I think this exposed 2 bugs, first that we're using more backends than we should but also that backend options are ending up in mise.toml.

@jdx
Copy link
Owner Author

jdx commented Apr 15, 2025

I think fixing this is going to be tricky since it basically means our method of adding the backend tool options on the tool will import things into the file

@roele
Copy link
Contributor

roele commented Apr 15, 2025

AFAIR backend options from ubi were added to the mise.toml before at least when passed via use in brackets tool[option=value] which makes sense.

@jdx
Copy link
Owner Author

jdx commented Apr 15, 2025

I'll think about this one a bit unless you have a good idea. I'm wondering if we should abort this plan to merge and instead find a way to pull in the tool options in the version listing

@jdx
Copy link
Owner Author

jdx commented Apr 15, 2025

though... in theory you could have a mise.toml like this:

[tools]
foo = [
  {version = "1", options = "x"},
  {version = "2", options = "y"},
]

so our data model may not support putting the options in version listing at all

@jdx
Copy link
Owner Author

jdx commented Apr 15, 2025

update: neither me nor @roele can repro in a container. I'm going to see if I can repro in a container or e2e test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants