E

Issues with +predeploy meta-target

Summary

The text discusses the +predeploy meta-target in Continuous Integration, detailing steps like waiting, running Django tests, checking migrations, and executing unit tests for SAMM and UI tests before deployment. It highlights a bug causing the BUILD process to trigger twice, suggesting further investigation and potential documentation in a Github issue. The issue is linked to the target's setup, which allows parallel test execution without failing the earthly run until all tests are completed. Removing the WAIT/BUILD/END section prevents duplication but leads to immediate failure if any e2e-* targets fail. An alternative solution proposed involves eliminating the COPY lines and using SAVE ARTIFACT ... AS LOCAL ... for *.failure files, which allows parallel test execution without duplication while providing a workaround for the original issue. The workaround is also referenced in a Github issue. The text concludes by mentioning a proposed TEST feature.

Status
resolved
Tags
    Source
    #earthly
      b

      brett.higgins

      7/24/2024

      Indeed I am, thanks!

      k

      kieran.mann

      7/24/2024

      > the tests still run in parallel, and the duplication is gone, but if any of the e2e-* targets fail, the whole earthly run fails immediately. You may be interested in the TEST feature I proposed :slightly_smiling_face: https://github.com/earthly/earthly/issues/4198

      b

      brett.higgins

      7/24/2024

      the .failure workaround is also described here: https://github.com/earthly/earthly/issues/3778

      b

      brett.higgins

      7/24/2024

      The root cause here seems to have been our target having a setup like this, so that we could run the tests in parallel but not fail the earthly run until all of them had finished, pass or fail. If I remove the WAIT/BUILD/END part, the tests still run in parallel, and the duplication is gone, but if any of the e2e-* targets fail, the whole earthly run fails immediately.

      If instead I remove the COPY lines and have the individual e2e-* targets SAVE ARTIFACT ... AS LOCAL ... the *.failure files, they run in parallel to completion without duplication. So with that, I have a workaround for the original issue that was blocking me (if not an understanding).

      b

      brandon

      7/18/2024

      There is a --verbose flag, but the issue seems pretty surprising to me. The command you run inside one of those targets shouldn’t trigger the BUILD to be called twice. It might even be an earthly bug.

      I would try narrowing it down a bit. Does it happen with just a single BUILD statement in your WAIT/END ? Does it happen without WAIT/END? A reproduction case would be worth a Github issue I think.

      b

      brett.higgins

      7/17/2024

      <@U07CYCHCTLL> and I are still wondering about this if anyone has ideas

      b

      brett.higgins

      7/16/2024

      I have a +predeploy meta-target for use with CI that does the following:

          BUILD +django-tests
          BUILD +django-check-migrations
          BUILD +samm-unit-tests
          BUILD +ui-tests
        END```