Skip to content

init-pants action needs use exact Python version/path in setup cache key #5

@huonw

Description

@huonw

Hi!

The init-pants action is nifty, however I think it may not work when GitHub changes the version of Python (or other aspects of file layout) chosen by a specifier such as 3.9. In particular:

  • setup-python puts everything for a given version into a path like /opt/hostedtoolcache/Python/3.9.13/x64/... (note the minor version number 3.9.13)
  • it seems the Pants setup cache contains symlinks to the relevant system Python executable (e.g /home/runner/.cache/pants/setup/bootstrap-Linux-x86_64/2.13.0_py39/bin/python is a symlink into the directory above)
  • it seems GitHub is happy to update the minor version silently (and even inconsistently)

We're having pants fail to bootstrap in ~30% of runs because currently the setup-python action with python-version: '3.9' usually chooses 3.9.13, but sometimes chooses 3.9.14. Our cache key is fairly similar to the one used by init-pants, and meant we were reusing the 3.9.13 cache (with its 3.9.13-specific symlinks) on the 3.9.14 runner.

The error message (below) is very hard to interpret, because the path listed does exist, but is a symlink to /opt/hostedtoolcache/Python/3.9.13/x64/bin/python, which doesn't exist:

./pants: line 400: /home/runner/.cache/pants/setup/bootstrap-Linux-x86_64/2.13.0_py39/bin/python: No such file or directory

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