Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix macOS dependency cache. #14795

Merged
merged 1 commit into from Jan 24, 2024
Merged

Fix macOS dependency cache. #14795

merged 1 commit into from Jan 24, 2024

Conversation

aarlt
Copy link
Member

@aarlt aarlt commented Jan 22, 2024

Fixes #12925.

@aarlt aarlt force-pushed the osx-caching branch 3 times, most recently from 717648f to aff81f8 Compare January 22, 2024 14:41
@aarlt
Copy link
Member Author

aarlt commented Jan 22, 2024

I just wondered about the message while saving the cache /opt/homebrew not found. It looks like that the default installation location of hombrew is different between intel & apple silicon:

  • /usr/local/Homebrew on Intel Macs
  • /opt/homebrew on Apple Silicon Macs.

So the change seem to be ok - even for intel macs ;)

@cameel cameel requested a review from r0qs January 22, 2024 14:54
@ethereum ethereum deleted a comment from stackenbotten Jan 22, 2024
@ethereum ethereum deleted a comment from stackenbotten Jan 22, 2024
@aarlt aarlt force-pushed the osx-caching branch 2 times, most recently from 78a3545 to d6bb160 Compare January 22, 2024 16:58
@aarlt aarlt changed the title Fix dependency cache. Fix macOS dependency cache. Jan 22, 2024
@aarlt aarlt force-pushed the osx-caching branch 2 times, most recently from 24a8c68 to fd699df Compare January 23, 2024 02:00
Comment on lines 399 to 400
sudo chmod 777 /usr/local
sudo chmod 777 /usr/local/bin
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This yields

Unable to set permissions on "/usr/local/bin" - chmod /usr/local/bin: operation not permitted
Unable to set permissions on "/usr/local" - chmod /usr/local: operation not permitted

in the b_osx restore cache step, although it doesn't seem to cause any issues.

Copy link
Member Author

@aarlt aarlt Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the thing is that it still works and its also needed. if not set, the cache restore is not possible, because it's not allowed to write into these directories. I don't know why circleci is generating these messages.

.circleci/config.yml Outdated Show resolved Hide resolved
Comment on lines 399 to 400
sudo chmod 777 /usr/local
sudo chmod 777 /usr/local/bin
Copy link
Member

@r0qs r0qs Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it needs to be set to 777 and not 755 (which I believe is the default)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just seeing strange errors when I was restoring the cache.. but you might be right, that 755 is sufficient

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be needed to have those set to 777 before restoring the cache.. lets see

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok its needed before the cache gets restored:

Skipping writing "usr/local/Cellar/boost/1.83.0/include/boost/align/detail/alignment_of_gcc.hpp" - mkdir /usr/local/Cellar: permission denied
Skipping writing "usr/local/Cellar/boost/1.83.0/include/boost/align/detail/alignment_of_msvc.hpp" - mkdir /usr/local/Cellar: permission denied
Skipping writing "usr/local/Cellar/boost/1.83.0/include/boost/align/detail/assume_aligned.hpp" - mkdir /usr/local/Cellar: permission denied
Skipping writing "usr/local/Cellar/boost/1.83.0/include/boost/align/detail/assume_aligned_clang.hpp" - mkdir /usr/local/Cellar: permission denied
Skipping writing "usr/local/Cellar/boost/1.83.0/include/boost/align/detail/assume_aligned_gcc.hpp" - mkdir /usr/local/Cellar: permission denied
Skipping writing "usr/local/Cellar/boost/1.83.0/include/boost/align/detail/assume_aligned_intel.hpp" - mkdir /usr/local/Cellar: permission denied
Skipping writing "usr/local/Cellar/boost/1.83.0/include/boost/align/detail/assume_aligned_msvc.hpp" - mkdir /usr/local/Cellar: permission denied
Skipping writing "usr/local/Cellar/boost/1.83.0/include/boost/align/detail/element_type.hpp" - mkdir /usr/local/Cellar: permission denied
Skipping writing "usr/local/Cellar/boost/1.83.0/include/boost/align/detail/integral_constant.hpp" - mkdir /usr/local/Cellar: permission denied
Skipping writing "usr/local/Cellar/boost/1.83.0/include/boost/align/detail/is_aligned.hpp" - mkdir /usr/local/Cellar: permission denied

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but youre right that its better to have those not set to 777 after the cache restore

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just ignore them. The fact that it fails when you set 755 means that they probably are set to 777 in the image to begin with. I'd rather not restore them and keep the CI script less complicated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the cache restore is not executed as root, an thus mean that with 755 the directory is not writable for others (owner is root here). however, I agree to let the CI script as simple as possible. I will remove it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the cache restore is not executed as root, an thus mean that with 755 the directory is not writable for others (owner is root here

Which means that, like I said, it's probably not 755 but rather 777 by default, right?

I mean, I'm not sure what you meant. Your comment does not contradict what I said but, the "however" makes it sound as it was meant to say it's wrong? :)

Copy link
Member

@cameel cameel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some suggestions but I'm going to just push them as fixups. The only remaining things are the rm /usr/local/* vs rm /opt/homebrew thing and the permissions. Both trivial to change.

If you're fine with my fixups when once the comments are resolved, we can merge.

.circleci/config.yml Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
Comment on lines 399 to 400
sudo chmod 777 /usr/local
sudo chmod 777 /usr/local/bin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just ignore them. The fact that it fails when you set 755 means that they probably are set to 777 in the image to begin with. I'd rather not restore them and keep the CI script less complicated.

@aarlt aarlt force-pushed the osx-caching branch 2 times, most recently from 2288f72 to 98f2b83 Compare January 24, 2024 10:52
Copy link
Member

@cameel cameel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did one last look through this and noticed a few more things. The important one is whether we're not forgetting to cache /usr/local/Cellar/ (or its equivalent on ARM). The rest is about adding some more comments that explain why things are done the way they are.

.circleci/config.yml Show resolved Hide resolved
.circleci/config.yml Show resolved Hide resolved
cameel
cameel previously approved these changes Jan 24, 2024
Copy link
Member

@cameel cameel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the bit with setting permissions to 755 just came back. Or did I miss it earlier? In any case, I'm approving because it's mostly a cosmetic detail, but I think it would still be best to get rid of it before we merge.

Comment on lines 423 to 427
- run:
name: chmod 755 for /opt/homebrew & /usr/local
command: |
[[ -d /opt/homebrew ]] && sudo chmod 755 /opt/{homebrew,homebrew/bin}
sudo chmod 755 /usr/{local,local/bin}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I missed it when I looked last time or if you added it back. I thought we agree to remove it (#14795 (comment)).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ups, yeah looks like it just came back.. will remove that now

@cameel cameel merged commit 89a70c7 into develop Jan 24, 2024
65 checks passed
@cameel cameel deleted the osx-caching branch January 24, 2024 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CircleCI dependency caching broken on macOS
4 participants