Skip to content

Commit 5aa777c

Browse files
committed
fix(ci): Remove automation to initializa Docker on Mac
Docker has been doing all that is possible to prevent installing Docker Desktop without user interaction, thus, we can't run `sentry devservices up`. See docker/for-mac#2359 (comment) for details. This PR removes all code that at times had managed to automate the process on Mac. We will rely on Ubuntu to test the `make bootstrap` path. We also add caching for Brew.
1 parent f3bd029 commit 5aa777c

File tree

4 files changed

+36
-107
lines changed

4 files changed

+36
-107
lines changed

Diff for: .github/workflows/development-environment.yml

+21-26
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
pull_request:
44
paths:
55
- 'Makefile'
6+
- '.github/actions/*'
67
- '.github/workflows/development-environment.yml'
78
- '.envrc'
89
- 'Brewfile'
@@ -17,7 +18,6 @@ jobs:
1718
timeout-minutes: 40
1819
strategy:
1920
matrix:
20-
# macosx-11.0 is Big Sur, however, it takes long for jobs to get started
2121
# Using Ubuntu 18 until I figure out this error:
2222
# -> ImportError: libffi.so.6: cannot open shared object file: No such file or directory
2323
os: [macos-11.0, ubuntu-18.04]
@@ -31,43 +31,34 @@ jobs:
3131
- name: Checkout sentry
3232
uses: actions/checkout@v2
3333

34+
- name: Set variables for caches
35+
id: info
36+
run: |
37+
echo "::set-output name=brew-cache-dir::$(brew --cache)"
38+
echo "::set-output name=yarn-cache-dir::$(yarn cache dir)"
39+
40+
- name: Cache (brew)
41+
uses: actions/cache@v2
42+
with:
43+
path: ${{ steps.info.outputs.brew-cache-dir }}
44+
key: devenv-${{ runner.os }}-brew-${{ hashFiles('Brewfile') }}
45+
restore-keys: devenv-${{ runner.os }}-brew
46+
3447
- name: Install prerequisites
3548
# Xcode CLI & brew are already installed, thus, no need to call xcode-select install
3649
# Sometimes, brew needs to be updated before brew bundle would work
37-
# After installing Docker (via homebrew) we need to make sure that it is properly initialized on Mac
3850
run: |
39-
brew update && brew bundle -q
40-
# This code is mentioned in our dev docs. Only remove if you adjust the docs as well
41-
SENTRY_NO_VENV_CHECK=1 ./scripts/do.sh init-docker
51+
HOMEBREW_NO_AUTO_UPDATE=1 brew bundle --no-upgrade || brew bundle -q
4252
43-
# The next few steps are to set up the cache quickly
44-
- name: Set environment variables & others
45-
id: info
46-
run: |
47-
echo "::set-output name=python-version::$(SENTRY_NO_VENV_CHECK=1 ./scripts/do.sh get-pyenv-version)"
48-
echo "::set-output name=pip-cache-dir::$(pip3 cache dir)"
49-
echo "::set-output name=pip-version::$(pip -V | awk -F ' ' '{print $2}')"
50-
echo "::set-output name=yarn-cache-dir::$(yarn cache dir)"
51-
52-
# In a sense, we set up Python two times (once here and once via pyenv). Setting
53-
# it up here is instant and it helps us to get the cache primed sooner
5453
- name: Setup Python
55-
uses: actions/setup-python@v2
56-
with:
57-
python-version: ${{ steps.info.outputs.python-version }}
54+
uses: ./.github/actions/setup-python
5855

5956
- name: Cache (pyenv)
6057
uses: actions/cache@v2
6158
with:
6259
path: ~/.pyenv
6360
key: devenv-${{ matrix.os }}-pyenv-${{ hashFiles('.python-version') }}
6461

65-
- name: Cache (pip)
66-
uses: actions/cache@v2
67-
with:
68-
path: ${{ steps.info.outputs.pip-cache-dir }}
69-
key: devenv-${{ matrix.os }}-py${{ steps.info.outputs.python-version }}-pip${{ steps.info.outputs.pip-version }}-${{ hashFiles('**/requirements.txt') }}
70-
7162
- name: Cache (yarn)
7263
uses: actions/cache@v1 # We are explicitly using v1 due to perf reasons
7364
with:
@@ -83,7 +74,11 @@ jobs:
8374
eval "$(pyenv init --path)"
8475
python -m venv .venv
8576
source .venv/bin/activate
86-
make bootstrap
77+
if [ docker system info &>/dev/null ]; then
78+
make bootstrap
79+
else
80+
make develop init-config
81+
fi
8782
8883
- name: Test direnv
8984
run: |

Diff for: .github/workflows/files/com.docker.vmnetd.plist

-28
This file was deleted.

