pcdshub / pcds-ci-helpers

Repository for continuous integration scripts - for PLC-related work and otherwise
3 stars 7 forks source link

Anaconda Upload Failures #114

Open ZLLentz opened 1 year ago

ZLLentz commented 1 year ago

Before even failing on auth, we get the following traceback when trying to do an anaconda upload:

Traceback (most recent call last):
  File "/home/runner/micromamba/conda-bld/elog_[168](https://github.com/pcdshub/elog/actions/runs/4602346042/jobs/8195166377#step:19:169)0804993126/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/bin/anaconda", line 7, in <module>
    from binstar_client.scripts.cli import main
  File "/home/runner/micromamba/conda-bld/elog_1680804993126/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/lib/python3.9/site-packages/binstar_client/__init__.py", line 24, in <module>
    from .mixins.channels import ChannelsMixin
  File "/home/runner/micromamba/conda-bld/elog_1680804993126/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/lib/python3.9/site-packages/binstar_client/mixins/channels.py", line 9, in <module>
    from binstar_client.utils import jencode
  File "/home/runner/micromamba/conda-bld/elog_1680804993126/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/lib/python3.9/site-packages/binstar_client/utils/__init__.py", line 14, in <module>
    from .config import (get_server_api, dirs, load_token, store_token,
  File "/home/runner/micromamba/conda-bld/elog_1680804993126/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/lib/python3.9/site-packages/binstar_client/utils/config.py", line 85, in <module>
    SITE_CONFIG = os.path.join(os.environ.get('CONDA_ROOT', CONDA_ROOT), 'etc', 'anaconda-client', 'config.yaml')
  File "/home/runner/micromamba/conda-bld/elog_1680804993126/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/lib/python3.9/posixpath.py", line 76, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

I've investigated this a bit. It seems like in the specific case of a micromamba running in an environment re-used from a package build, there is no way for anaconda_client to figure out what the CONDA_ROOT is. Since it isn't set as an environment variable and the failure response is None, this path join fails appropriately.

It has a maze of fallback options for figuring this out, but none of them work here. Note that this does not effect running micromamba in a normal env, since that has a fallback of noticing the envs bit of the path, which is not present in the long conda-bld string.

Also note: this path being constructed here is not actually used in any meaningful way. It points to a config file that is missing on both my micromamba install and on my miniconda install.

I think there are two reasonable solutions:

  1. Give it what it wants: tell it where CONDA_ROOT is. It will gracefully drop this information on the floor but it shouldn't error out.
  2. Use either a normal env or miniconda to do the builds.

1 is a lot less effort so I'll make a PR with that approach before ending for the day.