Subsequent provider installations fail
applike-ss opened this issue · comments
It seems that when i first install a provider version and sometime later another version that the latter installations fails.
Here's the output:
$ m1-terraform-provider-helper install justtrackio/gosoline -v v0.0.1 Getting provider data from terraform registry
Getting source code...
Enumerating objects: 253, done.
Counting objects: 100% (83/83), done.
Compressing objects: 100% (49/49), done.
Total 253 (delta 53), reused 34 (delta 30), pack-reused 170
Compiling...
Successfully installed justtrackio/gosoline v0.0.1
$ m1-terraform-provider-helper install justtrackio/gosoline -v v0.0.2 Getting provider data from terraform registry
Getting source code...
FATA[0001] Bash execution did not run successfully: exit status 1.
Output:
Im Moment auf keinem Branch. (Not on a branch)
Bitte geben Sie den Branch an, welchen Sie zusammenführen möchten. (You have to specify a branch which you want to merge)
Siehe git-pull(1) für weitere Details.
git pull <Remote-Repository> <Branch>
After deleting the .m1-terraform-provider-helper/terraform-provider-gosoline
directory it works just fine to run the latter install command.
Expected Behavior
It should check out the new code, compile and install it
Actual Behavior
It fails to checkout the correct tag (it seems)
Steps to Reproduce (including precondition)
See description
Screenshot on This Problem (if possible)
Your Environment
- OS: MacOS 13.2.1, M2 Pro 16" 32GB
- m1-terraform-provider-helper version: 0.8.1
Hmm, interesting. It works for me. Which git
version are you running? Could you try again with TF_HELPER_LOG=debug
enabled?
We are doing some fancy git
commandery to reset the repo and pull the newest changes from the master/main branch.
Can you post the output of git remote show
after doing the first install?
Hmm, interesting. It works for me. Which
git
version are you running? Could you try again withTF_HELPER_LOG=debug
enabled?
git --version
: git version 2.39.1
which git
: /opt/homebrew/bin/git
TF_HELPER_LOG=debug m1-terraform-provider-helper install justtrackio/gosoline -v v0.0.1
Getting provider data from terraform registry
INFO[0000] Provider data: {https://github.com/justtrackio/terraform-provider-gosoline }
Getting source code...
INFO[0000] Cloning https://github.com/justtrackio/terraform-provider-gosoline to /Users/sebastian/.m1-terraform-provider-helper/terraform-provider-gosoline
Enumerating objects: 253, done.
Counting objects: 100% (82/82), done.
Compressing objects: 100% (49/49), done.
Total 253 (delta 52), reused 33 (delta 29), pack-reused 171
INFO[0000] Resetting /Users/sebastian/.m1-terraform-provider-helper/terraform-provider-gosoline and pulling latest changes
INFO[0000] Bash execution output: HEAD ist jetzt bei 36983bb added app group and refactoring
INFO[0001] Bash execution output: Bereits aktuell.
INFO[0001] Checking out v0.0.1
Compiling...
INFO[0001] Using build command: make build
INFO[0003] Bash execution output: go build -o terraform-provider-gosoline_v0.0.1
INFO[0004] Bash execution output: Terraform v1.3.7
on darwin_arm64
INFO[0004] Installed Terraform version: 1.3.7
INFO[0004] Found custom build path: terraform-provider-gosoline_v0.0.1
INFO[0004] Move from /Users/sebastian/.m1-terraform-provider-helper/terraform-provider-gosoline/terraform-provider-gosoline_v0.0.1 to /Users/sebastian/.terraform.d/plugins/registry.terraform.io/justtrackio/gosoline/0.0.1/darwin_arm64/terraform-provider-gosoline_0.0.1_x5
Successfully installed justtrackio/gosoline v0.0.1
TF_HELPER_LOG=debug m1-terraform-provider-helper install justtrackio/gosoline -v v0.0.2
Getting provider data from terraform registry
INFO[0000] Provider data: {https://github.com/justtrackio/terraform-provider-gosoline }
Getting source code...
INFO[0000] Resetting /Users/sebastian/.m1-terraform-provider-helper/terraform-provider-gosoline and pulling latest changes
INFO[0000] Bash execution output: HEAD ist jetzt bei c9b830f Initial release
FATA[0001] Bash execution did not run successfully: exit status 1.
Output:
Im Moment auf keinem Branch.
Bitte geben Sie den Branch an, welchen Sie zusammenführen möchten.
Siehe git-pull(1) für weitere Details.
git pull <Remote-Repository> <Branch>
We are doing some fancy
git
commandery to reset the repo and pull the newest changes from the master/main branch. Can you post the output ofgit remote show
after doing the first install?
Any other things to help you find the root cause?
The output of the second install is interesting: Bash execution output: HEAD ist jetzt bei c9b830f Initial release
It seems like it somehow cannot pull the newest changes.
Can you run the following commands after the first install and see if they work? (Inside the .m1-terraform-provider-helper/terraform-provider-gosoline
directory):
git remote show origin
git remote show origin | sed -n '/HEAD branch/s/.*: //p'
Have you set any unusual git config parameters?
Here's the terminals content:
$ rm -rf .m1-terraform-provider-helper/terraform-provider-gosoline $ TF_HELPER_LOG=debug m1-terraform-provider-helper install justtrackio/gosoline -v v0.0.1
Getting provider data from terraform registry
INFO[0000] Provider data: {https://github.com/justtrackio/terraform-provider-gosoline }
Getting source code...
INFO[0000] Cloning https://github.com/justtrackio/terraform-provider-gosoline to /Users/sebastian/.m1-terraform-provider-helper/terraform-provider-gosoline
Enumerating objects: 253, done.
Counting objects: 100% (83/83), done.
Compressing objects: 100% (49/49), done.
Total 253 (delta 53), reused 34 (delta 30), pack-reused 170
INFO[0000] Resetting /Users/sebastian/.m1-terraform-provider-helper/terraform-provider-gosoline and pulling latest changes
INFO[0000] Bash execution output: HEAD ist jetzt bei 36983bb added app group and refactoring
INFO[0001] Bash execution output: Bereits aktuell.
INFO[0001] Checking out v0.0.1
Compiling...
INFO[0001] Using build command: make build
INFO[0003] Bash execution output: go build -o terraform-provider-gosoline_v0.0.1
INFO[0003] Bash execution output: Terraform v1.3.7
on darwin_arm64
INFO[0003] Installed Terraform version: 1.3.7
INFO[0003] Found custom build path: terraform-provider-gosoline_v0.0.1
INFO[0003] Move from /Users/sebastian/.m1-terraform-provider-helper/terraform-provider-gosoline/terraform-provider-gosoline_v0.0.1 to /Users/sebastian/.terraform.d/plugins/registry.terraform.io/justtrackio/gosoline/0.0.1/darwin_arm64/terraform-provider-gosoline_0.0.1_x5
Successfully installed justtrackio/gosoline v0.0.1
$ cd .m1-terraform-provider-helper/terraform-provider-gosoline
$ git remote show origin
* Remote-Repository origin
URL zum Abholen: https://github.com/justtrackio/terraform-provider-gosoline
URL zum Versenden: https://github.com/justtrackio/terraform-provider-gosoline
Hauptbranch: main
Remote-Branches:
main gefolgt
renovate/actions-checkout-3.x gefolgt
renovate/actions-setup-go-3.x gefolgt
renovate/github.com-aws-aws-sdk-go-v2-1.x gefolgt
renovate/github.com-aws-aws-sdk-go-v2-config-1.x gefolgt
renovate/github.com-aws-aws-sdk-go-v2-service-ecs-1.x gefolgt
renovate/github.com-aws-aws-sdk-go-v2-service-elasticloadbalancingv2-1.x gefolgt
renovate/github.com-aws-aws-sdk-go-v2-service-kinesis-1.x gefolgt
renovate/github.com-cenkalti-backoff-v4-4.x gefolgt
renovate/github.com-go-resty-resty-v2-2.x gefolgt
renovate/github.com-hashicorp-terraform-plugin-framework-0.x gefolgt
renovate/github.com-stretchr-testify-1.x gefolgt
Lokaler Branch konfiguriert für 'git pull':
main führt mit Remote-Branch main zusammen
Lokale Referenz konfiguriert für 'git push':
main versendet nach main (aktuell)
$ git remote show origin | sed -n '/HEAD branch/s/.*: //p'
# No output here
Ahhh, the culprit is your git
outputting in german :)
I see, so you rely on the output of git inside the application? Would a git library help here maybe?
We are using https://github.com/go-git/go-git already in many parts of the application, now might be the time to use it everywhere, to avoid those kind of bugs
So, this is not really possible with the git library we are using (git remote show origin
actually queries the upstream repository).
Can you check the output with LC_ALL=C git remote show origin | sed -n '/HEAD branch/s/.*: //p'
?
This results in:
$ LC_ALL=C git remote show origin | sed -n '/HEAD branch/s/.*: //p' main
Okay, what is the output with LC_ALL=C git remote show origin
?
This results in
$ LC_ALL=C git remote show origin
* remote origin
Fetch URL: https://github.com/justtrackio/terraform-provider-gosoline
Push URL: https://github.com/justtrackio/terraform-provider-gosoline
HEAD branch: main
Remote branches:
main tracked
renovate/actions-checkout-3.x tracked
renovate/actions-setup-go-3.x tracked
renovate/github.com-aws-aws-sdk-go-v2-1.x tracked
renovate/github.com-aws-aws-sdk-go-v2-config-1.x tracked
renovate/github.com-aws-aws-sdk-go-v2-service-ecs-1.x tracked
renovate/github.com-aws-aws-sdk-go-v2-service-elasticloadbalancingv2-1.x tracked
renovate/github.com-aws-aws-sdk-go-v2-service-kinesis-1.x tracked
renovate/github.com-cenkalti-backoff-v4-4.x tracked
renovate/github.com-go-resty-resty-v2-2.x tracked
renovate/github.com-hashicorp-terraform-plugin-framework-0.x tracked
renovate/github.com-stretchr-testify-1.x tracked
Local branch configured for 'git pull':
main merges with remote main
Local ref configured for 'git push':
main pushes to main (up to date)
Okay, that's perfect and exactly what I wanted to have. Will fix this and release a new version
Awesome, thanks 👍
@applike-ss please try with 0.8.2
I do now actually get this:
$ TF_HELPER_LOG=debug m1-terraform-provider-helper install justtrackio/gosoline -v v0.0.1
panic: exit status 126
goroutine 1 [running]:
github.com/kreuzwerker/m1-terraform-provider-helper/internal/app.GetCurrentGoPath()
/home/runner/work/m1-terraform-provider-helper/m1-terraform-provider-helper/internal/app/utils.go:15 +0xf8
github.com/kreuzwerker/m1-terraform-provider-helper/internal/app.New()
/home/runner/work/m1-terraform-provider-helper/m1-terraform-provider-helper/internal/app/app.go:48 +0x54
github.com/kreuzwerker/m1-terraform-provider-helper/cmd.installCmd.func1(0x14000033800?, {0x14000186ff0, 0x1, 0x3?})
/home/runner/work/m1-terraform-provider-helper/m1-terraform-provider-helper/cmd/install.go:24 +0x3c
github.com/spf13/cobra.(*Command).execute(0x14000033800, {0x14000186f90, 0x3, 0x3})
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:916 +0x5c8
github.com/spf13/cobra.(*Command).ExecuteC(0x14000032600)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044 +0x35c
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:968
main.main()
/home/runner/work/m1-terraform-provider-helper/m1-terraform-provider-helper/cmd/m1-terraform-provider-helper/main.go:11 +0x20
Am i doing something wrong?
I checked that my version now is indeed 0.8.2.
Homebrew installed it with go 1.20 btw., not sure if that makes a difference as i didn't have a chance to try out go 1.20 yet.
Here's brews output:
$ brew install kreuzwerker/taps/m1-terraform-provider-helper
Running `brew update --auto-update`...
==> Downloading https://formulae.brew.sh/api/formula.jws.json
######################################################################## 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
######################################################################## 100.0%
==> Auto-updated Homebrew!
Updated 1 tap (kreuzwerker/taps).
You have 11 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.
m1-terraform-provider-helper 0.8.1 is already installed but outdated (so it will be upgraded).
==> Fetching dependencies for kreuzwerker/taps/m1-terraform-provider-helper: go
==> Fetching go
==> Downloading https://ghcr.io/v2/homebrew/core/go/manifests/1.20.2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/go/blobs/sha256:3517ed5d96d5a40cd4c44a35f7799a239b82d9855a6799c6f60193768f9825cd
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:3517ed5d96d5a40cd4c44a35f7799a239b82d9855a6799c6f60193768f9825cd?se=2023-03-15T14%3A00%3A00Z&sig=zRZVIU6vzuUecHuPB%2B%2BwB5qBKOz7
######################################################################## 100.0%
==> Fetching kreuzwerker/taps/m1-terraform-provider-helper
==> Downloading https://github.com/kreuzwerker/m1-terraform-provider-helper/releases/download/0.8.2/m1-terraform-provider-helper_0.8.2_Darwin_arm64.tar.gz
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/379896850/5ab6ea5e-25a7-482b-80b3-f25d48f78065?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53
######################################################################## 100.0%
==> Upgrading kreuzwerker/taps/m1-terraform-provider-helper
0.8.1 -> 0.8.2
==> Installing dependencies for kreuzwerker/taps/m1-terraform-provider-helper: go
==> Installing kreuzwerker/taps/m1-terraform-provider-helper dependency: go
==> Pouring go--1.20.2.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/go/1.20.2: 11,975 files, 232MB
==> Installing kreuzwerker/taps/m1-terraform-provider-helper
🍺 /opt/homebrew/Cellar/m1-terraform-provider-helper/0.8.2: 6 files, 12.6MB, built in 1 second
==> Running `brew cleanup m1-terraform-provider-helper`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /opt/homebrew/Cellar/m1-terraform-provider-helper/0.8.1... (6 files, 12.5MB)
Removing: /Users/sebastian/Library/Caches/Homebrew/m1-terraform-provider-helper--0.8.1.tar.gz... (4.8MB)
Yeah, I this has something to do with go 1.20
(or something with your go installation changed). What happens if you execute go env GOPATH
?
That results in this:
$ go env GOPATH
No version is set for command go
Consider adding one of the following versions in your config file at /Users/sebastian/.tool-versions
golang 1.18
Note however that i am using asdf, which itself adds the output here.
So since i don't have a go executable in my path, i'd assume that homebrew is using its go version that was downloaded for the installation.
Should i try the brew install again with using a go version below 1.20 via asdf?
Ah, you don't even have go
setup. You need to have a go
setup (because we use go to actually build the provider).
And brew
installing a go version due to it being a dependency apparently does not count as having it correctly setup. It should work with go 1.20
you just need to set it up correctly.
I did now setup a go toolchain 1.20 with my asdf and the provider works.
However brew did download go 1.20 and has poured it.
That would make me conclude that the go from homebrew must somehow not be working.
How else would i be getting a panic (go specific error) instead of a "not executable binary" or so.
The original issue is now resolved:
$ TF_HELPER_LOG=debug m1-terraform-provider-helper install justtrackio/gosoline -v v0.0.1
Getting provider data from terraform registry
INFO[0000] Provider data: {https://github.com/justtrackio/terraform-provider-gosoline }
Getting source code...
INFO[0000] Cloning https://github.com/justtrackio/terraform-provider-gosoline to /Users/sebastian/.m1-terraform-provider-helper/terraform-provider-gosoline
Enumerating objects: 248, done.
Counting objects: 100% (78/78), done.
Compressing objects: 100% (45/45), done.
Total 248 (delta 51), reused 36 (delta 31), pack-reused 170
INFO[0000] Resetting /Users/sebastian/.m1-terraform-provider-helper/terraform-provider-gosoline and pulling latest changes
INFO[0001] Bash execution output: Ihr Branch ist auf demselben Stand wie 'origin/main'.
Bereits aktuell.
INFO[0001] Checking out v0.0.1
Compiling...
INFO[0001] Using build command: make build
INFO[0010] Bash execution output: go build -o terraform-provider-gosoline_v0.0.1
INFO[0010] Bash execution output: Terraform v1.3.7
on darwin_arm64
INFO[0010] Installed Terraform version: 1.3.7
INFO[0010] Found custom build path: terraform-provider-gosoline_v0.0.1
INFO[0010] Move from /Users/sebastian/.m1-terraform-provider-helper/terraform-provider-gosoline/terraform-provider-gosoline_v0.0.1 to /Users/sebastian/.terraform.d/plugins/registry.terraform.io/justtrackio/gosoline/0.0.1/darwin_arm64/terraform-provider-gosoline_0.0.1_x5
Successfully installed justtrackio/gosoline v0.0.1
$ TF_HELPER_LOG=debug m1-terraform-provider-helper install justtrackio/gosoline -v v0.0.2
Getting provider data from terraform registry
INFO[0000] Provider data: {https://github.com/justtrackio/terraform-provider-gosoline }
Getting source code...
INFO[0000] Resetting /Users/sebastian/.m1-terraform-provider-helper/terraform-provider-gosoline and pulling latest changes
INFO[0001] Bash execution output: Ihr Branch ist auf demselben Stand wie 'origin/main'.
Bereits aktuell.
INFO[0001] Checking out v0.0.2
Compiling...
INFO[0001] Using build command: make build
INFO[0001] Bash execution output: go build -o terraform-provider-gosoline_v0.0.2
INFO[0002] Bash execution output: Terraform v1.3.7
on darwin_arm64
INFO[0002] Installed Terraform version: 1.3.7
INFO[0002] Found custom build path: terraform-provider-gosoline_v0.0.2
INFO[0002] Move from /Users/sebastian/.m1-terraform-provider-helper/terraform-provider-gosoline/terraform-provider-gosoline_v0.0.2 to /Users/sebastian/.terraform.d/plugins/registry.terraform.io/justtrackio/gosoline/0.0.2/darwin_arm64/terraform-provider-gosoline_0.0.2_x5
Successfully installed justtrackio/gosoline v0.0.2
Thanks for the update! Glad that it's now working for you!