Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding the automated test step in the docker build push job itself.
Using “test before push” workflow mentioned in docker build push action official documentation. Link: https://docs.docker.com/build/ci/github-actions/test-before-push/ --- While this would work, a problem is that I need to put the docker compose step in the docker build push job. This means, it would run for all matrix jobs. In our case currently manager service image takes time to build, and manager depends on mqtt service image which is built pretty quickly. So we are good here. But consider this scenario. What if a matrix job B is dependent on matrix job A but matrix job A hasn’t finished building it’s image as yet, then matrix job B might use the older image which it would have pulled and not the locally built / updated image. In this case, the tests would be run on an older image, and could falsely pass the tests. --- For instance, in this test workflow run, I wanted to test the success / failure test case and used a different test script. This is copied over in the manager/Dockerfile. But since the automated tests step is part of the same matrix job, it would run for all services and not just manager which has the entry point (run-test.sh) script for automated tests. So, mqtt service image, in this case, also executed the docker compose command, it wasn’t able to find the test script in the manager image. The reason is that while I did include the test script in the manager/Dockerfile, this image is still being built, hence latest changes not yet available. So, the matrix job for the mqtt service uses the pulled image layers from the cache for the manager image (it pulled in the first place since the manager image was used as a part of the docker compose), and this pulled image did not have the test script file. Hence the workflow failed saying, no such file found: https://github.com/MukuFlash03/everest-demo/actions/runs/9960438276/job/27519676597 ---- One workaround I see then is to run the automated tests conditionally only for the manager service matrix job.
- Loading branch information