mbtproject / mbt

The most flexible build tool for monorepo
https://github.com/mbtproject
Apache License 2.0
219 stars 35 forks source link

MBT run-in with -c throws error on GitHub actions - Ubuntu 20.04.4 LTS #144

Open swaroopbhatk opened 2 years ago

swaroopbhatk commented 2 years ago

Having trouble running mbt in GitHub actions. I am facing probglem with -c flag

command used:

mbt run-in -m test commit -c "$(git rev-parse HEAD)"

Debug Trace:

DEBU[0000] Commit &{{0x28eba70 0xc0001544c0} 0x28eba70} has 1 parents (@github.com/mbtproject/mbt/lib.(*stdLog).Debug log.go,80) 
DEBU[0000] Changes are based on parent <nil> (@github.com/mbtproject/mbt/lib.(*stdLog).Debug log.go,80) 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x6290a6]

goroutine 1 [running]:
github.com/mbtproject/mbt/vendor/github.com/libgit2/git2go.(*Commit).Tree.func1(0xc0000dc5e8, 0x0, 0x1)
        /home/runner/work/mbt/src/github.com/mbtproject/mbt/vendor/github.com/libgit2/git2go/commit.go:72 +0x26
github.com/mbtproject/mbt/vendor/github.com/libgit2/git2go.(*Commit).Tree(0x0, 0x0, 0x0, 0x0)
        /home/runner/work/mbt/src/github.com/mbtproject/mbt/vendor/github.com/libgit2/git2go/commit.go:72 +0x89
github.com/mbtproject/mbt/lib.(*libgitRepo).Changes(0xc000153e30, 0x868540, 0xc0000c3ad0, 0xd04310, 0x0, 0x0, 0x0, 0x0)
        /home/runner/work/mbt/src/github.com/mbtproject/mbt/lib/repo.go:186 +0x20d
github.com/mbtproject/mbt/lib.(*stdManifestBuilder).ByCommitContent.func1(0xc000153e30, 0x0, 0x0)
        /home/runner/work/mbt/src/github.com/mbtproject/mbt/lib/manifest_builder.go:96 +0xcb
github.com/mbtproject/mbt/lib.(*stdManifestBuilder).runManifestBuilder(0xc000154500, 0xc000158600, 0x4, 0xc0000c51a0, 0x38)
        /home/runner/work/mbt/src/github.com/mbtproject/mbt/lib/manifest_builder.go:181 +0xb8
github.com/mbtproject/mbt/lib.(*stdManifestBuilder).ByCommitContent(0xc000154500, 0x868540, 0xc0000c3ad0, 0x868540, 0xc0000c3ad0, 0x0)
        /home/runner/work/mbt/src/github.com/mbtproject/mbt/lib/manifest_builder.go:90 +0x7b
github.com/mbtproject/mbt/lib.(*stdSystem).ManifestByCommitContent(0xc0000fa0e0, 0x7ffe9b65475a, 0x28, 0x7dee60, 0x1, 0xc000154540)
        /home/runner/work/mbt/src/github.com/mbtproject/mbt/lib/manifest.go:55 +0xa5
github.com/mbtproject/mbt/lib.(*stdSystem).BuildCommitContent(0xc0000fa0e0, 0x7ffe9b65475a, 0x28, 0xc000154540, 0x6, 0x5, 0xc000153e60)
        /home/runner/work/mbt/src/github.com/mbtproject/mbt/lib/build.go:90 +0x43
github.com/mbtproject/mbt/cmd.glob..func9(0xcca940, 0xc000153da0, 0x1, 0x3, 0x86faa0, 0xc0000fa0e0)
        /home/runner/work/mbt/src/github.com/mbtproject/mbt/cmd/build.go:116 +0x10e
github.com/mbtproject/mbt/cmd.buildHandler.func1(0xcca940, 0xc000153da0, 0x1, 0x3, 0x0, 0x0)
        /home/runner/work/mbt/src/github.com/mbtproject/mbt/cmd/build_handler.go:30 +0x57
github.com/mbtproject/mbt/vendor/github.com/spf13/cobra.(*Command).execute(0xcca940, 0xc000153d40, 0x3, 0x3, 0xcca940, 0xc000153d40)
        /home/runner/work/mbt/src/github.com/mbtproject/mbt/vendor/github.com/spf13/cobra/command.go:698 +0x431
github.com/mbtproject/mbt/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xccc2c0, 0x0, 0x0, 0x6b454d)
        /home/runner/work/mbt/src/github.com/mbtproject/mbt/vendor/github.com/spf13/cobra/command.go:783 +0x2ca
github.com/mbtproject/mbt/vendor/github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/work/mbt/src/github.com/mbtproject/mbt/vendor/github.com/spf13/cobra/command.go:736

Kernel:

Static hostname: fv-az128-613
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 74072d6ea45543a08fa7f3ec7f09e15a
           Boot ID: 07bda2ea90614d46b4c5cd244b26e8bd
    Virtualization: microsoft
  Operating System: Ubuntu 20.04.4 LTS
            Kernel: Linux 5.13.0-1021-azure
      Architecture: x86-64

Any help will be really appreciated. Thank you in advance.

buddhike commented 2 years ago

Thanks for reporting this issue @swaroopbhatk. Just curious, does this happen only when you have one commit in your repo?

hightoxicity commented 1 year ago

Hi @swaroopbhatk , your issue looks like the same as the one I had few weeks ago (https://github.com/mbtproject/mbt/issues/146). You should check that your CI is not doing a swallow git checkout of your repository, it could explain why mbt get nil when trying to look at git history.