We have a pipeline running a gradle build that runs a lot of Junit tests as well as Jest unit tests. When all of the tests pass, the build succeeds. When there is even one test failure, the build test fails, but completes. Then the "Build teardown" starts and seems to abort partway through. The pipeline shows the "Container 'Build' exceeded memory limit." error, and no artifacts are uploaded in this case (typically the test results are uploaded as artifacts even when there are failing tests causing the build step to fail). The pipeline is running with 2x memory.
It looks like the Build teardown is what is exceeding container memory. Does the teardown step also run in the "build" container? Is it possible that the test reports being saved as an artifacts are causing the memory to be exceeded? Since teardown is a separate step, is that running in it's own build container instance? How much memory does that step get?