OpenTofu install broken in windows
Describe the bug
When installing an OpenTofu version tenv on windows with powershell it seems to create the lock file in the incorrect location. Running tenv tofu install 1.7.1 for example creates a lock file at C:\Users\MY_USER\.tenv\OpenTofu\.lock and NOT at C:\Users\MY_USER\.tenv\OpenTofu\1.7.1/.lock it then gets hung up on the improperly created file and errors out
C:\Users\MY_USER> tenv tofu install 1.7.2
Installing OpenTofu 1.7.2
Fetching release information from https://api.github.com/repos/opentofu/opentofu/releases/tags/v1.7.2
2024-05-22T13:00:42.136-0500 [WARN] tenv: can not remove .lock file: error="remove C:\Users\MY_USER\.tenv\OpenTofu\.lock: The process cannot access the file because it is being used by another process."
Error: unexpected value returned by API
Attempting to install it again, I get the following error:
2024-05-22T13:08:57.569-0500 [WARN] tenv: can not write .lock file, will retry: error="open C:\Users\TroyKnapp\.tenv\OpenTofu\.lock: The file exists."
If I delete the lock file while the process is hanging, it acts like its working, then it fails the cosign check:
Installing OpenTofu 1.7.1
Fetching release information from https://api.github.com/repos/opentofu/opentofu/releases/tags/v1.7.1
Downloading https://github.com/opentofu/opentofu/releases/download/v1.7.1/tofu_1.7.1_windows_amd64.zip
Downloading https://github.com/opentofu/opentofu/releases/download/v1.7.1/tofu_1.7.1_SHA256SUMS
Downloading https://github.com/opentofu/opentofu/releases/download/v1.7.1/tofu_1.7.1_SHA256SUMS.sig
Downloading https://github.com/opentofu/opentofu/releases/download/v1.7.1/tofu_1.7.1_SHA256SUMS.pem
Error: cosign check failed
Usage:
tenv tofu install [version] [flags]
Flags:
-a, --arch string specify arch for binaries downloading (default "amd64")
-t, --github-token string GitHub token (increases GitHub REST API rate limits)
-h, --help help for install
-k, --key-file string local path to PGP public key file (replace check against remote one)
-c, --remote-conf string path to remote configuration file (advanced settings)
-u, --remote-url string remote url to install from
Global Flags:
-q, --quiet no unnecessary output (and no log)
-r, --root-path string local path to install versions of OpenTofu, Terraform and Terragrunt (default "C:\\Users\\TroyKnapp\\.tenv")
-v, --verbose verbose output (and set log level to Trace)
cosign check failed
tenv works as expected for Terraform in windows and as expected in the WSL environment (installed via brew) for both Terraform and OpenTofu
To Reproduce Steps to reproduce the behavior:
- open powershell window
-
tenv tofu install 1.7.1 - see error
- delete the lock file
-
tenv tofu install 1.7.1 - see error
Expected behavior Installing OpenTofu should create an executable in the windows OS
Screenshots If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
- OS: Windows 10 and WSL Ubuntu
- tenv version 1.11.2
Additional context Add any other context about the problem here.