- restore_cache:
keys:
- v1-dependencies-{{ checksum "requirements.txt" }}
- v1-dependencies-
- save_cache:
key: v1-dependencies-{{ checksum "requirements.txt" }}
paths:
- ./venv{{ checksum "requirements.txt" }} - Takes a unique hash of the requirments.txt file. the {{}} is a templateing engine varible insertion marker.
So if the checksum "requirements.txt" (the hash of that file from some cli program) generated the hash AD45633DF543. The key name would then be v1-dependencies-AD45633DF543.
- Check for the key
v1-dependencies-{{ checksum "requirements.txt" }}. - This becomes
v1-dependencies-AD45633DF543after proccesing. - If
v1-dependencies-AD45633DF543does not exist then look for any hash called starting withv1-dependencies-(this is confusing it should really be written asv1-dependencies-*). - Retore this cache.
- Any paths originally stored under the key
v1-dependencies-AD45633DF543( orv1-dependencies-*ifv1-dependencies-AD45633DF543is not found) are restored. In this case it would be the path./venv.
Notes:
- Remember the hash is only being create for file
requirements.txtthus we will start building new depencancies from scratch (or at least a preveous cached version) ifrequirements.txtis changed (which generates a new checksum hash). - This will trikle over the the next cache save step.
- Store the cache under the key
v1-dependencies-{{ checksum "requirements.txt" }} - If the
requirments.txtchanges then a new this will result in a new cache being saved.
Notes:
Summary
- We actually have two files that indcate a new cache update is requried. These are
requirements.txtandbase_install.sh. - We may need two restore and save steps. one for the python deps and one for the
base_install.sh. - If we can't do that we can md5 has each and put that into a file and checksum that third file.a