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 kubernetes mode #906

Merged
merged 32 commits into from
Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
24bc1bf
fixed default port not being given in dockerfile for games
Nov 21, 2018
c601674
Changed simulation runner to make use of asyncio
Nov 21, 2018
6b2bf35
changed parallel_map to async_map
Nov 22, 2018
d973a58
Waiting for workers pt. 1
faucomte97 Nov 22, 2018
8053284
aimmo now works in kubernetes mode again
Nov 22, 2018
8853705
aimmo now works in kubernetes mode again (tests fails though)
Nov 22, 2018
8e72e99
Merge remote-tracking branch 'origin/fix_kubernetes_mode' into fix_ku…
Nov 22, 2018
b8f6f7e
fixed broken tests
Nov 23, 2018
2bc24dc
pep8
Nov 23, 2018
fb00179
removed temporary logging
Nov 23, 2018
1920f18
moved get loop into setUp for tests
Nov 23, 2018
0e057be
bump version++
Nov 26, 2018
287912f
make runner last build stage
Nov 26, 2018
f8715f5
remove broken coverage tool
Nov 26, 2018
55ebb1c
removed broken coverage tool++
Nov 26, 2018
3ab42a5
change docker build target in tester
Nov 26, 2018
4a4e62f
docker now uses buildkit (requires docker 18.09)
Nov 27, 2018
812dc25
create build hook for docker cloud
Nov 27, 2018
5aedac4
fix syntax error
Nov 27, 2018
83d8b5c
add image tag to build hook
Nov 27, 2018
505c63a
fix image name on build hook
Nov 27, 2018
ab954e5
add build hook for worker and game-creator
Nov 27, 2018
2f274f6
remove pwd from build hooks
Nov 27, 2018
024d431
remove broken coverage tool from travis.yml
Nov 27, 2018
52aefca
change env variable to be str not int
Nov 27, 2018
306bee8
force setup.py version
Nov 28, 2018
db2ab81
Revert "force setup.py version"
Nov 28, 2018
f78f1f7
review changes
Nov 29, 2018
d8edab5
add dockerbuildkit env variable to travis
Nov 29, 2018
6ed36c9
change the way docker is installed for travis test
Nov 29, 2018
460f09a
removed docker addon from travis.yml (installing older version)
Nov 29, 2018
086d8c2
changed logic in docker scripts
Nov 29, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ jobs:
- minikube update-context
# Wait for Kubernetes to be up and ready.
- JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done
addons:
apt:
packages:
- docker-ce
before_install:
- nvm install node
- nvm use node
Expand All @@ -45,39 +49,43 @@ jobs:
- node djangoBundler.js
- popd
script:
- python all_tests.py --no-docker-container-tests --coverage
after_success:
- coveralls
- python all_tests.py --no-docker-container-tests
- name: "aimmo-game"
addons:
apt:
packages:
- docker-ce
before_install:
- cd aimmo-game
- docker build -t ocadotechnology/aimmo-game:test .
- docker build --target tester -t ocadotechnology/aimmo-game:test .
install:
- pip install coveralls
script:
- docker run -it -p 5000:5000 ocadotechnology/aimmo-game:test
after_success:
- coveralls
- name: "aimmo-game-creator"
addons:
apt:
packages:
- docker-ce
before_install:
- cd aimmo-game-creator
- docker build -t ocadotechnology/aimmo-game-creator:test .
- docker build --target tester -t ocadotechnology/aimmo-game-creator:test .
install:
- pip install coveralls
script:
- docker run -it -p 5000:5000 ocadotechnology/aimmo-game-creator:test
after_success:
- coveralls
- name: "aimmo-game-worker"
addons:
apt:
packages:
- docker-ce
before_install:
- cd aimmo-game-worker
- docker build -t ocadotechnology/aimmo-game-worker:test .
- docker build --target tester -t ocadotechnology/aimmo-game-worker:test .
install:
- pip install coveralls
script:
- docker run -it -p 5000:5000 ocadotechnology/aimmo-game-worker:test
after_success:
- coveralls
- name: "Javascript Tests"
before_install:
- nvm install node
Expand Down
10 changes: 0 additions & 10 deletions aimmo-game-creator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,16 @@ MAINTAINER code@ocado.com
# RUN apk add --no-cache gcc musl-dev python-dev libffi-dev openssl-dev
RUN pip install pipenv
COPY ["Pipfile", "Pipfile.lock", "setup.py", "./"]
RUN pipenv install coverage
RUN pipenv install --system --deploy

FROM python:3.6-alpine as base
COPY --from=builder /usr/local/lib/python3.6/site-packages /usr/local/lib/python3.6/site-packages
COPY . .


FROM base as runner
ENV WORKER_MANAGER=kubernetes
CMD ["python", "./service.py", "0.0.0.0"]


FROM base as tester
ENV WORKER_MANAGER=kubernetes
CMD ["python", "setup.py", "test"]

FROM base as coverage_tester
ENV WORKER_MANAGER=kubernetes
ENV WITH_COVERAGE='True'
RUN apk add bash
COPY --from=builder /usr/local/bin/coverage /usr/local/bin/coverage
CMD python setup.py test
1 change: 0 additions & 1 deletion aimmo-game-creator/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ name = "pypi"
kubernetes = "*"
aimmo-game-creator = {editable = true, path = "."}
docker = "*"
coverage = "*"

[requires]
python_version = "3.6.7"
79 changes: 21 additions & 58 deletions aimmo-game-creator/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions aimmo-game-creator/hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
docker build --target runner -t $IMAGE_NAME .
13 changes: 0 additions & 13 deletions aimmo-game-creator/setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
# -*- coding: utf-8 -*-
from setuptools import find_packages, setup
import coverage
import sys
import os


withcoverage = os.environ.get('WITH_COVERAGE')

if withcoverage == 'True':
print("starting code coverage engine")
coveragedatafile = ".coverage"
cov = coverage.Coverage(config_file=False)
cov.start()


setup(
name='aimmo-game-creator',
packages=find_packages(),
Expand All @@ -28,8 +20,3 @@
test_suite='tests',
zip_safe=False,
)

if withcoverage == 'True':
print("saving coverage stats")
cov.save()
print("exiting program")
9 changes: 0 additions & 9 deletions aimmo-game-worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ MAINTAINER code@ocado.com

RUN pip install pipenv
COPY ["Pipfile", "Pipfile.lock", "setup.py", "./"]
RUN pipenv install coverage
RUN pipenv install --system --deploy

FROM python:3.6-alpine as base
Expand All @@ -13,16 +12,8 @@ COPY . .
FROM base as runner
ENV WORKER_MANAGER=kubernetes
ENV FLASK_ENV='development'
RUN apk add --no-cache bash
CMD python ./service.py 0.0.0.0 $PORT $DATA_URL

FROM base as tester
ENV WORKER_MANAGER=kubernetes
CMD python setup.py test

FROM base as coverage_tester
ENV WORKER_MANAGER=kubernetes
ENV WITH_COVERAGE='True'
RUN apk add bash
COPY --from=builder /usr/local/bin/coverage /usr/local/bin/coverage
CMD python setup.py test
40 changes: 20 additions & 20 deletions aimmo-game-worker/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions aimmo-game-worker/hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
docker build --target runner -t $IMAGE_NAME .
12 changes: 0 additions & 12 deletions aimmo-game-worker/setup.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
# -*- coding: utf-8 -*-
from setuptools import find_packages, setup
import coverage
import sys
import os


withcoverage = os.environ.get('WITH_COVERAGE')

if withcoverage == 'True':
print("starting code coverage engine")
coveragedatafile = ".coverage"
cov = coverage.Coverage(config_file=False)
cov.start()

setup(
name='aimmo-game-worker',
packages=find_packages(),
Expand All @@ -28,8 +21,3 @@
test_suite='tests',
zip_safe=False,
)

if withcoverage == 'True':
print("saving coverage stats")
cov.save()
print("exiting program")
14 changes: 2 additions & 12 deletions aimmo-game/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
FROM python:3.6 as builder
MAINTAINER code@ocado.com

RUN pip install pipenv
COPY ["Pipfile", "Pipfile.lock", "setup.py", "./"]
RUN pipenv install coverage
RUN pipenv install --system --deploy

FROM python:3.6-alpine as base
COPY --from=builder /usr/local/lib/python3.6/site-packages /usr/local/lib/python3.6/site-packages
COPY . .

FROM base as runner
RUN apk add --no-cache bash
ENV WORKER_MANAGER=kubernetes
CMD python ./service.py 0.0.0.0

FROM base as tester
ENV WORKER_MANAGER=kubernetes
CMD python setup.py test

FROM base as coverage_tester
FROM base as runner
ENV WORKER_MANAGER=kubernetes
ENV WITH_COVERAGE='True'
RUN apk add bash
COPY --from=builder /usr/local/bin/coverage /usr/local/bin/coverage
CMD python setup.py test
CMD python ./service.py 0.0.0.0 5000
3 changes: 1 addition & 2 deletions aimmo-game/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ verify_ssl = true
name = "pypi"

[packages]
aimmo-game = {path = ".", editable = true}
aimmo-game = {editable = true, path = "."}
docker = "*"
kubernetes = "*"
prometheus-client = "*"
aiohttp = "*"
aiohttp-cors = "*"
coverage = "*"

[requires]
python_version = "3.6.7"
Loading