Toolkit: tool-cache extractZip not working

Created on 25 Aug 2019  Â·  13Comments  Â·  Source: actions/toolkit

I am trying to write an action to setup flutter toolchain, but I can't extract zip.

The repo is https://github.com/chunlea/actions-setup-flutter, and code is here: https://github.com/chunlea/actions-setup-flutter/blob/master/src/installer.ts#L144

and I got this error:

2019-08-25T03:38:14.4067220Z ##[group]Run chunlea/actions-setup-flutter@releases/vtest
2019-08-25T03:38:14.4067400Z with:
2019-08-25T03:38:14.4067450Z   flutter-version: stable
2019-08-25T03:38:14.4067540Z ##[endgroup]
2019-08-25T03:38:15.1769030Z the file name is flutter_macos_v1.7.8+hotfix.4-stable.zip and .zip
2019-08-25T03:38:35.8228380Z [command]/Users/runner/runners/2.157.0/work/_actions/chunlea/actions-setup-flutter/releases/vtest/node_modules/@actions/tool-cache/scripts/externals/unzip-darwin /Users/runner/runners/2.157.0/work/_temp/a64b2350-0bc0-439f-99e4-e9eb03603b23
2019-08-25T03:38:35.8348120Z ##[error]There was an error when attempting to execute the process '/Users/runner/runners/2.157.0/work/_actions/chunlea/actions-setup-flutter/releases/vtest/node_modules/@actions/tool-cache/scripts/externals/unzip-darwin'. This may indicate the process failed to start. Error: spawn /Users/runner/runners/2.157.0/work/_actions/chunlea/actions-setup-flutter/releases/vtest/node_modules/@actions/tool-cache/scripts/externals/unzip-darwin ENOENT
2019-08-25T03:38:35.8387530Z ##[error]Node run failed with exit code 1
2019-08-25T03:38:35.8504660Z Cleaning up orphan processes

But if I change the code in @actions/tool-cache, not using the unzip in node_modules, using the unzip in system, it works.

any idea?

All 13 comments

Are you using the most recent version of the tool-cache? We fixed an issue with mac zip/unzip in #49

I've the same problem - the unzip Linux binary is dynamically linked and I don't have libbz2.so.1.0:

ldd /path/to/node_modules/@actions/tool-cache/scripts/externals/unzip
    linux-vdso.so.1 (0x00007ffd358c5000)
    libbz2.so.1.0 => not found
    libc.so.6 => /lib64/libc.so.6 (0x00007faf701f8000)
    /lib64/ld-linux-x86-64.so.2 (0x00007faf706f8000)

Locally I can work around this with:

sudo ln -s /usr/lib64/libbz2.so.1.0.6 /usr/lib64/libbz2.so.1.0

but my workflow keeps failing with this error:

There was an error when attempting to execute the process '/home/runner/work/actions/actions/setup-protoc/node_modules/@actions/tool-cache/scripts/externals/unzip'. This may indicate the process failed to start. Error: spawn /home/runner/work/actions/actions/setup-protoc/node_modules/@actions/tool-cache/scripts/externals/unzip EACCES

