E

Issues with +predeploy meta-target

Summary

The text discusses the +predeploy meta-target in Continuous Integration, outlining steps such as waiting, running Django tests, checking migrations, and executing unit tests for SAMM and UI tests prior to deployment. It identifies a bug that causes the BUILD process to trigger twice and suggests further investigation, potentially documenting the issue in a Github issue. The problem is linked to the target's setup, which permits parallel test execution without failing the earthly run until all tests are completed. Removing the WAIT/BUILD/END section can prevent duplication but results in immediate failure if any e2e-* targets fail. An alternative solution is proposed, which involves eliminating the COPY lines and using SAVE ARTIFACT ... AS LOCAL ... for *.failure files, allowing for parallel test execution without duplication while providing a workaround for the original issue. This workaround is also referenced in a Github issue. The text concludes with a mention of a proposed TEST feature.

Status
resolved
Tags
  • Github
  • Deployment Issues
  • Testing
  • Bug Fix
  • Django
  • SAMM
  • earthly
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```