Diff for: .github/workflows/python-deps.yml

+15-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: python deps
22
on:
33
pull_request:
44
paths:
5+
- '.github/actions/*'
56
- '.github/workflows/python-deps.yml'
67
- 'requirements*'
78

@@ -26,17 +27,25 @@ jobs:
2627
steps:
2728
- uses: actions/checkout@v2
2829

30+
- name: Set brew cache path
31+
id: brew-info
32+
run: |
33+
echo "::set-output name=brew-cache-dir::$(brew --cache)"
34+
35+
- name: Cache (brew)
36+
uses: actions/cache@v2
37+
with:
38+
path: ${{ steps.brew-info.outputs.brew-cache-dir }}
39+
key: devenv-${{ runner.os }}-brew-${{ hashFiles('Brewfile') }}
40+
restore-keys: devenv-${{ runner.os }}-brew
41+
2942
- name: Install prerequisites
3043
# Sometimes, brew needs to be updated before brew bundle would work
3144
run: |
32-
brew update && brew bundle -q
45+
HOMEBREW_NO_AUTO_UPDATE=1 brew bundle --no-upgrade || brew bundle -q
3346
34-
- name: Setup python
35-
id: setup-python
47+
- name: Setup Python
3648
uses: ./.github/actions/setup-python
37-
with:
38-
# XXX: We need to pass this python-deps-${{ matrix.os }}-py${{ matrix.python-version }}-${{ hashFiles('requirements-*.txt') }}
39-
cache-files-hash: ${{ hashFiles('requirements-*.txt') }}
4049

4150
- name: Install dependencies
4251
run: |

Diff for: scripts/lib.sh

-47
Original file line numberDiff line numberDiff line change
@@ -70,53 +70,6 @@ sudo-askpass() {
7070
fi
7171
}
7272

73-
# After using homebrew to install docker, we need to do some magic to remove the need to interact with the GUI
74-
# See: https://github.com/docker/for-mac/issues/2359#issuecomment-607154849 for why we need to do things below
75-
init-docker() {
76-
# Need to start docker if it was freshly installed or updated
77-
# You will know that Docker is ready for devservices when the icon on the menu bar stops flashing
78-
if query-mac && ! require docker && [ -d "/Applications/Docker.app" ]; then
79-
echo "Making some changes to complete Docker initialization"
80-
# allow the app to run without confirmation
81-
xattr -d -r com.apple.quarantine /Applications/Docker.app
82-
83-
# preemptively do docker.app's setup to avoid any gui prompts
84-
# This path is not available for brand new MacBooks
85-
sudo-askpass /bin/mkdir -p /Library/PrivilegedHelperTools
86-
sudo-askpass /bin/chmod 754 /Library/PrivilegedHelperTools
87-
sudo-askpass /bin/cp /Applications/Docker.app/Contents/Library/LaunchServices/com.docker.vmnetd /Library/PrivilegedHelperTools/
88-
sudo-askpass /bin/chmod 544 /Library/PrivilegedHelperTools/com.docker.vmnetd
89-
90-
# This file used to be generated as part of brew's installation
91-
if [ -f /Applications/Docker.app/Contents/Resources/com.docker.vmnetd.plist ]; then
92-
sudo-askpass /bin/cp /Applications/Docker.app/Contents/Resources/com.docker.vmnetd.plist /Library/LaunchDaemons/
93-
else
94-
sudo-askpass /bin/cp .github/workflows/files/com.docker.vmnetd.plist /Library/LaunchDaemons/
95-
fi
96-
sudo-askpass /bin/chmod 644 /Library/LaunchDaemons/com.docker.vmnetd.plist
97-
sudo-askpass /bin/launchctl load /Library/LaunchDaemons/com.docker.vmnetd.plist
98-
fi
99-
start-docker
100-
}
101-
102-
# This is mainly to be used by CI
103-
# We need this for Mac since the executable docker won't work properly
104-
# until the app is opened once
105-
start-docker() {
106-
if query-mac && ! docker system info &>/dev/null; then
107-
echo "About to open Docker.app"
108-
# At a later stage in the script, we're going to execute
109-
# ensure_docker_server which waits for it to be ready
110-
if ! open -g -a Docker.app; then
111-
# If the step above fails, at least we can get some debugging information to determine why
112-
sudo-askpass ls -l /Library/PrivilegedHelperTools/com.docker.vmnetd
113-
ls -l /Library/LaunchDaemons/
114-
cat /Library/LaunchDaemons/com.docker.vmnetd.plist
115-
ls -l /Applications/Docker.app
116-
fi
117-
fi
118-
}
119-
12073
upgrade-pip() {
12174
pip install --upgrade "pip==21.1.2" "wheel==0.36.2"
12275
}

0 commit comments

Comments
 (0)