From 2d9967ae8eb64e6e9b6c9a08e70a30e4d52be7c6 Mon Sep 17 00:00:00 2001 From: Larry Adames Date: Fri, 8 Nov 2024 11:42:33 -0500 Subject: [PATCH] ETCM-8833 fix exitcode for earthfile --- E2E-tests/Earthfile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/E2E-tests/Earthfile b/E2E-tests/Earthfile index c1d9a5530..b25af355e 100644 --- a/E2E-tests/Earthfile +++ b/E2E-tests/Earthfile @@ -40,18 +40,17 @@ build: test: # ATTENTION! +test target saves exit code to a file and returns success even when tests fail. - # TODO TRY FINALLY - # More info: https://docs.earthly.dev/docs/guides/best-practices#future-saving-an-artifact-even-if-the-build-fails FROM +build ARG CI_RUN IF [ "$CI_RUN" = "true" ] - RUN --secret AWS_SECRET_ACCESS_KEY --secret AWS_ACCESS_KEY_ID --secret AWS_SESSION_TOKEN --no-cache --ssh eval $pytest_cmd --ci-run || true + RUN --secret AWS_SECRET_ACCESS_KEY --secret AWS_ACCESS_KEY_ID --secret AWS_SESSION_TOKEN --no-cache --ssh eval $pytest_cmd --ci-run || echo $? > .exitcode ELSE - RUN --mount=type=secret,target=/root/.aws/credentials,id=aws --no-cache --ssh eval $pytest_cmd || true + RUN --mount=type=secret,target=/root/.aws/credentials,id=aws --no-cache --ssh eval $pytest_cmd || echo $? > .exitcode END test-artifacts: FROM +test + SAVE ARTIFACT .exitcode SAVE ARTIFACT .report.json SAVE ARTIFACT debug.log SAVE ARTIFACT junit_report.xml @@ -59,6 +58,7 @@ test-artifacts: report: FROM alpine:3.19 + COPY +test-artifacts/.exitcode . COPY +test-artifacts/.report.json . COPY +test-artifacts/debug.log . COPY +test-artifacts/ctrf-report.json . @@ -108,5 +108,4 @@ report: RUN echo ERROR: Unknown error. END RUN echo $summary - RUN exit $exitcode \ No newline at end of file