Thanks to visit codestin.com
Credit goes to github.com

Skip to content

actions/setup-python@v4 is unable to install python in the ubuntu example because of wrong user permissions on /opt/hostedtoolcache #2303

@MarkArts

Description

@MarkArts

When using the ubuntu example and running a job that uses actions/setup-python@v4 like this:

jobs:
  isort:
    runs-on: [self-hosted, ubuntu20.04-self]
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: 3.8
      - uses: isort/isort-action@master

The following error is thrown (this is the output in the githbub action)

> Run actions/setup-python@v4
Version 3.8 was not found in the local cache
Version 3.8 is available for downloading
Download from "https://github.com/actions/python-versions/releases/download/3.8.13-2717995909/python-3.8.13-linux-20.04-x64.tar.gz"
Extract downloaded archive
/usr/bin/tar xz --warning=no-unknown-keyword -C /opt/actions-runner/_work/_temp/7e4817be-5a33-40ea-b076-5dc694464992 -f /opt/actions-runner/_work/_temp/a95cf3ec-296c-4b20-937f-850ee461640a
Execute installation script
Check if Python hostedtoolcache folder exist...
Creating Python hostedtoolcache folder...
Error: mkdir: cannot create directory ‘/opt/hostedtoolcache/Python’
Error: : Permission denied
Error: The process '/usr/bin/bash' failed with exit code 1

It seems like this happens because the example user_data.sh script uses the upercase variable $USER_NAME while the install_runners.sh script that sets the permissions on /opt/hostedtoolcache uses $user_name.

I created a PR that fixes this and can sucefully run the above job on our setup:
https://github.com/philips-labs/terraform-aws-github-runner/pull/2302

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions