Differentiating between M1 and Intel resources

Hi team,

Currently in our iOS project setup we have an issue where our rubygem cache is getting corrupted as we transition from x86_64 to M1 machines. Basically both of them write into the same gem cache as there is no differentiator in the cache key.

 - restore_cache:
          keys:
            - "{{ .Environment.CACHE_VERSION }}-gems-{{ checksum \"Gemfile.lock\" }}"

Is there any environment variable which can distinguish between an x86_64 vs arm64 machine which we can use as part of the cache key or use something else available in linux like uname and strip it for consumption?

I looked at the built-in environment variables and could not find anything I can use.

You can use arch to print the current architecture.

1 Like

Thanks @flufff42! I was wondering if there was some CircleCI EnvVar but this should be a good alternative. Will try to use it to achieve an architecture dependent cache. :+1: