Linux sharing with Macos

Can anything built on a Linux container be shared with MacOS?

I have a Om Next/React Native project I’m trying to build. The restore_cache is defaulting to the /home/circleci/fiskal instead of /Users/distiller/fiskal folder.

jobs:
  build_om_next:
    docker:
      - image: circleci/clojure:lein-2.8.1-node
    working_directory: ~/fiskal
    steps:
      - restore_cache:
          keys:
            - v1-repo-{{ .Branch }}-{{ .Revision }}
      - checkout
      - save_cache:
          key: v1-repo-{{ .Branch }}-{{ .Revision }}
          paths:
            - .
  build_react_native:
    macos:
      xcode: "9.3.0"
    working_directory: ~/fiskal
    steps:
      - restore_cache:
          keys:
            - v1-repo-{{ .Branch }}-{{ .Revision }}
      - run: yarn build

I expect after your restore_cache step, you could do mv /home/circleci/fiskal /Users/distiller/fiskal in a separate run step. However, my greater worry is whether there would be any arch-dependent binaries in here that won’t work on different platforms.

When I try to restore the cache on mac (after it was saved on linux). It says I don’t have access to /Users/distiller/fiskal. There’s no way I can find to change the root that the cache restores to.

Ideally for React Native I can build the index.ios.js on a Linux box and then only use the mac box to compile iOS via XCode. The output in the index.ios.js will be the same regardless of the platform binary it was built on.

Alright, could you use /Users/distiller/fiskal on Linux then? There is no special reason why you cannot work from any arbitrary folder on Docker/Linux (since you are already root) but I don’t know if that is also the case on MacOS.

Edit

Hmm, I wonder if MacOS is always going to get in the way, since you’ll probably be a non-root user, appearing to the OS to be trying to get access to files that aren’t yours. Try using /distiller/fiskal instead, avoiding the /Users directory entirely.

wondered about the same, found this Restoring a cache from a Linux container on a macOS machine CircleCI 2.0
tl;dr: doesnt work. use different caches for linux/container vs mac

Right. The workout is to either save as an artifact (in an S3 bucket) or check into a gut branch with a tag to queue off the next step. This works for a React Native pipeline because half the work is building the main.jsbundle and the output is the same if it was compiled on Linux or Mac.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.