Failing to upload artifacts macos

artifacts

#1

Hey

My issue is very similar to this one: Failing to upload artifacts from symbolic link directories

But for me, the issue persists and I do not have a clue where to look for the issue.
The error message I am getting is the following:
(one of the many messages)

FAILED with error BodyHashError: failed to compute body hashes
caused by: read /Users/distiller/repo/dist/mac/my.app/Contents/Frameworks/Squirrel.framework/Versions/Current: is a directory

and this is how my circleci config looks like.

# Javascript Node CircleCI 2.0 configuration file.
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
version: 2

references:
  workspace: &workspace ~/repo

  container_config: &container_config
    docker:
      - image: circleci/node:8.15.1
    working_directory: *workspace

  win_config: &win_config
    docker:
      - image: electronuserland/builder:wine
        environment:
          TARGET_ARCH: x64
    working_directory: *workspace

  mac_config: &mac_config
    macos:
      xcode: "10.1.0"
    working_directory: *workspace

jobs:
  build:
    <<: *container_config
    steps:
      - checkout
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "package.json" }}
            - v1-dependencies-
      - run: sudo apt-get -y update
      - run: sudo apt-get -y install libudev-dev libusb-1.0-0-dev
      - run: yarn install
      - run: chmod -R 777 ~/repo
      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}
  test:
    <<: *container_config
    steps:
      - checkout
      # Download and cache dependencies
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "package.json" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-
      - run: sudo apt-get -y update
      - run: sudo apt-get -y install libgtk-3-0 libxss1 libgconf-2-4 libnss3 libasound2
      - run: sudo yarn global add yarn@1.12.3
      - run: yarn test
      - run: yarn codecov
    store_artifacts:
      - path: artifacts
      - destination: yarnpkg

  deploy_win:
    <<: *win_config
    steps:
      - checkout
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "package.json" }}
            - v1-dependencies-
      - run: dpkg --add-architecture i386
      - run: apt-get -y update
      - run: apt-get -y install libudev-dev libudev-dev:i386 libusb-1.0-0-dev libusb-1.0-0-dev:i386
      - run: yarn install
      - run: yarn dist --win --x64 --ia32
      - store_artifacts:
          path: dist
          destination: build

  deploy_linux:
    <<: *container_config
    steps:
      - checkout
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "package.json" }}
            - v1-dependencies-
      - run: sudo yarn global add yarn@1.12.3
      - run: yarn install
      - run: yarn dist --linux
      - store_artifacts:
          path: dist
          destination: build

  deploy_mac:
    <<: *mac_config
    steps:
      - checkout
      - restore_cache:
          keys:
            - v3-dependencies-{{ checksum "package.json" }}
            - v3-dependencies-
      - run: yarn install
      - run: yarn dist --mac
      - store_artifacts:
          path: dist/
          destination: build/

workflows:
  version: 2
  build_test:
    jobs:
      - build
      - test:
          requires:
            - build

  deploy:
    jobs:
      - deploy_mac
      - deploy_win:
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /[v][0-9]+(\.[0-9]+)+.*/
      - deploy_linux:
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /[v][0-9]+(\.[0-9]+)+.*/
      # - deploy_mac:
      #     filters:
      #       branches:
      #         ignore: /.*/
      #       tags:
      #         only: /[0-9]+(\.[0-9]+)+.*/

We’re trying to achieve the ability to build/code sign and upload windows/linux and macos artifacts to github, but the issues arise with the deploy_mac job when uploading the artifacts.
We’re using electron.builder as it’s an electron application to handle the building/signing of the artifacts


#2

You have path: dist in the other jobs, I believe this may be the issue. Can you try dropping the slashes?


#3

I added this as it was mentioned in the issue I linked, neither of the 2 ways resolved the issue


#4

Do the other jobs upload the artifacts correctly?


#5

Yes. All of them are without any warnings.
Only the macos job throws this weird message.


#6

Can you do an ls -lah of your dist directory before upload to look for symlinks? It sounds like it’s trying to read the contents of the /Users/distiller/repo/dist/mac/my.app file as a directory?

You can also try an SSH build https://circleci.com/docs/2.0/ssh-access-jobs/ to take a look at the directory structure, that may provide some clues.


#7

Here’s the output:

#!/bin/bash -eo pipefail
ls -lah ~/repo/dist
^D^Dtotal 254968
drwxr-xr-x  10 distiller  staff   340B Mar 19 10:17 .
drwxr-xr-x  27 distiller  staff   918B Mar 19 10:15 ..
drwxr-xr-x   3 distiller  staff   102B Mar 19 10:16 .icon-icns
-rw-r--r--   1 distiller  staff   501B Mar 19 10:17 latest-mac.yml
drwxr-xr-x   3 distiller  staff   102B Mar 19 10:16 mac
drwxr-xr-x   4 distiller  staff   136B Mar 19 10:15 main
-rw-r--r--@  1 distiller  staff    64M Mar 19 10:16 myApp-0.5.2-mac.dmg
-rw-r--r--   1 distiller  staff    70K Mar 19 10:16 myApp-0.5.2-mac.dmg.blockmap
-rw-r--r--   1 distiller  staff    61M Mar 19 10:17 myApp-0.5.2-mac.zip
drwxr-xr-x   7 distiller  staff   238B Mar 19 10:15 renderer

Thanks alot for the quick responses!

**Edit - added the correct notes

#!/bin/bash -eo pipefail
ls -lah ~/repo/dist/mac
^D^Dtotal 0
drwxr-xr-x   3 distiller  staff   102B Mar 19 11:06 .
drwxr-xr-x  10 distiller  staff   340B Mar 19 11:07 ..
drwxr-xr-x   3 distiller  staff   102B Mar 19 11:06 my.app