Skip to content

Commit bf8c00d

Browse files
committed
Initial rebase of AMO (tag:2019.02.28) to ATN master:
* Don't generate Firefox/Android addons for local dev * Set Thunderbird as the default app * Only enable Firefox/Android if in tests * Add auth bypass for development * Adjusted legacy extension upload message for ATN * Add contextmanager function to hack around test fixtures and addons-linter woes * Update ci workflow * Lots of test fixes
1 parent 73a883f commit bf8c00d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+422
-500
lines changed

.github/workflows/ci-tests.yml

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,29 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21-
- uses: actions/checkout@v4
22-
23-
- name: Start DB
24-
run: |
25-
docker run --add-host host.docker.internal:host-gateway --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=verysecurepw -e MYSQL_DATABASE=test_olympia -d mysql:8.0 --default-authentication-plugin=mysql_native_password
26-
sleep 15
27-
docker exec mysql mysql -P 3306 -u root -p"verysecurepw" -e "CREATE USER 'root'@'127.0.0.1' IDENTIFIED WITH mysql_native_password BY 'verysecurepw';"
28-
docker exec mysql mysql -P 3306 -u root -p"verysecurepw" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1';"
29-
30-
- name: Start ES
31-
run: docker run --add-host host.docker.internal:host-gateway --name es -p 9200:9200 -p 9300:9300 -e ES_NETWORK_HOST=0.0.0.0 -e discovery.type=single-node -d elasticsearch:5.6.12-alpine
32-
33-
- name: Run docker container
34-
run: docker run --add-host host.docker.internal:host-gateway -it -d --name atn -e DATABASES_DEFAULT_URL=mysql://root:verysecurepw@host.docker.internal:3306/test_olympia -e ES_HOSTS=host.docker.internal:9200 -e ELASTICSEARCH_LOCATION=host.docker.internal:9200 -v $GITHUB_WORKSPACE/src:/data/olympia/src:rw thunderbirdops/addons-server bash
35-
36-
- name: Install deps
37-
run: docker exec atn bash -c "make -f Makefile-docker update_deps"
38-
39-
- name: Patch Django
40-
run: docker exec atn bash -c "sed -i 's/TX_ISOLATION = /transaction_isolation = /' /usr/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py"
41-
42-
- name: Run tests
43-
run: docker exec atn bash -c 'python -m pytest --junitxml=src/test_report.xml -m "not es_tests" src/olympia/'
44-
45-
- name: Publish test results
46-
uses: EnricoMi/publish-unit-test-result-action@v2
47-
if: always()
48-
with:
49-
files: src/test_report.xml
21+
- uses: actions/checkout@v4
22+
23+
- name: Build Docker Compose
24+
run: docker compose build
25+
26+
- name: Run Docker Compose
27+
run: docker compose up -d
28+
29+
- name: Wait a bit for MySQL to boot
30+
run: sleep 10
31+
32+
- name: Install deps
33+
run: docker exec atn bash -c "make -f Makefile-docker update_deps"
34+
35+
- name: Patch Django
36+
run: docker exec atn bash -c "sed -i 's/TX_ISOLATION = /transaction_isolation = /' /usr/local/lib/python3.6/site-packages/django/db/backends/mysql/base.py"
37+
38+
- name: Run tests
39+
run: docker exec atn bash -c 'python -m pytest --junitxml=src/test_report36.xml -m "not es_tests" src/olympia/'
40+
41+
- name: Publish test results
42+
uses: EnricoMi/publish-unit-test-result-action@v2
43+
if: always()
44+
with:
45+
check_name: "Python 3.6 Test Results"
46+
files: src/test_report36.xml

Dockerfile.python3

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ ENV PYTHON_VERSION_MAJOR 3
77
# Allow scripts to detect we're running in our own container
88
RUN touch /addons-server-docker-container
99