@masci have you been able to confirm that the file you're trying to download actually exists? I've been trying to hit the url you're using for downloads and haven't been able to download a zip (e.g. I think your code assumes https://github.com/protocolbuffers/protobuf/releases/download/3.9.0/protoc-3.9.0-linux-x86_64.zip should work, but I can't get it to work)

Are you using the most recent version of the tool-cache? We fixed an issue with mac zip/unzip in #49

Yes, I am using the 1.1.0 of tool-cache, which is already merged with #49

@damccorm I don't know how to print debug logs in the workflow report on GitHub but locally the URLs are composed in the right way and the file is actually downloaded:

##[debug]checking cache: /home/massi/dev/actions/setup-protoc/__tests__/runner/tools/protoc/3.9.0/x64
##[debug]not found
##[debug]Downloading https://github.com/protocolbuffers/protobuf/releases/download/v3.9.0/protoc-3.9.0-linux-x86_64.zip
##[debug]Downloading /home/massi/dev/actions/setup-protoc/__tests__/runner/temp/361461c0-832e-4de5-b96b-37850d6b9d22
##[debug]download complete

Another thing I had to do locally, every time I do npm install the unzip script is not executable and I get the infamous EACESS error that I can fix by chmod-ding the file giving it +x permissions.

@damccorm I don't know how to print debug logs in the workflow report on GitHub but locally the URLs are composed in the right way and the file is actually downloaded:

##[debug]checking cache: /home/massi/dev/actions/setup-protoc/__tests__/runner/tools/protoc/3.9.0/x64
##[debug]not found
##[debug]Downloading https://github.com/protocolbuffers/protobuf/releases/download/v3.9.0/protoc-3.9.0-linux-x86_64.zip
##[debug]Downloading /home/massi/dev/actions/setup-protoc/__tests__/runner/temp/361461c0-832e-4de5-b96b-37850d6b9d22
##[debug]download complete

Another thing I had to do locally, every time I do npm install the unzip script is not executable and I get the infamous EACESS error that I can fix by chmod-ding the file giving it +x permissions.

Try to use tool-cache with version 1.1.0 in package.json, the 1.1.0 fixed +x permissions.

@chunlea thanks a ton, that was indeed my problem.

Sorry for the noise on the issue, I'm quite new to Typescript&co.

Any update?

I am facing this issue in linux even after using 1.1.1 version of tool-cache. Has the change been done for linux as well?

I have used both 1.1.0 and 1.1.1 version of tool cache and i am still getting the below error for ubuntu and mac agents:
_There was an error when attempting to execute the process '/Users/runner/runners/2.158.0/work/k8s-helm-test/k8s-helm-test/setup-helm/node_modules/@actions/tool-cache/scripts/externals/unzip-darwin'. This may indicate the process failed to start. Error: spawn /Users/runner/runners/2.158.0/work/k8s-helm-test/k8s-helm-test/setup-helm/node_modules/@actions/tool-cache/scripts/externals/unzip-darwin EACCES_

Only after adding permissions by doing fs.chmodSync(unzipPath, '777'); after line1 and line2

Is there any plan to add this?

I just released 1.1.2 which should address the core of the issue (ENOENT) and simplified it by using zip and unzip from the path

@Anumita, if you're having an EACCES issue, please open an new issue with repro steps.

@chunlea - thanks for reporting. After a ton of investigations we ended up taking your original suggestion.

Everyone, if you get an ENOENT after adopting, 1.1.2, please let me know and we will be happy to investigate.

Just as an FYI, a confusing error message got me stuck for a good 20 minutes trying to figure out what was going on and diagnosing various things. I got this in my action logs:

silly:   â–ª Download completed to "/home/runner/work/_temp/f38cccdc-e899-4185-b4d9-e4ad3c60f587", checking to see if extraction is required... +2s
silly:   â–ª Extracting compressed ZIP file... +1ms
/usr/bin/unzip /home/runner/work/_temp/f38cccdc-e899-4185-b4d9-e4ad3c60f587
error:   â–ª There was an error when attempting to execute the process '/usr/bin/unzip'. This may indicate the process failed to start. Error: spawn /usr/bin/unzip ENOENT +10ms

This implies that the /usr/bin/unzip executable could not be found but I found the error was actually that the destination path I provided did not exist. Just a suggestion but it might be an idea to add to this method a check for the existence of the destination path (if provided) and error with a more useful (or specific) error if the destination path does not exist.

@Anupheaus - can you log a separate issue for your enhancement suggestion? I would probably just add a warning. If you saw the warning ahead of the final not helpful error from unzip, then it would have saved you time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andrewdhazlett picture andrewdhazlett  Â·  5Comments

warrenbuckley picture warrenbuckley  Â·  6Comments

JasonGross picture JasonGross  Â·  5Comments

svartalf picture svartalf  Â·  4Comments

Ignigena picture Ignigena  Â·  6Comments