CodSpeedHQ / action

Github Actions for running CodSpeed in your CI
https://codspeed.io
MIT License
24 stars 3 forks source link

Error on self-hosted without `sudo` #82

Closed Boshen closed 10 months ago

Boshen commented 10 months ago

I'm experimenting with using self-hosted runner, but the machine doesn't have sudo, so it threw

Prepare environment
  Error: Failed to prepare environment: Error: The process '/usr/bin/sudo' failed with exit code 1

https://github.com/web-infra-dev/oxc/actions/runs/6555787727/job/17804876099?pr=1009


https://github.com/CodSpeedHQ/action/blob/cb13748eed9a8ccb27855efb02a74a09a56332e5/src/prepare.ts#L69-L87

I can prepare the system with updated deps, but I'm not sure if pytest-codspeed is required for Rust :thinking:

art049 commented 10 months ago

We only support Ubuntu 20/22 for now, and it should work with self-hosted runners. What OS are you using? Maybe it wouldn't be a lot on our side to support it 😃

I'm not sure if pytest-codspeed is required for Rust 🤔

Totally, this is a legacy thing we plan to remove in v2. #83

Boshen commented 10 months ago

It seems like checking the two sudos and removing the python stuff should make it work on self-hosted., given I don't have sudo nor python on the machine.

await exec(`sudo apt update`, [], {silent: true}); 
await exec(`sudo apt install ${debFilePath}`, [], {silent: true}); 
art049 commented 10 months ago

Yes, we can try. The only thing is the deb might not be suited for non-ubuntu distros. I'd like to reproduce, what os would be close to the one you're using?

Boshen commented 10 months ago

Yes, we can try. The only thing is the deb might not be suited for non-ubuntu distros. I'd like to reproduce, what os would be close to the one you're using?

I'm using ubuntu. It's the only distro that is closest to a github runner I think.

I can test your PR in my repo as well.

art049 commented 10 months ago

You can try it out with the branch feat/no-sudo-pip-support It should work with the following:

      - name: Run benchmarks
        uses: CodSpeedHQ/action@feat/no-sudo-pip-support
        with:
          token: ${{ secrets.CODSPEED_TOKEN }}
          run: pytest tests/ --codspeed
          no-sudo: true
          no-pip-install: true

Let me know if it fixes it :)

Boshen commented 10 months ago

As it turns out, apt install requires sudo.

I managed to make this work on self-hosted by installing the .deb file on the machine and removed the prepare stage from this action https://github.com/CodSpeedHQ/action/commit/1d5e461fadb85df1ea95d7c42f66077dea0f72ae.

Successful run: https://github.com/web-infra-dev/oxc/actions/runs/6584112839/job/17888172716

Boshen commented 10 months ago

As it turns out running codspeed on self-hosted require more work than I anticipated, let's close this and revisit the possibility of running codspeed on self-hosted in the future.

Sorry for the time wasted on making the change.