Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Fix kubernetes mode #906

Merged
merged 32 commits into from
Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from 30 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
29 changes: 17 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
- docker
env:
global:
- DOCKER_BUILDKIT=1
- secure: "TNhj8oXrtBzCkkJDA8qbDmqUggK9Kbsy8Itgi0+VmXB+3bVRornZMS38ppaFz+BVOTdL80ZvN2s/OPV106QjFv0Hx1MmWAw4kNST2QBtxFXBHRKYtr7NtBN0jr11el1fG83YdpeZYQbc5aqbJ4OPz2GpfhGfDVhVGPjMFMKXI5XbTbbl+HCEL67ywozt964LhpuuXTaX7jgYFiJUtcwkYRUaDYY3ryJvMSOx95AjKyRMNC5JlgAqbJuYsOTm1eVZtfQ1jYVvd/NuAHOMDNpZWvcIaxTuc3k4XZh4UPryuRJWfjgjIq6kua7Q6ho6W2GbDgN2b/9lIldkTR8QfLSnCNLJIg6KJZ2gmIQg7u+nZHemdugo9XkvfmKXfB/t3HChFX1HNtS4gSeIn874IynLHx3UJ1lxm7BdDbF4Jjijffj5uWDGqVj3/Myd2jdFTJCoLJXvYI7la6ouMzXW5aDFhy2UXK2A3q7aBbaD64+U1R7YPGIyvfAd7NCF11vtRvJGI/fNjO5S1EuSacrQm7CiXu0rd0L5EOSU85XNTQsWN6xxJKEcc8Hx9YLRXkmR7gK9LoEPTUwFbfVXBUvnOsZav3MOBBxzj4+eLxkx2B1vbY2Lx5yPAqyWwi3vet46NEZUIKgqK+xRYQKj6dj3OF1gx7LOcyhpyevdpTZotiEx0C4=" # SNAP_API_AUTH
git:
depth: 9999999 # Building untagged builds needs enough depth to get the latest tag
Expand Down Expand Up @@ -45,39 +46,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"
before_install:
- cd aimmo-game
- docker build -t ocadotechnology/aimmo-game:test .
- docker build --target tester -t ocadotechnology/aimmo-game:test .
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- sudo apt-get update
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
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