Skip to content

Python setup.sh deleting major version directory instead of arch specific directory #1255

@fergoid

Description

@fergoid

Description:
When I use setup-python with a matrix (e.g. arch: [arm, x86]). The setup script (setup.sh) that is being run will delete the Python version directory (e.g. python3.12.8) and not the architecture specific version. This means if I use a matrix and install 'arm' first the 'x86' install will delete the 'arm' installation before proceeding.

We observed this because we want to cache Python runtimes in a shared resource so they can be used by our self hosted runners. We will run scheduled workflows that install/refresh all of the cached versions we need.

Action version:
v6

Platform:

  • [x ] Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • [x ] Self-hosted

Tools version:

Install any Python version using a matrix.

Repro steps:
A description with steps to reproduce the issue. If your have a public example or repo to share, please provide the link.

      matrix:
        arch: [arm, x86]
        version: ['3.12.8']

Expected behavior:
The setup script should delete the architecture specific directory only.

Actual behavior:
You can see clearly from this snippet of the script what is happening

echo "Check if Python hostedtoolcache folder exist..."
if [ ! -d $PYTHON_TOOLCACHE_PATH ]; then
    echo "Creating Python hostedtoolcache folder..."
    mkdir -p $PYTHON_TOOLCACHE_PATH
elif [ -d $PYTHON_TOOLCACHE_VERSION_PATH ]; then
    echo "Deleting Python $PYTHON_FULL_VERSION"
    rm -rf $PYTHON_TOOLCACHE_VERSION_PATH
fi

echo "Create Python $PYTHON_FULL_VERSION folder"
mkdir -p $PYTHON_TOOLCACHE_VERSION_ARCH_PATH

We can work around this by using max-parallel: 1 in our matrix configuration but this significantly slows down our refreshes.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions