Skip to content
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

Bug when working with case insensitive file systems #1426

Closed
IzumiSy opened this issue Nov 20, 2021 · 6 comments · Fixed by #1446
Closed

Bug when working with case insensitive file systems #1426

IzumiSy opened this issue Nov 20, 2021 · 6 comments · Fixed by #1446
Labels
type:bug Something isn't working

Comments

@IzumiSy
Copy link
Contributor

IzumiSy commented Nov 20, 2021

Once I initialized git in the directory where Earthfile exists, it says the error: Error: build target: build main: bkClient.Build: failed to solve: resolve build context for target +all: unexpected non-relative path within git dir

I found the related issue (#449), but hasn't it been released yet?

Version

earthly version v0.5.24 darwin/amd64; macOS 10.15 Catalina

Reproduction steps

izumi@rss0110npc earthly_test % earthly --version
earthly version v0.5.24 darwin/amd64; macOS 10.15 Catalina

izumi@rss0110npc earthly_test % ls -la
total 16
drwxr-xr-x    4 izumi  2016574179   128 Nov 20 13:16 .
drwxr-xr-x  104 izumi  2016574179  3328 Nov 20 12:23 ..
-rw-r--r--    1 izumi  2016574179   452 Nov 20 13:09 Earthfile
-rw-r--r--    1 izumi  2016574179    72 Nov 19 13:47 main.go

# Earthly build succeeds
izumi@rss0110npc earthly_test % earthly +all
           buildkitd | Found buildkit daemon as docker container (earthly-buildkitd)
golang:1.15-alpine3.13 | --> Load metadata linux/amd64
             context | --> local context .
               +base | --> FROM golang:1.15-alpine3.13
               +base | [██████████] resolve docker.io/library/golang:1.15-alpine3.13@sha256:330f31a4415d97bb64f244d5f4d838bea7a7ee1ab5a1a0bac49e7973c57cbb88 ... 100%
             context | transferred 0 file(s) for context . (26 B, 1 file/dir stats)
               +base | *cached* --> RUN apk --update --no-cache add git
               +base | *cached* --> WORKDIR /go-example
              +build | *cached* --> COPY main.go .
              +build | *cached* --> RUN go build -o build/go-example main.go
              +build | *cached* --> SAVE ARTIFACT build/go-example +build/go-example
               +lint | *cached* --> RUN go get golang.org/x/lint/golint
               +lint | *cached* --> COPY main.go .
               +lint | *cached* --> RUN golint -set_exit_status ./...
             +docker | *cached* --> COPY +build/go-example ./
              output | --> exporting outputs
              output | [██████████] exporting layers ... 100%
              output | [██████████] exporting manifest sha256:5c7d120e8679a2a418f4be4704f0e7acdc65e69cfa383a651e83ade30460aed2 ... 100%
              output | [██████████] exporting config sha256:c1e672d7b11234083f847a6e11b62142e969721db8090160c1f92ae563dc8b60 ... 100%
              output | [██████████] copying files ... 100%
              output | [██████████] transferring (via tar) docker.io/library/go-example:latest ... 100%
================================ SUCCESS [main] ================================
             +docker | Image +docker as go-example:latest
              +build | Artifact +build/go-example as local build/go-example
              
izumi@rss0110npc earthly_test % git init
Initialized empty Git repository in /Users/izumi/Devs/earthly_test/.git/

izumi@rss0110npc earthly_test % git add .
izumi@rss0110npc earthly_test % git commit -m "first commit"
[master (root-commit) ff0154c] first commit
 3 files changed, 29 insertions(+)
 create mode 100644 Earthfile
 create mode 100755 build/go-example
 create mode 100644 main.go
 
# Earthly build fails
izumi@rss0110npc earthly_test % earthly +all
           buildkitd | Found buildkit daemon as docker container (earthly-buildkitd)
Error: build target: build main: bkClient.Build: failed to solve: resolve build context for target +all: unexpected non-relative path within git dir

Files

Earthfile

FROM golang:1.15-alpine3.13
RUN apk --update --no-cache add git
WORKDIR /go-example

all:
  BUILD +lint
  BUILD +docker

build:
  COPY main.go .
  RUN go build -o build/go-example main.go
  SAVE ARTIFACT build/go-example AS LOCAL build/go-example

lint:
  RUN go get golang.org/x/lint/golint
  COPY main.go .
  RUN golint -set_exit_status ./...

docker:
  COPY +build/go-example .
  ENTRYPOINT ["/go-example/go-example"]
  SAVE IMAGE go-example:latest

Go

package main

import "fmt"

func main() {
        fmt.Println("hello world")
}
@IzumiSy IzumiSy changed the title Earthly build fails when .git directory exists in the same directory as Earthfile does Earthly build fails when .git directory exists in the same directory as Earthfile does Nov 20, 2021
@IzumiSy IzumiSy changed the title Earthly build fails when .git directory exists in the same directory as Earthfile does Earthly build fails when .git directory exists in the same directory as Earthfile does Nov 20, 2021
@vladaionescu vladaionescu added the type:bug Something isn't working label Nov 20, 2021
@vladaionescu
Copy link
Member

Hi @IzumiSy - I'm not able to reproduce. I ran the exact same steps and it's working fine for me.

Is there anything particularly special about your setup? The error does seem strange...

@IzumiSy
Copy link
Contributor Author

IzumiSy commented Nov 21, 2021

I am just still digging into this issue some more...

For more information, my WSL2 environment has just worked with the same steps.

$ earthly --version
earthly version v0.5.24 linux/amd64; Ubuntu 20.04

@IzumiSy
Copy link
Contributor Author

IzumiSy commented Nov 26, 2021

Tried re-installing and bootstrap, but no help.

$ brew install earthly/earthly/earthly
==> Downloading https://github.com/earthly/homebrew-earthly/releases/download/earthly-0.6.0/earthly-0.6.0.catalina.bottle.tar.gz
==> Downloading from https://github-releases.githubusercontent.com/384258633/2ad45a77-1f3f-45dd-9a42-be5519449b86?X-Amz-Algorithm=AWS4-HMAC-SH
######################################################################## 100.0%
==> Installing earthly from earthly/earthly
==> Pouring earthly-0.6.0.catalina.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/earthly/0.6.0: 8 files, 32.7MB
Removing: /Users/izumi/Library/Caches/Homebrew/earthly--0.5.24.catalina.bottle.tar.gz... (14.9MB)

$ earthly --version
earthly version v0.6.0 darwin/amd64; macOS 10.15 Catalina

$ earthly bootstrap
           buildkitd | Found buildkit daemon as docker container (earthly-buildkitd)
           buildkitd | Updated image available. Restarting buildkit daemon...
           buildkitd | ...Done
           bootstrap | Bootstrapping successful.

$ cd ~/devs/earthly_simple/
$ earthly +all

 1. Init 🚀
————————————————————————————————————————————————————————————————————————————————

           buildkitd | Found buildkit daemon as docker container (earthly-buildkitd)


 2. Build 🔧
————————————————————————————————————————————————————————————————————————————————

Error: build target: build main: bkClient.Build: failed to solve: resolve build context for target +all: unexpected non-relative path within git dir

@IzumiSy
Copy link
Contributor Author

IzumiSy commented Nov 26, 2021

Currently looking into codes by checking out earthly to my local...

@IzumiSy
Copy link
Contributor Author

IzumiSy commented Nov 26, 2021

Gotcha. This is caused by case-sensitiveness.

izumi@rss0110npc earthly % pwd
/Users/izumi/devs/earthly

izumi@rss0110npc earthly % ls -la -d ~/*/ | head -n 10
drwx------@   5 izumi  2016574179    160 Jan 22  2019 /Users/izumi/Applications/
drwxr-xr-x    4 izumi  2016574179    128 Apr  2  2018 /Users/izumi/Boostnote/
drwx------+   5 izumi  2016574179    160 Sep  2  2020 /Users/izumi/Desktop/
drwxr-xr-x  105 izumi  2016574179   3360 Nov 26 17:38 /Users/izumi/Devs/  # <-- this is not "devs", but "Devs"!!
drwx------@  35 izumi  2016574179   1120 Nov 26 11:19 /Users/izumi/Documents/
drwx------@  18 izumi  2016574179    576 Nov 26 18:17 /Users/izumi/Downloads/
drwx------@  75 izumi  2016574179   2400 Sep 15 14:15 /Users/izumi/Library/
drwx------+   6 izumi  2016574179    192 Aug  8  2020 /Users/izumi/Movies/
drwx------+   5 izumi  2016574179    160 Aug  8  2020 /Users/izumi/Music/
drwx------+ 322 izumi  2016574179  10304 Nov 26 13:46 /Users/izumi/Pictures/

@IzumiSy
Copy link
Contributor Author

IzumiSy commented Nov 26, 2021

I will open a PR to deal with this case.

@vladaionescu vladaionescu changed the title Earthly build fails when .git directory exists in the same directory as Earthfile does Bug when working with case insensitive file systems Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
2 participants