Skip to content

Unable to restore C++ artifacts in some situations #460

Closed

Description

@Fatme

It seems actions/cache is not able to restore C++ artifacts in such a way that they can be used from the build.

We're using node.js source code directly as part of our app. Usually, nodejs build takes ~30mins. I want to improve our CI builds using actions/cache and cache whole node.js's source code along with build artifacts. The problem is that the second build throws an error as it is not able to execute one of cached binaries. It seems the binary is getting corrupted and it is no longer recognized.

It seems the problem is related to how actions/cache handles and processes provided input files.

It works if I manually create a zip, upload it to s3 and download it from the build.

I created a repo that demonstrates the problem - https://github.com/Fatme/cache-actions-issue

Activity

  1. changed the title [-]Unable to restore C++ artifacts in such a way that they can be used from the second build[/-] [+]Unable to restore C++ artifacts in some situations[/+] on Nov 15, 2020
  2. dhadka commented on Nov 16, 2020

    @dhadka
    Contributor

    Hi, this is a weird one. It looks like that executable (mksnapshot) is getting corrupted so it's no longer recognized as an executable file on MacOS. This can be seen by running file <path>/mksnapshot. The original file type is Mach-O 64-bit executable x86_64 but becomes data after restore (which indicates the type isn't recognized).

    This seems related to #403 where some .dylib files were being corrupted. That issue was fixed by installing GNU tar and seems to also fix this issue.

    Please try adding the following to your workflow file before the cache step. It takes a few minutes to install GNU tar, but that might be worth it if it cuts down the 30 minutes to build nodejs.

          - name: Install GNU tar
            run: |
              brew install gnu-tar
              echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
    

    We have an open issue to switch over to using GNU tar - actions/toolkit#610.

    Edit: If using a matrix strategy with multiple OS'es, here's a version of the step that will only run on macOS:

          - name: Install GNU tar
            if: runner.os == 'macOS'
            run: |
              brew install gnu-tar
              echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
    
  3. Fatme commented on Nov 17, 2020

    @Fatme
    Author

    Hi @dhadka,

    Thank you very much for looking into this!

    I tested the provided workaround and it works!

    It takes a few minutes to install GNU tar

    Actually, the installation of GNU tar takes around 15-25 seconds on my side which is OK having in mind that it saves us more than 30 minutes skipping the native build part.

  4. dhadka commented on Nov 18, 2020

    @dhadka
    Contributor

    Closing given the workaround. Tracking permanent fix with actions/toolkit#552.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions