action icon indicating copy to clipboard operation
action copied to clipboard

Failure in Github workflows on ec2-runners

Open AndesKrrrrrrrrrrr opened this issue 1 year ago • 3 comments

I'm using this action in my CI, but getting errors regarding my profile/bashrc.

executing `/__w/_tool/volta/1.1.1/x64/bin/volta setup`
/__w/_tool/volta/1.1.1/x64/bin/volta setup
error: Could not locate user profile.
Tried $PROFILE (), ~/.bashrc, ~/.bash_profile, ~/.zshrc, ~/.profile, and ~/.config/fish/config.fish

Please create one of these and try again; or you can edit your profile manually to add '/__w/_tool/volta/1.1.1/x64/bin' to your PATH
Error: The process '/__w/_tool/volta/1.1.1/x64/bin/volta' failed with exit code 6

Minimum Working Example

name: Minimum Working Example
on:
  push:
defaults:
  run:
    shell: bash
jobs:
  success-ubuntu:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Setup Volta-cli
        uses: volta-cli/action@v4
  fail-ec2:
    runs-on: ec2-runners
    container:
      image: ${{ vars.EC2_RUNNER }}
    steps:
      - uses: actions/checkout@v3
      - name: Setup Volta-cli
        uses: volta-cli/action@v4

AndesKrrrrrrrrrrr avatar Jan 11 '24 11:01 AndesKrrrrrrrrrrr

I'm not familiar with ec2-runners here, is that something you've setup in your organization?

rwjblue avatar Jan 15 '24 16:01 rwjblue

This might ultimately be something we need to tweak in Volta itself. As long as someone makes sure that $PATH is updated we don't really care if we could edit your profile (bash/fish/zsh/etc).

We might be able to add a flag to volta setup for that, but we'd need to consider the pros/cons specifically.

rwjblue avatar Jan 15 '24 16:01 rwjblue

Hmm. We might be able to avoid this error in the action itself if we setup VOLTA_HOME on $PATH first:

https://github.com/volta-cli/volta/blob/75581e5e8c36b58fa88557cfd4d01440fa1fd9ad/src/command/setup.rs#L46-L57

Basically, this would mean either changing setupVolta to always pass PATH as well as VOLTA_HOME:

https://github.com/volta-cli/action/blob/d253558a6e356722728a10e9a469190de21a83ef/src/installer.ts#L297-L310

Or calling .addPath before calling voltaSetup (though it would take a bit of reworking to actually handle correctly):

https://github.com/volta-cli/action/blob/d253558a6e356722728a10e9a469190de21a83ef/src/installer.ts#L386-L409

🤔

rwjblue avatar Jan 15 '24 17:01 rwjblue