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
Artifacts of intermediate targets not stored #4100
Comments
I believe this is the expected behavior. Here is where the docs explain this: https://docs.earthly.dev/docs/earthfile#save-image
https://docs.earthly.dev/docs/earthfile#save-artifact
So the explanation is that I ran into this same point of confusion not too long ago. I also had assumed that a |
Perhaps. Note that the url linked in the docs "if they are connected to the initial target through a chain of BUILD commands" is broken and apparently needs to point at the section in the BUILD command. |
I think this section in FROM probably makes it clearer:
Though the examples there still use |
Actually the docs still don't make it clear to me how to adjust the tests described above to make it work and have both outputs. What I expect is to setup a chain of dependencies and (just like using a |
Changing the Earthfile to this seems to work: VERSION 0.8
docker:
FROM ubuntu:22.04
SAVE IMAGE earthly-test:latest
build:
BUILD +docker
FROM +docker
COPY --dir input ./
SAVE ARTIFACT input AS LOCAL output
tests:
BUILD +build
all:
BUILD +tests Which generates all outputs when invoking targets
|
I had a look to see if this could be fixed, but unfortunately the anchor has disappeared. The docs are hosted via gitbook, which makes it difficult to fix these sorts of issues which come from bugs (or feature changes) in gitbook. |
The |
is how it's intended to be used. The If you really want to get into the weeds, you can also create a function to do both, e.g.
|
What went wrong?
It seems
SAVE ARTIFACT
andSAVE IMAGE
are only effective when you directly call the target that has the statement.Test 1
If you have this Earthfile:
There are a few issues here, when calling some commands.
earthly +all
earthly +build
earthly +docker
Note that the output directory is also created when calling
+all
Test 2
If we add another intermediate target like this:
Then we get this:
earthly +all
earthly +tests
earthly +build
earthly +docker
Note that the output directory is not created when calling
+tests
or+all
, which did work in previous test.Running
earthly
with--no-cache
yields the same result.What should have happened?
The expected outcome would be that Earthly creates the artifacts also consistently when there is a target in a "chain" with a
SAVE
statement.What earthly version?
earthly version v0.8.9 a2fc61e darwin/arm64; macOS 14.1 homebrew
Buildkit Logs
No response
Other Helpful Information
Of course it is still possible we misunderstand Earthly behaviour or are misreading the documentation.
The text was updated successfully, but these errors were encountered: