Skip to content

Commit

Permalink
ETCM-8833 fix exitcode for earthfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ladamesny committed Nov 8, 2024
1 parent b7465a7 commit 2d9967a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions E2E-tests/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ 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
SAVE ARTIFACT ctrf-report.json

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 .
Expand Down Expand Up @@ -108,5 +108,4 @@ report:
RUN echo ERROR: Unknown error.
END
RUN echo $summary
RUN exit $exitcode

0 comments on commit 2d9967a

Please sign in to comment.