terraform-aws-github-runner icon indicating copy to clipboard operation
terraform-aws-github-runner copied to clipboard

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

Open MarkArts opened this issue 2 years ago • 0 comments

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

MarkArts avatar Aug 02 '22 08:08 MarkArts

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Sep 02 '22 02:09 github-actions[bot]