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

Failure in Github workflows on ec2-runners #141

Open
AndesKrrrrrrrrrrr opened this issue Jan 11, 2024 · 3 comments
Open

Failure in Github workflows on ec2-runners #141

AndesKrrrrrrrrrrr opened this issue Jan 11, 2024 · 3 comments

Comments

@AndesKrrrrrrrrrrr
Copy link

AndesKrrrrrrrrrrr commented Jan 11, 2024

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

@rwjblue
Copy link
Collaborator

rwjblue commented Jan 15, 2024

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

@rwjblue
Copy link
Collaborator

rwjblue commented Jan 15, 2024

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

rwjblue commented Jan 15, 2024

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:

action/src/installer.ts

Lines 297 to 310 in d253558

async function setupVolta(version: string, voltaHome: string): Promise<void> {
if (voltaVersionHasSetup(version)) {
const executable = path.join(voltaHome, 'bin', 'volta');
core.info(`executing \`${executable} setup\``);
await exec(executable, ['setup'], {
env: {
// VOLTA_HOME needs to be set before calling volta setup
VOLTA_HOME: voltaHome,
},
});
} else {
await buildLayout(voltaHome);
}
}

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

action/src/installer.ts

Lines 386 to 409 in d253558

if (voltaHome === '') {
// download, extract, cache
const toolRoot = await acquireVolta(version, options);
// Install into the local tool cache - node extracts with a root folder
// that matches the fileName downloaded
voltaHome = await tc.cacheDir(toolRoot, 'volta', version);
await setupVolta(version, voltaHome);
core.info(`caching volta@${version} into ${voltaHome}`);
} else {
core.info(`using cached volta@${version}`);
}
// prepend the tools path. instructs the agent to prepend for future tasks
if (voltaHome !== undefined) {
const binPath = path.join(voltaHome, 'bin');
core.info(`adding ${binPath} to $PATH`);
core.addPath(binPath);
core.exportVariable('VOLTA_HOME', voltaHome);
}

🤔

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

No branches or pull requests

2 participants