10+
# Update the main repositories to the archived repository
11+
RUN echo "deb http://archive.debian.org/debian stretch main contrib non-free" > /etc/apt/sources.list
12+
1013
# Add nodesource repository and requirements
1114
ADD docker/nodesource.gpg.key /etc/pki/gpg/GPG-KEY-nodesource
1215
RUN apt-get update && apt-get install -y \
@@ -17,7 +20,9 @@ RUN cat /etc/pki/gpg/GPG-KEY-nodesource | apt-key add -
1720
ADD docker/debian-stretch-nodesource-repo /etc/apt/sources.list.d/nodesource.list
1821
ADD docker/debian-stretch-backports-repo /etc/apt/sources.list.d/backports.list
1922

20-
RUN apt-get update && apt-get install -y \
23+
RUN apt-get update && apt-get install -y --allow-downgrades \
24+
# Downgrades
25+
libssl1.1=1.1.0l-1~deb9u1 \
2126
# General (dev-) dependencies
2227
bash-completion \
2328
build-essential \
@@ -50,16 +55,16 @@ RUN apt-get update && apt-get install -y \
5055
libmaxminddb-dev \
5156
&& rm -rf /var/lib/apt/lists/*
5257

53-
RUN apt-get update && apt-get -t stretch-backports install -y \
54-
# For git-based files storage backend
55-
libgit2-dev \
56-
&& rm -rf /var/lib/apt/lists/*
58+
#RUN apt-get update && apt-get -t stretch-backports install -y \
59+
# # For git-based files storage backend
60+
# libgit2-dev \
61+
# && rm -rf /var/lib/apt/lists/*
5762

58-
ADD http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz /tmp
63+
#ADD http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz /tmp
5964

60-
RUN mkdir -p /usr/local/share/GeoIP \
61-
&& gunzip -c /tmp/GeoLite2-Country.mmdb.gz > /usr/local/share/GeoIP/GeoLite2-Country.mmdb \
62-
&& rm -f /tmp/GeoLite2-Country.mmdb.gz
65+
#RUN mkdir -p /usr/local/share/GeoIP \
66+
# && gunzip -c /tmp/GeoLite2-Country.mmdb.gz > /usr/local/share/GeoIP/GeoLite2-Country.mmdb \
67+
# && rm -f /tmp/GeoLite2-Country.mmdb.gz
6368

6469
# Compile required locale
6570
RUN localedef -i en_US -f UTF-8 en_US.UTF-8
@@ -100,3 +105,4 @@ ENV CLEANCSS_BIN /deps/node_modules/.bin/cleancss
100105
ENV LESS_BIN /deps/node_modules/.bin/lessc
101106
ENV UGLIFY_BIN /deps/node_modules/.bin/uglifyjs
102107
ENV ADDONS_LINTER_BIN /deps/node_modules/.bin/addons-linter
108+
RUN npm cache clean -f && npm install -g n && /deps/bin/n 16

Makefile-docker

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ populate_data:
9797
# reindex --wipe will force the ES mapping to be re-installed. Useful to
9898
# make sure the mapping is correct before adding a bunch of add-ons.
9999
$(PYTHON_COMMAND) manage.py reindex --wipe --force --noinput
100-
$(PYTHON_COMMAND) manage.py generate_addons --app firefox $(NUM_ADDONS)
101-
$(PYTHON_COMMAND) manage.py generate_addons --app android $(NUM_ADDONS)
100+
#$(PYTHON_COMMAND) manage.py generate_addons --app firefox $(NUM_ADDONS)
101+
#$(PYTHON_COMMAND) manage.py generate_addons --app android $(NUM_ADDONS)
102102
$(PYTHON_COMMAND) manage.py generate_addons --app thunderbird $(NUM_ADDONS)
103-
$(PYTHON_COMMAND) manage.py generate_themes --app firefox $(NUM_THEMES)
103+
#$(PYTHON_COMMAND) manage.py generate_themes --app firefox $(NUM_THEMES)
104104
$(PYTHON_COMMAND) manage.py generate_themes --app thunderbird $(NUM_THEMES)
105105
# These add-ons are specifically useful for the addons-frontend
106106
# homepage. You may have to re-run this, in case the data there

UPGRADE_STATUS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Upgrade Status
2+
3+
ATN is currently rebased onto AMO tag 2019.02.28

docker-compose.mac-arm.yml

Lines changed: 0 additions & 114 deletions
This file was deleted.

docker-compose.override.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
version: "2.3"
2-
31
services:
4-
nginx:
5-
ports:
6-
- "80:80"
2+
# nginx:
3+
# ports:
4+
# - "80:80"
75

86
web:
97
ports:

docker-compose.yml

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: "2.3"
2-
31
# If you're changing the &env mapping
42
# please make sure to update tests/ui/docker-compose.selenium.yml
53
# accordingly.
@@ -20,7 +18,10 @@ x-env-mapping: &env
2018
services:
2119
worker: &worker
2220
<<: *env
23-
image: addons/addons-server:latest-py3
21+
#image: addons/addons-server:latest-py3
22+
build:
23+
context: .
24+
dockerfile: Dockerfile.python3
2425
command: supervisord -n -c /code/docker/supervisor-celery.conf
2526
entrypoint: ./scripts/start-docker.sh
2627
volumes:
@@ -32,19 +33,24 @@ services:
3233
<<: *worker
3334
command: supervisord -n -c /code/docker/supervisor.conf
3435

35-
nginx:
36-
image: addons/addons-nginx
37-
volumes:
38-
- ./static:/srv/static
39-
- ./site-static:/srv/site-static
40-
- ./storage/shared_storage/uploads:/srv/user-media
41-
- ./storage/files:/srv/user-media/addons
36+
# nginx:
37+
# image: addons/addons-nginx
38+
# volumes:
39+
# - ./static:/srv/static
40+
# - ./site-static:/srv/site-static
41+
# - ./storage/shared_storage/uploads:/srv/user-media
42+
# - ./storage/files:/srv/user-media/addons
4243

4344
memcached:
4445
image: memcached:1.4
4546

4647
mysqld:
4748
image: mysql:5.7
49+
ulimits:
50+
nproc: 65535
51+
nofile:
52+
soft: 20000
53+
hard: 40000
4854
environment:
4955
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
5056
- MYSQL_DATABASE=olympia
@@ -62,13 +68,18 @@ services:
6268
- xpack.watcher.enabled=false
6369
- "discovery.type=single-node"
6470
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
71+
ulimits:
72+
nproc: 65535
73+
nofile:
74+
soft: 20000
75+
hard: 40000
6576
mem_limit: 2g
6677

6778
redis:
6879
image: redis:2.8
6980

7081
rabbitmq:
71-
image: rabbitmq:3.5
82+
image: rabbitmq:3
7283
hostname: olympia
7384
expose:
7485
- "5672"
@@ -77,19 +88,20 @@ services:
7788
- RABBITMQ_DEFAULT_PASS=olympia
7889
- RABBITMQ_DEFAULT_VHOST=olympia
7990

91+
# ATN Doesn't sign addons, but we need it for tests
8092
autograph:
8193
image: mozilla/autograph:2.7.0
8294

83-
addons-frontend:
84-
<<: *env
85-
environment:
86-
- HOSTNAME=uitests
87-
- WEBPACK_SERVER_HOST=olympia-frontend.test
88-
- FXA_CONFIG=default
89-
image: addons/addons-frontend
90-
ports:
91-
- "3000:3000"
92-
- "3001:3001"
93-
command: yarn amo:ui-tests
94-
links:
95-
- "nginx:olympia.test"
95+
# addons-frontend:
96+
# <<: *env
97+
# environment:
98+
# - HOSTNAME=uitests
99+
# - WEBPACK_SERVER_HOST=olympia-frontend.test
100+
# - FXA_CONFIG=default
101+
# image: addons/addons-frontend
102+
# ports:
103+
# - "3000:3000"
104+
# - "3001:3001"
105+
# command: yarn amo:ui-tests
106+
# links:
107+
# - "nginx:olympia.test"

requirements/prod_common.txt

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -265,33 +265,8 @@ kombu==4.3.0 \
265265
--hash=sha256:7a2cbed551103db9a4e2efafe9b63222e012a61a18a881160ad797b9d4e1d0a1 \
266266
--hash=sha256:529df9e0ecc0bad9fc2b376c3ce4796c41b482cf697b78b71aea6ebe7ca353c8
267267
# lxml is required by pyquery
268-
lxml==4.3.1 \
269-
--hash=sha256:1c630c083d782cbaf1f7f37f6cac87bda9cff643cf2803a5f180f30d97955cef \
270-
--hash=sha256:983129f3fd3cef5c3cf067adcca56e30a169656c00fcc6c648629dbb850b27fa \
271-
--hash=sha256:95b392952935947e0786a90b75cc33388549dcb19af716b525dae65b186138fc \
272-
--hash=sha256:b5db89cc0ef624f3a81214b7961a99f443b8c91e88188376b6b322fd10d5b118 \
273-
--hash=sha256:47d8365a8ef14097aa4c65730689be51851b4ade677285a3b2daa03b37893e26 \
274-
--hash=sha256:9563a23c1456c0ab550c087833bc13fcc61013a66c6420921d5b70550ea312bf \
275-
--hash=sha256:0537eee4902e8bf4f41bfee8133f7edf96533dd175930a12086d6a40d62376b2 \
276-
--hash=sha256:7940d5c2185ffb989203dacbb28e6ae88b4f1bb25d04e17f94b0edd82232bcbd \
277-
--hash=sha256:d4d63d85eacc6cb37b459b16061e1f100d154bee89dc8d8f9a6128a5a538e92e \
278-
--hash=sha256:dccad2b3c583f036f43f80ac99ee212c2fa9a45151358d55f13004d095e683b2 \
279-
--hash=sha256:c0c5a7d4aafcc30c9b6d8613a362567e32e5f5b708dc41bc3a81dac56f8af8bb \
280-
--hash=sha256:7cf39bb3a905579836f7a8f3a45320d9eb22f16ab0c1e112efb940ced4d057a5 \
281-
--hash=sha256:510e904079bc56ea784677348e151e1156040dbfb736f1d8ea4b9e6d0ab2d9f4 \
282-
--hash=sha256:1ae4c0722fc70c0d4fba43ae33c2885f705e96dce1db41f75ae14a2d2749b428 \
283-
--hash=sha256:09e91831e749fbf0f24608694e4573be0ef51430229450c39c83176cc2e2d353 \
284-
--hash=sha256:a0b75b1f1854771844c647c464533def3e0a899dd094a85d1d4ed72ecaaee93d \
285-
--hash=sha256:df46307d39f2aeaafa1d25309b8a8d11738b73e9861f72d4d0a092528f498baa \
286-
--hash=sha256:0562ec748abd230ab87d73384e08fa784f9b9cee89e28696087d2d22c052cc27 \
287-
--hash=sha256:ea825562b8cd057cbc9810d496b8b5dec37a1e2fc7b27bc7c1e72ce94462a09a \
288-
--hash=sha256:2fe74e3836bd8c0fa7467ffae05545233c7f37de1eb765cacfda15ad20c6574a \
289-
--hash=sha256:3f2d9eafbb0b24a33f56acd16f39fc935756524dcb3172892721c54713964c70 \
290-
--hash=sha256:e70b5e1cb48828ddd2818f99b1662cb9226dc6f57d07fc75485405c77da17436 \
291-
--hash=sha256:c0a7751ba1a4bfbe7831920d98cee3ce748007eab8dfda74593d44079568219a \
292-
--hash=sha256:37af783c2667ead34a811037bda56a0b142ac8438f7ed29ae93f82ddb812fbd6 \
293-
--hash=sha256:58d0851da422bba31c7f652a7e9335313cf94a641aa6d73b8f3c67602f75b593 \
294-
--hash=sha256:da5e7e941d6e71c9c9a717c93725cda0708c2474f532e3680ac5e39ec57d224d
268+
lxml==4.3.2 \
269+
--hash=sha256:4888be27d5cba55ce94209baef5bcd7bbd7314a3d17021a5fc10000b3a5f737d
295270
# m2secret is required by django-aesfield
296271
m2secret-py3==1.3 \
297272
--hash=sha256:94dfae937e8a61bf48812fab6a0b8de300781c4e1dbee0cee3aa57cb01915864

0 commit comments

Comments
 (0)