Summary
The text discusses problems with the SAVE ARTIFACT
command, which now supports directories via wildcard usage but encounters errors in a TRY/CATCH/FINALLY structure due to its inability to handle wildcard paths. The sender requests Christian to share his Earthfile code and proposes manually implementing logic in bash to manage non-zero exits to avoid failures in the earthly build.
c.ruppert
hm, yeah, that could work
brandon
hmm, I guess the SAVE ARTIFACT is implemented differently in the TRY/FINALLY context :confused: Wonder if you could implement the logic manually, e.g. handling the non-zero exit in bash so that the earthly build doesn’t fail
c.ruppert
earthly version v0.8.15 cb38f72663696d17d8393b1cc8bac66aed28faa2 linux/amd64; Ubuntu 24.04 LTS (Noble Numbat)
c.ruppert
> Error: Earthfile:143:8 TRY/CATCH/FINALLY does not (currently) support wildcard SAVE ARTIFACT paths and without wildcard, just the directory, I get that previous mentioned error
...
vtest-haproxy:
ARG --required DEB_CODENAME
FROM +debian-build-deps --DEB_CODENAME=${DEB_CODENAME}
ARG --required HAPROXY_VER
WORKDIR /src
COPY (+haproxy-src/src --HAPROXY_VER=${HAPROXY_VER}) ./
COPY --dir (+binary/out --HAPROXY_VER=${HAPROXY_VER} --DEB_CODENAME=${DEB_CODENAME}) /
COPY (+vtest/vtest --DEB_CODENAME=${DEB_CODENAME}) /vtest
TRY
RUN HAPROXY_PROGRAM=/out/usr/sbin/haproxy VTEST_PROGRAM=/vtest make -j$(nproc) reg-tests
FINALLY
SAVE ARTIFACT /tmp/ AS LOCAL .
END ```
brandon
Can you share some of your Earthfile code?
brandon
Hi Christian, I believe SAVE ARTIFACT
with directories should work. And wildcard support was added recently.
c.ruppert
<@U02NXMDQ45Q> is there any workaround by chance? the names are really random so I'd need that entire directory or wildcard :confused:
c.ruppert
ah, ok, wildcard isn't supported yet and directory doesn't seem to work either :thinking_face: > +vtest-haproxy failed | earthly debugger | failed to save /tmp/: read /tmp/: is a directory
c.ruppert
ah, thanks!
brandon
This might be what you’re looking for https://docs.earthly.dev/docs/earthfile#try-experimental
c.ruppert
hey, is it possible to save artifacts for a failed command?