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

use-copy-link changes WORKDIR when used with GIT CLONE #2544

Open
Tracked by #2237
alexcb opened this issue Jan 4, 2023 · 2 comments
Open
Tracked by #2237

use-copy-link changes WORKDIR when used with GIT CLONE #2544

alexcb opened this issue Jan 4, 2023 · 2 comments
Labels
type:bug Something isn't working

Comments

@alexcb
Copy link
Contributor

alexcb commented Jan 4, 2023

VERSION --use-copy-link 0.6
FROM alpine:3.15

WORKDIR /test

gitclone:
    RUN test "$(pwd)" = "/test"
    GIT CLONE --branch main https://github.com/earthly/earthly repo
    RUN test "$(pwd)" = "/test" || (echo "pwd=$(pwd) instead of /test" && exit 1) # this fails

failure:

/h/a/t/workdir-not-inherited+base | --> FROM alpine:3.15
/h/a/t/workdir-not-inherited+base | [----------] 100% resolve docker.io/library/alpine:3.15@sha256:cf34c62ee8eb3fe8aa24c1fab45d7e9d12768d945c3f5a6fd6a63d901e898479
/h/a/t/workdir-not-inherited+base | --> WORKDIR /test
/h/a/t/w/earthly)(git@github.com:earthly/earthly) | --> GIT CLONE (--branch main) git@github.com:earthly/earthly
/h/a/t/workdir-not-inherited+gitclone | --> RUN test "$(pwd)" = "/test"
/h/a/t/w/earthly)(git@github.com:earthly/earthly) | 416dce0cf5a1eb2e635ff18b30436fb7d9b05a09	refs/heads/main
/h/a/t/workdir-not-inherited+gitclone | --> COPY GIT CLONE (--branch main) git@github.com:earthly/earthly TO repo
/h/a/t/workdir-not-inherited+gitclone | [----------] 100% merging
/h/a/t/workdir-not-inherited+gitclone | --> RUN test "$(pwd)" = "/test" || (echo "pwd=$(pwd)" && exit 1)
/h/a/t/workdir-not-inherited+gitclone | pwd=/
/h/a/t/workdir-not-inherited+gitclone | ERROR /home/alex/test/workdir-not-inherited/Earthfile line 9:4
/h/a/t/workdir-not-inherited+gitclone |       The command
/h/a/t/workdir-not-inherited+gitclone |           RUN test "$(pwd)" = "/test" || (echo "pwd=$(pwd)" && exit 1)
/h/a/t/workdir-not-inherited+gitclone |       did not complete successfully. Exit code 1

============================ ❌ FAILURE [2. Build 🔧] ============================
@alexcb alexcb added the type:bug Something isn't working label Jan 4, 2023
@alexcb alexcb mentioned this issue Jan 4, 2023
16 tasks
@alexcb
Copy link
Contributor Author

alexcb commented Jan 4, 2023

here's a similar failure-case, but using the COPY --keep-own option:

VERSION --use-copy-link 0.6
FROM alpine:3.15

WORKDIR /testwd

data:
    RUN echo data > data
    SAVE ARTIFACT data

copy:
    RUN test "$(pwd)" = "/testwd"
    COPY --keep-own +data/data .
    RUN test "$(pwd)" = "/testwd" || (echo "pwd=$(pwd) instead of /testwd" && exit 1)

@alexcb
Copy link
Contributor Author

alexcb commented Jan 5, 2023

fix in #2546

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
Archived in project
Development

No branches or pull requests

1 participant