prefix-dev / setup-pixi

GitHub Action to set up pixi :octocat: 📦
https://pixi.sh/dev/advanced/github_actions
BSD 3-Clause "New" or "Revised" License
56 stars 10 forks source link

Issues using self-hosted runners #25

Closed humphd closed 1 year ago

humphd commented 1 year ago

I'm having a bunch of issues running this action with a self-hosted runner. Everything worked well until I made a change today to update some versions in pixi.toml.

My action basically looks like this:

env:
  PIXI_VERSION: 0.5.0

jobs:
  Lint:
    runs-on: [self-hosted, Linux, X64, ubuntu-22.04]
    steps:
    - name: Checkout code
      uses: actions/checkout@v4

    - name: Setup pixi
      uses: prefix-dev/setup-pixi@v0.3.0
      with:
        pixi-version: v${{ env.PIXI_VERSION }}

    ...

  Test:
    runs-on: [self-hosted, Linux, X64, ubuntu-22.04]
    steps:
    - name: Checkout code
      uses: actions/checkout@v4

    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v3

    - name: Setup pixi
      uses: prefix-dev/setup-pixi@v0.3.0
      with:
        pixi-version: v${{ env.PIXI_VERSION }}

    ...

When I updated the pixi.toml and pixi.lock, I get errors:

TestENOENT: no such file or directory, lstat '.pixi'
--
TestDestination file path /home/github/.pixi/bin/pixi already exists

or

Run prefix-dev/setup-pixi@v0.3.0
Downloading Pixi
Error: Destination file path /home/github/.pixi/bin/pixi already exists

I've tried every combo of post-cleanup:true/post-cleanup:false based on the docs, and tried with and without cache:true.

I'm not sure how to fix this. Any tips?

pavelzw commented 1 year ago

It looks like your runner persists its state between runs. Ideally, you would redeploy the runner image after each run to not persist old state.

For the case when this is not possible, post-cleanup: true should be the solution. This will delete all of the pixi stuff from the runner after it's finished. You probably executed the action once with post-cleanup: false which resulted in the action failing. To fix this issue, you can do

- run: rm -rf $HOME/.pixi

before the setup-pixi stuff once.

An alternative would be to use pixi-bin-path: ${{ runner.temp }}/bin/pixi. This should put pixi to a temporary location instead of in $HOME

humphd commented 1 year ago

I like the pixi-bin-path: ${{ runner.temp }}/bin/pixi approach along with post-cleanup: true, that seems to have been enough to fix our issue. I wonder if it's worth calling out in the README where you discuss self-hosted runners? I wouldn't have come to this solution without your guidance.

Thank you so much for your quick response! We have nothing but the highest of respect for the pixi devs and what you're building. It's really great software and very much appreciated.

pavelzw commented 1 year ago

Good idea, see #26!