I'm fairly new to CI and even newer to bitbucket CI. What I want to do is cache the conda virtual environment that I create, update it incrementally as we add new packages to the environment.yml file, but also be able to newly create since it apparently gets dropped each week.
My file looks like as follows, and it works to a degree, but with two main issues
image: continuumio/anaconda3
pipelines:
default:
- step:
name: Build
caches:
- condacache
script:
# - conda env create -f environment.yml
- conda activate vlm_venv
- conda env update -f environment.yml
- python tests/tests.py
definitions:
caches:
condacache: /opt/conda/envs/vlm_venv
Issue #1
Note that the first bullet in the "script" section is commented out. This is due to the fact that the env has already been created and cached, so there's no need to recreate it. It actually results in this error if that line is uncommented:
CondaValueError: prefix already exists: /opt/conda/envs/vlm_venv
But what happens in 1 week when condacache no longer exists? How can run that command IFF condacache does not exist? Or should I not be concerned, because once we're at 1 week, it will replace the dropped cache with the latest build?
Issue #2
As I add packages to environment.yml, the `conda env update` command properly installs them, but since condacache already exists, it doesn't update with the new updated environment containing these new packages. Rather, the build teardown process notes the following:
<span>Cache "condacache": Skipping upload for existing cache</span><span>You already have a 'condacache' cache so we won't create it again<br></span>
So, the question here is how can I replace the condacache either (1) every time or (2) whenever packages were added? Either would work, I suppose?
Thanks in advance.