getporter / porter

Porter enables you to package your application artifact, client tools, configuration and deployment logic together as an installer that you can distribute, and install with a single command.
https://porter.sh
Apache License 2.0
1.23k stars 206 forks source link

Attempting to build from published source tar.gz fails #3064

Closed dgannon991 closed 6 months ago

dgannon991 commented 7 months ago

Describe the bug

Downloading the build from https://github.com/getporter/porter/archive/refs/tags/v1.0.17.tar.gz and running go run mage.go Build fails with an error

To Reproduce

Steps to reproduce the behavior:

  1. Download the source from https://github.com/getporter/porter/archive/refs/tags/v1.0.17.tar.gz
  2. Unzip and move into the directory
  3. Run go run mage.go Build

Expected behavior

The program builds successfully.

Porter Command and Output

david@Davids-Laptop:~/projects/porter-1.0.17$ go run mage.go Build
panic: running "git rev-parse --short HEAD" failed with exit code 128

goroutine 66 [running]:
github.com/carolynvs/magex/mgx.Must({0x23758c0?, 0xc0000132a8?})
        /home/david/go/pkg/mod/github.com/carolynvs/magex@v0.9.0/mgx/must.go:13 +0xcf
github.com/carolynvs/magex/shx.PreparedCommand.Exec({0xc0006278c0, 0x1})
        /home/david/go/pkg/mod/github.com/carolynvs/magex@v0.9.0/shx/prepared_command.go:131 +0x348
github.com/carolynvs/magex/shx.PreparedCommand.OutputS({0xc0006278c0?, 0xbc?})
        /home/david/go/pkg/mod/github.com/carolynvs/magex@v0.9.0/shx/prepared_command.go:215 +0x90
github.com/carolynvs/magex/shx.(*CommandBuilder).OutputS(0x0?, {0x1fe7dbc?, 0x0?}, {0xc0003d9b68?, 0x0?, 0xc0003de1c0?})
        /home/david/go/pkg/mod/github.com/carolynvs/magex@v0.9.0/shx/command_builder.go:48 +0x25
get.porter.sh/magefiles/releases.getCommit(...)
        /home/david/go/pkg/mod/get.porter.sh/magefiles@v0.6.3/releases/git.go:66
get.porter.sh/magefiles/releases.LoadMetadata.func1()
        /home/david/go/pkg/mod/get.porter.sh/magefiles@v0.6.3/releases/git.go:45 +0xc5
sync.(*Once).doSlow(0x0?, 0x0?)
        /home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
        /home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/sync/once.go:65
get.porter.sh/magefiles/releases.LoadMetadata()
        /home/david/go/pkg/mod/get.porter.sh/magefiles@v0.6.3/releases/git.go:42 +0x48
get.porter.sh/magefiles/releases.getLDFLAGS({0x20046e8, 0x14})
        /home/david/go/pkg/mod/get.porter.sh/magefiles@v0.6.3/releases/build.go:22 +0x2f
get.porter.sh/magefiles/releases.build({0x20046e8?, 0x1fee0c7?}, {0x1fea4db, 0x6}, {0xc00010f5c0, 0x1b}, {0x1fe9107, 0x5}, {0x1fe910c, 0x5})
        /home/david/go/pkg/mod/get.porter.sh/magefiles@v0.6.3/releases/build.go:27 +0x5a
get.porter.sh/magefiles/releases.BuildRuntime({0x20046e8, 0x14}, {0x1fea4db, 0x6}, {0x1fe7dad?, 0x0?})
        /home/david/go/pkg/mod/get.porter.sh/magefiles@v0.6.3/releases/build.go:47 +0xf5
get.porter.sh/magefiles/releases.BuildAll.func2()
        /home/david/go/pkg/mod/get.porter.sh/magefiles@v0.6.3/releases/build.go:61 +0x2b
golang.org/x/sync/errgroup.(*Group).Go.func1()
        /home/david/go/pkg/mod/golang.org/x/sync@v0.5.0/errgroup/errgroup.go:75 +0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 45
        /home/david/go/pkg/mod/golang.org/x/sync@v0.5.0/errgroup/errgroup.go:72 +0x96
exit status 2

Version

Copy the output of porter version below

Attempting with the latest v1.0.17

schristoff commented 6 months ago

What is your system and arch? On Darwin/M3 I am also getting errors (no panics), but:

➜  porter-1.0.17 go run mage.go Build
Installing protoc-gen-go@v1.28 into GOPATH/bin
# math/bits
compile: version "go1.21.3" does not match go tool version "go1.21.1"
# internal/goos
compile: version "go1.21.3" does not match go tool version "go1.21.1"
# internal/goarch
compile: version "go1.21.3" does not match go tool version "go1.21.1"
# internal/coverage/rtcov
compile: version "go1.21.3" does not match go tool version "go1.21.1"
# encoding
compile: version "go1.21.3" does not match go tool version "go1.21.1"
# internal/goversion
compile: version "go1.21.3" does not match go tool version "go1.21.1"
# internal/itoa
compile: version "go1.21.3" does not match go tool version "go1.21.1"
# internal/unsafeheader
compile: version "go1.21.3" does not match go tool version "go1.21.1"
# internal/goexperiment
compile: version "go1.21.3" does not match go tool version "go1.21.1"
# google.golang.org/protobuf/internal/flags
compile: version "go1.21.3" does not match go tool version "go1.21.1"
# internal/race
compile: version "go1.21.3" does not match go tool version "go1.21.1"
# unicode/utf8
compile: version "go1.21.3" does not match go tool version "go1.21.1"
# unicode
compile: version "go1.21.3" does not match go tool version "go1.21.1"
# internal/godebugs
compile: version "go1.21.3" does not match go tool version "go1.21.1"
# unicode/utf16
compile: version "go1.21.3" does not match go tool version "go1.21.1"
# sync/atomic
compile: version "go1.21.3" does not match go tool version "go1.21.1"
# internal/cpu
compile: version "go1.21.3" does not match go tool version "go1.21.1"
Error: running "go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28" failed with exit code 1

This may be a good call for @troy0820 who is magic with these issues

dgannon991 commented 6 months ago

Ah sorry, useful debugging information!

➜  porter-1.0.17 arch
x86_64
➜  porter-1.0.17 cat /etc/os-release
PRETTY_NAME="Ubuntu 23.10"
NAME="Ubuntu"
VERSION_ID="23.10"
VERSION="23.10 (Mantic Minotaur)"
VERSION_CODENAME=mantic
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=mantic
LOGO=ubuntu-logo
dgannon991 commented 6 months ago

Looking at the line it's blowing up on, it appears to expect the folder to be a git repostiory. Having a look through the magefiles it appears to be attempting to get the git information to use as the ldflags on the go build command (https://github.com/getporter/magefiles/blob/85393f1aa46312c20979c4cd8398b662f538dc70/releases/build.go#L27)