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

Track the Docker image hash in readthedocs-environment.json #3744

Closed
agjohnson opened this issue Mar 6, 2018 · 2 comments
Closed

Track the Docker image hash in readthedocs-environment.json #3744

agjohnson opened this issue Mar 6, 2018 · 2 comments
Assignees
Labels
Improvement Minor improvement to code

Comments

@agjohnson
Copy link
Contributor

We are doing some basic checks on python version change around our readthedocs-environment.json metadata file. We should also drop the build image SHA in there, so that if it ever changes, we know to wipe the build env.

For instance, we're saving here:
https://github.com/rtfd/readthedocs.org/blob/7be1b805d59c0683855f05a252850bba09287a20/readthedocs/doc_builder/python_environments.py#L150-L162

On save, we should:

  • Check to see if docker builds are enabled before writing information about the docker build
  • Get the build image name that the build would use
  • Query the docker API for the build image SHA that matches the build image name
  • Write that to disk

On build, we should check this file against the current image SHA and if they differ, the image has changed and we should rebuild without the cache.

@agjohnson agjohnson added Improvement Minor improvement to code Needed: design decision A core team decision is required labels Mar 6, 2018
@humitos
Copy link
Member

humitos commented Mar 7, 2018

I agree with this idea.

I think we just need to add the build.hash option to the JSON file and check it again in the is_obsolete method.

docker inspect does the magic to get the Id:

$ docker inspect readthedocs/build:2.0 | jq ".[0].Id"
"sha256:9468fcb95b87a9a5cd58c2d37da35983df8c3334a80181fed12b5a04892fffb9"

I can take this one if you want and do it.

@ericholscher
Copy link
Member

+1 on keeping any specific data that we can on disk, so we can do sanity checking against it.

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

No branches or pull requests

3 participants