From 749b3ebc82245e2d34a5eb9a5f13bc4939c2997d Mon Sep 17 00:00:00 2001 From: Brian Mesick <112640379+bmtcril@users.noreply.github.com> Date: Wed, 15 Jan 2025 10:05:07 -0500 Subject: [PATCH] build: Cache images in unit tests (#36110) Another attempt to stop Dockerhub from rate limiting us in CI. If this works here, we'll try to add this caching to other relevant workflows. https://github.com/openedx/axim-engineering/issues/1350#issuecomment-2591237325 --- .github/workflows/unit-tests.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index d399d38770b9..9867ac72f273 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -73,15 +73,13 @@ jobs: run: | sudo apt-get update && sudo apt-get install libmysqlclient-dev libxmlsec1-dev lynx - # Try to log into DockerHub so that we're less likely to be rate-limited when pulling certain images. - # This will fail on any edx-platform fork which doesn't explicitly define its own DockerHub creds. - # That's OK--if we fail to log in, we'll proceed anonymously, and hope we don't get rate-limited. - - name: Try to log into Docker Hub - uses: docker/login-action@v3.3.0 - continue-on-error: true + # We pull this image a lot, and Dockerhub will rate limit us if we pull too often. + # This is an attempt to cache the image for better performance and to work around that. + # It will cache all pulled images, so if we add new images to this we'll need to update the key. + - name: Cache Docker images + uses: ScribeMD/docker-cache@0.5.0 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} + key: docker-${{ runner.os }}-mongo-${{ matrix.mongo-version }} - name: Start MongoDB uses: supercharge/mongodb-github-action@1.11.0