From e7cbce925d4ea03e488c792b2c88728bd7846afd Mon Sep 17 00:00:00 2001 From: Dan Osborne Date: Thu, 18 Feb 2016 16:21:44 -0800 Subject: [PATCH] Updated to use latest libcalico, and new calico/builder --- Makefile | 33 +++++++++++------------------ build_calico_mesos/Dockerfile | 32 ---------------------------- build_calico_mesos/requirements.txt | 6 ------ circle.yml | 16 -------------- 4 files changed, 12 insertions(+), 75 deletions(-) delete mode 100644 build_calico_mesos/Dockerfile delete mode 100644 build_calico_mesos/requirements.txt diff --git a/Makefile b/Makefile index 330fe33..afbaf36 100644 --- a/Makefile +++ b/Makefile @@ -4,43 +4,35 @@ BUILD_FILES=$(BUILD_DIR)/Dockerfile $(BUILD_DIR)/requirements.txt CALICO_MESOS_FILES=calico_mesos/calico_mesos.py default: help -calico_mesos: dist/binary/calico_mesos ## Create the calico_mesos plugin binary -build_image: build_calico_mesos/.calico_mesos_builder.created ## Create the calico/mesos-build image - -## Create the image that builds calico_mesos. -build_calico_mesos/.calico_mesos_builder.created: $(BUILD_DIR) - cd build_calico_mesos && docker build -t calico/mesos-builder . - touch build_calico_mesos/.calico_mesos_builder.created +calico_mesos: dist/calico_mesos ## Create the calico_mesos plugin binary ## Create the calico_mesos plugin binary -dist/binary/calico_mesos: $(CALICO_MESOS_FILES) build_calico_mesos/.calico_mesos_builder.created - mkdir -p -m 777 dist/binary/ +dist/calico_mesos: $(CALICO_MESOS_FILES) + mkdir -p -m 777 dist/ # Build the mesos plugin - -docker run --rm \ - -v `pwd`/calico_mesos:/code/calico_mesos \ - -v `pwd`/dist/binary:/code/dist \ - calico/mesos-builder \ + docker run --rm \ + -v `pwd`/calico_mesos/:/code/calico_mesos \ + -v `pwd`/dist/:/code/dist \ + calico/build \ pyinstaller calico_mesos/calico_mesos.py -ayF ## Run the UTs in a container -ut: build_calico_mesos/.calico_mesos_builder.created +ut: # Use the `root` user, since code coverage requires the /code directory to # be writable. It may not be writable for the `user` account inside the # container. docker run --rm -v `pwd`/calico_mesos:/code -u root \ - calico/mesos-builder bash -c \ - '/tmp/etcd -data-dir=/tmp/default.etcd/ >/dev/null 2>&1 & \ - nosetests tests/unit -c nose.cfg' + calico/test \ + nosetests tests/unit -c nose.cfg ut-circle: calico_mesos docker run \ -v `pwd`/calico_mesos:/code \ -v $(CIRCLE_TEST_REPORTS):/circle_output \ -e COVERALLS_REPO_TOKEN=$(COVERALLS_REPO_TOKEN) \ - calico/mesos-builder bash -c \ - '/tmp/etcd -data-dir=/tmp/default.etcd/ >/dev/null 2>&1 & \ - cd calico_containers; nosetests tests/unit -c nose.cfg \ + calico/test sh -c \ + 'nosetests tests/unit -c nose.cfg \ --with-xunit --xunit-file=/circle_output/output.xml; RC=$$?;\ [[ ! -z "$$COVERALLS_REPO_TOKEN" ]] && coveralls || true; exit $$RC' @@ -49,7 +41,6 @@ clean: find . -name '*.created' -exec rm -f {} + find . -name '*.pyc' -exec rm -f {} + -rm -rf dist - -docker rmi calico/mesos-builder help: # Some kind of magic from https://gist.github.com/rcmachado/af3db315e31383502660 $(info Available targets) diff --git a/build_calico_mesos/Dockerfile b/build_calico_mesos/Dockerfile deleted file mode 100644 index 2152f52..0000000 --- a/build_calico_mesos/Dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2015 Metaswitch Networks -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM ubuntu:14.04 - -WORKDIR /code/ - -RUN apt-get update && \ - apt-get install -qy curl python-dev python-pip git libffi-dev libssl-dev - -# Install the python packages needed for running UTs and building calico_mesos. -# Git is installed to allow pip installation from a github repo and also so -# that the right branch can be included if uploading coverage. -# ADD requirements.txt /code/ -ADD ./ /code/ -RUN pip install -r requirements.txt - -# Can't run pyinstaller as root so add a user - https://github.com/pyinstaller/pyinstaller/issues/1081 -RUN useradd -d /home/user -m -s /bin/bash user -RUN chown -R user:user /code/ -USER user \ No newline at end of file diff --git a/build_calico_mesos/requirements.txt b/build_calico_mesos/requirements.txt deleted file mode 100644 index 056017c..0000000 --- a/build_calico_mesos/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -git+https://github.com/projectcalico/libcalico.git@v0.8.0 -PyInstaller==2.1 -nose==1.3.1 -nose-parameterized -mock==1.0.1 -coverage==3.7.1 diff --git a/circle.yml b/circle.yml index f793c99..d9fc089 100644 --- a/circle.yml +++ b/circle.yml @@ -5,22 +5,6 @@ machine: services: - docker -checkout: - post: - - git submodule sync - - git submodule update --init - - find . -exec touch -t 201401010000 {} \; - - for x in $(git ls-tree --full-tree --name-only -r HEAD); do touch -t $(date -d "$(git log -1 --format=%ci "${x}")" +%y%m%d%H%M.%S) "${x}"; done - -dependencies: - cache_directories: - - "~/docker" - override: - - mkdir -p ~/docker - - if [[ -e ~/docker/build.tar ]]; then docker load -i ~/docker/build.tar; fi - - make build_image - - docker save --output ~/docker/build.tar calico/mesos-builder - test: override: - make ut-circle