Makefile 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. all: test-e2e
  2. # We are updating the docker compose config via the host-admin service.
  3. # The host-admin service is running inside docker and has its own file-system layout.
  4. # We need to have both file-system layouts agree on the path for the docker compose project.
  5. # Notable the container labels com.docker.compose.project.working_dir and com.docker.compose.project.config_files need to match when creating containers from the docker host (how you started things) and from host-admin (how tests reconfigure the instance).
  6. export PWD = $(shell pwd)
  7. export TEX_LIVE_DOCKER_IMAGE ?= gcr.io/overleaf-ops/texlive-full:2023.1
  8. export ALL_TEX_LIVE_DOCKER_IMAGES ?= gcr.io/overleaf-ops/texlive-full:2023.1,gcr.io/overleaf-ops/texlive-full:2022.1
  9. export IMAGE_TAG_PRO ?= us-east1-docker.pkg.dev/overleaf-ops/ol-docker/pro:latest
  10. export CYPRESS_SHARD ?=
  11. export COMPOSE_PROJECT_NAME ?= test
  12. test-e2e-native:
  13. docker compose -f docker-compose.yml -f docker-compose.native.yml up --no-log-prefix sharelatex host-admin -d
  14. CYPRESS_HOST_ADMIN_URL='http://localhost:8081' \
  15. CYPRESS_SAML_URL='http://localhost:8082' \
  16. CYPRESS_MAILTRAP_URL='http://localhost:8083' \
  17. npm run cypress:open
  18. test-e2e:
  19. docker compose up --no-log-prefix --exit-code-from=e2e e2e
  20. test-e2e-open:
  21. docker compose up --no-log-prefix --exit-code-from=e2e-open e2e-open
  22. clean:
  23. docker compose down --volumes --timeout 0
  24. prefetch: prefetch_default
  25. prefetch_default: prefetch_default_compose
  26. prefetch_default_compose:
  27. docker compose pull e2e mongo redis
  28. prefetch_default: prefetch_default_compose_build
  29. prefetch_default_compose_build:
  30. docker compose build host-admin
  31. prefetch: prefetch_custom
  32. prefetch_custom: prefetch_custom_compose_pull
  33. prefetch_custom_compose_pull:
  34. docker compose pull saml ldap
  35. prefetch_custom: prefetch_custom_texlive
  36. prefetch_custom_texlive:
  37. echo -n "$$ALL_TEX_LIVE_DOCKER_IMAGES" | tr ',' '\0' | xargs -0 -I% \
  38. sh -exc 'tag=%; re_tag=quay.io/sharelatex/$${tag#*/*/}; docker pull $$tag; docker tag $$tag $$re_tag'
  39. prefetch_custom: prefetch_old
  40. prefetch_old:
  41. docker pull $(IMAGE_TAG_PRO:latest=4.2)
  42. docker pull $(IMAGE_TAG_PRO:latest=5.0.1-RC1)
  43. docker pull $(IMAGE_TAG_PRO:latest=5.0)
  44. # Google Cloud Build runs on a very ancient Docker version that does not support the subdir flag.
  45. # Use services -> mailtrap -> build -> context = https://github.com/dbck/docker-mailtrap.git#v1.5.0:build in docker-compose.yml eventually.
  46. prefetch_default_compose_build: build_mailtrap
  47. build_mailtrap:
  48. git clone https://github.com/dbck/docker-mailtrap.git || true && cd docker-mailtrap && git checkout v1.5.0
  49. docker build -t mailtrap docker-mailtrap/build
  50. .PHONY: test-e2e test-e2e-open