Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Env vars defined in [env] section cannot be used in [tools] configurations #3775

Closed
bartsmykla opened this issue Dec 22, 2024 · 0 comments
Closed
Labels

Comments

@bartsmykla
Copy link

Describe the bug
Env vars defined earlier in the [env] section cannot be used in tools versions. This makes it impossible to dynamically define commands for fetching tool versions based on reusable env vars.

To Reproduce

  1. Define the following in your configuration:
    [env]
    CMD_FORMAT = 'grep -oE "tool v[0-9.]+" go.mod | grep -oE "[0-9.]+$"'
    
    [tools]
    kube-controller-tools = """
    {%- set tool = 'sigs.k8s.io/controller-tools' -%}
    {%- set command = env.CMD_FORMAT | replace(from='tool', to=tool) -%}
    
    {{- exec(cache_key=tool, command=command) -}}
    """
  2. Run a command or task that tries to evaluate the tool version.

Expected behavior
The env var CMD_FORMAT should be usable in the tools section to dynamically define commands, allowing reusable and concise configuration.

mise doctor output

version: 2024.12.17 macos-arm64 (6abef71 2024-12-21)
activated: yes
shims_on_path: no

build_info:
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Sat, 21 Dec 2024 16:00:07 +0000
  Rust Version: rustc 1.83.0 (90b35a623 2024-11-26)
  Profile: release

shell:
  /opt/homebrew/bin/fish
  fish, version 3.7.1

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

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

ignored_config_files: (none)

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

plugins:
  clang-format           [email protected]:higebu/asdf-llvm.git#c527fd9
  kube-controller-tools  [email protected]:jimmidyson/asdf-kube-controller-tools.git#37526dc
  oapi-codegen           [email protected]:dylanrayboss/asdf-oapi-codegen.git#a988840

toolset:
  aqua:GoogleContainerTools/[email protected]
  aqua:etcd-io/[email protected]
  aqua:golangci/[email protected]
  aqua:helm/[email protected]
  aqua:jqlang/[email protected]
  aqua:koalaman/[email protected]
  aqua:kubernetes-sigs/[email protected]
  aqua:kubernetes/[email protected]
  aqua:norwoodj/[email protected]
  aqua:protocolbuffers/protobuf-go/[email protected]
  aqua:protocolbuffers/protobuf/[email protected]
  aqua:stackrox/[email protected]
  asdf:[email protected]
  asdf:[email protected]
  core:[email protected]
  go:github.com/envoyproxy/[email protected]
  go:github.com/google/osv-scanner/cmd/[email protected]
  go:github.com/onsi/ginkgo/v2/[email protected]
  go:github.com/pubg/[email protected]
  go:google.golang.org/grpc/cmd/[email protected]
  ubi:hadolint/[email protected]
  ubi:jdx/[email protected]
  ubi:k3d-io/[email protected]
  ubi:kubernetes-sigs/[email protected]
  ubi:mikefarah/[email protected]

path:
  ~/.local/share/mise/installs/container-structure-test/1.19.3
  ~/.local/share/mise/installs/etcd/3.5.17/etcd-v3.5.17-darwin-amd64
  ~/.local/share/mise/installs/go/1.23.4/bin
  ~/.local/share/mise/installs/ginkgo/2.22.0/bin
  ~/.local/share/mise/installs/golangci-lint/1.62.0/golangci-lint-1.62.0-darwin-arm64
  ~/.local/share/mise/installs/hadolint/2.12.0/bin
  ~/.local/share/mise/installs/helm/3.16.4/darwin-arm64
  ~/.local/share/mise/installs/helm-docs/1.11.0
  ~/.local/share/mise/installs/jq/1.7.1
  ~/.local/share/mise/installs/k3d/5.7.5/bin
  ~/.local/share/mise/installs/kind/0.26.0/bin
  ~/.local/share/mise/installs/kube-controller-tools/0.16.5/bin
  ~/.local/share/mise/installs/kube-linter/0.6.5
  ~/.local/share/mise/installs/kubebuilder/4.3.1
  ~/.local/share/mise/installs/kubectl/1.32.0
  ~/.local/share/mise/installs/oapi-codegen/2.4.1/bin
  ~/.local/share/mise/installs/osv-scanner/1.9.1/bin
  ~/.local/share/mise/installs/protoc/3.20.0/bin
  ~/.local/share/mise/installs/protoc-gen-go/1.28.1
  ~/.local/share/mise/installs/protoc-gen-go-grpc/1.1.0/bin
  ~/.local/share/mise/installs/protoc-gen-jsonschema/0.6.2/bin
  ~/.local/share/mise/installs/protoc-gen-validate/v1.1.0/bin
  ~/.local/share/mise/installs/shellcheck/0.10.0/shellcheck-v0.10.0
  ~/.local/share/mise/installs/yq/4.30.8/bin
  ~/.local/share/mise/installs/usage/1.7.2/bin
  ~/.local/share/mise/installs/go/1.23.4/bin
  ~/.local/bin
  /opt/homebrew/bin
  /opt/homebrew/sbin
  /opt/homebrew/opt/make/libexec/gnubin
  /opt/homebrew/opt/coreutils/libexec/gnubin
  ~/.cargo/bin
  /bin
  ~/go/bin
  ~/bin
  /usr/local/opt/libiconv/bin
  /usr/local/sbin
  /usr/local/opt/ruby/bin
  /usr/local/opt/curl/bin
  /usr/local/opt/fzf/bin
  /opt/homebrew/opt/fzf/bin
  /usr/local/bin
  /System/Cryptexes/App/usr/bin
  /usr/bin
  /usr/sbin
  /sbin
  /Library/Apple/usr/bin
  /usr/local/MacGPG2/bin
  /Applications/Wireshark.app/Contents/MacOS

env_vars:
  MISE_SHELL=fish

settings:
  experimental  true ~/.config/mise/config.toml
  experimental  true ~/foo/mise.toml

No problems found
@bartsmykla bartsmykla added the bug label Dec 22, 2024
Repository owner locked and limited conversation to collaborators Dec 22, 2024
@jdx jdx converted this issue into discussion #3782 Dec 22, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

1 participant