Skip to content

Nasty edge case in the cached env docs #361

@liamhuber

Description

@liamhuber

I ran into a case where specifying a range of python in the env used for the mamba env update -n anaconda-client-env -f etc/example-environment-caching.yml step of the caching docs results in overriding the requested version of python passed to the setup-miniconda python-version action arg. In a hindsight-is-20/20 moment, it makes perfect sense that the update overrides things an bumps python to the maximum version specified in the range!

It's possible there are a few other manifestations of this symptom; at some point we managed to get python and python_abi having different versions due to this issue.

The solution I found is to instead take a five-step process so that the cache-free invocation of setup-miniconda always exploits the environment-file argument, which allows the python-version to be respected. Basically:

  • Check for a cache with lookup-only = true
  • If cache hit: run setup-miniconda without environment-file
  • If cache hit: restore cache
  • if cache not hit: run setup-miniconda with environment-file
  • if cache not hit: save cache

I made a repo demonstrating this, and as long as GitHub holds the run report, you can look and see that the docs approach has python upgrade while the careful approach outlined above retains the requested version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions