Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on self-hosted without sudo #82

Closed
Boshen opened this issue Oct 18, 2023 · 7 comments · May be fixed by #84
Closed

Error on self-hosted without sudo #82

Boshen opened this issue Oct 18, 2023 · 7 comments · May be fixed by #84

Comments

@Boshen
Copy link

Boshen commented Oct 18, 2023

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


action/src/prepare.ts

Lines 69 to 87 in cb13748

// always update the `apt` index before installing
await exec(`sudo apt update`, [], {silent: true});
await exec(`sudo apt install ${debFilePath}`, [], {silent: true});
await checkValgrindVersion();
try {
await exec("pip show pytest-codspeed", [], {
silent: true,
});
} catch (e) {
core.warning(
"pytest-codspeed is not installed in your environment. Installing it..."
);
await exec("pip install pytest-codspeed", [], {
silent: true,
});
}
} catch (error) {
throw new Error(`Failed to prepare environment: ${error}`);
}

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

@art049
Copy link
Member

art049 commented Oct 18, 2023

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
Copy link
Author

Boshen commented Oct 18, 2023

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
Copy link
Member

art049 commented Oct 18, 2023

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
Copy link
Author

Boshen commented Oct 19, 2023

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
Copy link
Member

art049 commented Oct 19, 2023

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
Copy link
Author

Boshen commented Oct 20, 2023

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 1d5e461.

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

@Boshen
Copy link
Author

Boshen commented Oct 26, 2023

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.

@Boshen Boshen closed this as completed Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants