ci icon indicating copy to clipboard operation
ci copied to clipboard

Frequent failure with volta-cli//action

Open BioCarmen opened this issue 1 year ago • 9 comments

The error of using Volta to install Node.js 16.18.1 failed quite often and it is quite disruptive to our pipelines. Happens 1-2 times everyday Do you have any suggestions on how I can improve this?

Run volta-cli/action@v4
  with:
    node-version: 16.18.1
    npm-version: 8.19.[2](https://github.com/***/****/actions/runs/)
    token: ***
    always-auth: false
  env:
    NX_CLOUD_DISTRIBUTED_EXECUTION: true
    NX_BRANCH: develop
    NX_CLOUD_ACCESS_TOKEN: 
    NX_CLOUD_AUTH_TOKEN: 
    NPM_TOKEN: 
looking up latest volta version
downloading [email protected]
/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /home/runner/work/_temp/118[3](https://github.com//actions/runs/4692165290/jobs/8317540378#step:4:3)303d-b7a6-[4](https://github.com//actions/runs/4692165290/jobs/8317540378#step:4:4)af9-88cc-1b79993d1[5](https://github.com//actions/runs/4692165290/jobs/8317540378#step:4:5)9c/bin -f /home/runner/work/_temp/0522f090-57c9-480f-b553-83[6](https://github.com//actions/runs/4692165290/jobs/8317540378#step:4:6)3bbdef8cd
/opt/hostedtoolcache/volta/1.1.1/x64/bin/volta setup
caching [email protected] into /opt/hostedtoolcache/volta/1.1.1/x64
adding /opt/hostedtoolcache/volta/1.1.1/x64/bin to $PATH
installing Node 16.18.1
/opt/hostedtoolcache/volta/1.1.1/x64/bin/volta install [email protected]
error: Could not unpack Node v16.18.1

Please ensure the correct version is specified.
error: Error cause: failed to unpack `/opt/hostedtoolcache/volta/1.1.1/x64/tmp/.tmprsHt[7](https://github.com//actions/runs/4692165290/jobs/8317540378#step:4:7)a/node-v16.1[8](https://github.com//actions/runs/4692165290/jobs/8317540378#step:4:8).1-linux-x64/bin/node`

Error cause: failed to unpack `/opt/hostedtoolcache/volta/1.1.1/x64/tmp/.tmprsHt7a/node-v16.18.1-linux-x64/bin/node`

Error cause: failed to unpack `node-v16.18.1-linux-x64/bin/node` into `/opt/hostedtoolcache/volta/1.1.1/x64/tmp/.tmprsHt7a/node-v16.18.1-linux-x64/bin/node`

Error cause: Resource temporarily unavailable (os error [11](https://github.com//actions/runs/4692165290/jobs/8317540378#step:4:11))
Error: The process '/opt/hostedtoolcache/volta/1.1.1/x64/bin/volta' failed with exit code 1

BioCarmen avatar Apr 13 '23 19:04 BioCarmen

I've had the same issue for a while now. Some of the comments on this issue and this issue seem to refer to a similar problem.

It seems the unofficial recommendation is to use the setup-node action instead, as it will also read from the volta config in package.json.

The Lerna repository (which is under the nx umbrella) made this change recently so it might be worthwhile for the same change to be made to the preconfigured workflows here.

gremlin896 avatar Apr 18 '23 14:04 gremlin896

Unfortunately, the setup-node is not a full replacement as it doesn't handle the package manager versions.

But if this remains flaky, we will have to switch and sacrifice some functionality.

meeroslav avatar Apr 28 '23 20:04 meeroslav

Unfortunately, the setup-node is not a full replacement as it doesn't handle the package manager versions.

But if this remains flaky, we will have to switch and sacrifice some functionality.

It is flacky, about 10% of all the CI run failures are related to this in my case

g-cheishvili avatar May 17 '23 06:05 g-cheishvili

I took gremlin896 suggestions and use setup-node, it stabilized a lot.

BioCarmen avatar May 24 '23 19:05 BioCarmen

Since I still wanted to use Volta locally, and have CI pull through the yarn version set in package.json I went with this:

name: "Prepare"
description: "Install node and yarn using specified volta versions, install deps"
runs:
  using: "composite"
  steps:
    - run: echo "YARN_VERSION=$(cat package.json | jq '.volta.yarn' -r)" >> $GITHUB_ENV
      shell: bash

    - name: Install Yarn
      run: |
        corepack enable
        corepack prepare yarn@$YARN_VERSION --activate
      shell: bash

    - uses: actions/setup-node@v3
      with:
        cache: 'yarn'
        node-version-file: 'package.json'

    - run: yarn --immutable
      shell: bash

gremlin896 avatar May 26 '23 12:05 gremlin896

I am facing the same issue...

Let's add also the PR of sentry-javascript where they also switched to setup-node.

https://github.com/getsentry/sentry-javascript/pull/7763

gestj avatar Aug 25 '23 12:08 gestj

Volta has two issues:

  • it became unstable
  • it doesn't respect the package manager defined in package.json

So we will switch over to setup-node as well

meeroslav avatar Sep 06 '23 21:09 meeroslav

@meeroslav be aware that there is an open issue with setup-node that will prevent it from running on any self-hosted runners that do not have corepack support enabled by default, which the GitHub runners have.

There are workarounds for these self-hosted runners with this action... which basically involve running the action with caching explicitly disabled, then enabling corepack, running the action again, then running the install step. Obviously this is less than ideal.

brianespinosa avatar Sep 29 '23 03:09 brianespinosa

Thank you @brianespinosa for the info. The self-hosted runners are not supported by this reusable workflow, so we suggest folks with more specific needs to build their own workflows.

meeroslav avatar Oct 05 '23 11:10 meeroslav

I will be closing this PR since it seems that there is not something that can be done to address the issue, but please ping me if you think I should re-open, or please open a new one, mentioning this.

mandarini avatar Jun 11 '24 12:06 mandarini