Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Cache images in unit tests #36110

Merged
merged 2 commits into from
Jan 15, 2025
Merged

Conversation

bmtcril
Copy link
Contributor

@bmtcril bmtcril commented Jan 15, 2025

Description

Another attempt to stop Dockerhub from rate limiting us in CI. If this works here I'll try to add this caching to other relevant workflows.

Supporting information

openedx/axim-engineering#1350 (comment)

Current attempt is using this action to attempt the cache: https://github.com/marketplace/actions/docker-cache

Another attempt to stop Dockerhub from rate limiting us in CI. If this
works here I'll try to add this caching to other relevant workflows.
@bmtcril
Copy link
Contributor Author

bmtcril commented Jan 15, 2025

Closing and reopening to make sure caching actually works across runs. I'll need to update the cache key after this as it's currently incorrect, but first need to make sure it actually does what it's supposed to.

@bmtcril bmtcril closed this Jan 15, 2025
@bmtcril bmtcril reopened this Jan 15, 2025
@bmtcril
Copy link
Contributor Author

bmtcril commented Jan 15, 2025

This seems to solve the issue, at least in the unit tests. Previous:

   Starting single-node instance, no replica set
    - port [27017]
    - version [7.0]
    - database []
    - credentials [:]
    - container-name [mongodb]
  
  Unable to find image 'mongo:7.0' locally
  7.0: Pulling from library/mongo
  6414378b6477: Pulling fs layer
  ...

Now:

Cache restored successfully
docker load --input ~/.docker-images.tar
Loaded image: mongo:7.0
...


Starting single-node instance, no replica set
    - port [27017]
    - version [7.0]
    - database []
    - credentials [:]
    - container-name [mongodb]
  
  fd7ffabd6aeb7ef3cc4e361c39e5896c24dbe7578847fa50a1b0b1972cad2b48

Copy link
Member

@kdmccormick kdmccormick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try it!

@kdmccormick kdmccormick merged commit 749b3eb into master Jan 15, 2025
49 checks passed
@kdmccormick kdmccormick deleted the bmtcril/cache_github_action_image branch January 15, 2025 15:05
@timmc-edx
Copy link
Contributor

Nice. And even if we do start pulling other Docker images and forget to update the cache key, I don't think that will cause any failures (directly) or correctness issues -- just more risk of rate-limiting again.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants