summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClark Laughlin <clark.laughlin@linaro.org>2015-05-26 13:07:26 -0400
committerClark Laughlin <clark.laughlin@linaro.org>2015-05-26 13:07:26 -0400
commit270c3702796b36bb09c31fd980e17adfa291994b (patch)
treed33bb9f169630ef8bd7036f5c0e24f8da3abaaba
parentbca16d98896e5ac32f70b5edce98ab3630f2e7ec (diff)
enable run as Docker container
-rw-r--r--tempest-pull/Dockerfile26
-rw-r--r--tempest-pull/app/app.py7
-rwxr-xr-xtempest-pull/docker-build-image3
-rwxr-xr-xtempest-pull/docker-run-container16
4 files changed, 52 insertions, 0 deletions
diff --git a/tempest-pull/Dockerfile b/tempest-pull/Dockerfile
new file mode 100644
index 0000000..9bc3cd9
--- /dev/null
+++ b/tempest-pull/Dockerfile
@@ -0,0 +1,26 @@
+FROM ubuntu:14.04
+RUN apt-get update
+RUN apt-get install -y subunit python python-dev python-pip
+
+RUN mkdir /opt/tempest-pull
+
+VOLUME /srv/data/bundle-receipts
+VOLUME /srv/data/logs
+
+# Get dependencies
+RUN pip install py2neo
+
+# Copy the local package files to the container's workspace.
+ADD . /opt/tempest-pull
+
+WORKDIR /opt/tempest-pull
+
+# These need to be set here to override any default config that might be specified
+# in config.py that isn't what we need it to be when running in a linked Docker
+# container
+ENV NEO4J_ENDPOINT http://neo4j:7474/db/data/
+ENV BUNDLES_ROOT /srv/data/bundle-receipts/
+ENV LOGS_ROOT /srv/data/logs/
+
+# Run this command by default when the container starts.
+ENTRYPOINT python -c "import config; from app import app; app.run(config.config, False)"
diff --git a/tempest-pull/app/app.py b/tempest-pull/app/app.py
index 19ce855..ed455ed 100644
--- a/tempest-pull/app/app.py
+++ b/tempest-pull/app/app.py
@@ -11,6 +11,13 @@ def run(config, print_config):
if print_config:
print config
+ # allow overriding the contents of config with values from the environment
+ for s in [ "BUNDLE_STREAM_NAME", "BUNDLES_ROOT", "LOGS_ROOT", "LAVA_XMLRPC_ENDPOINT", "NEO4J_ENDPOINT" ]:
+ if s in os.environ:
+ new_val = os.environ.get(s)
+ print "overriding config [%s] from environment: '%s'" % (s, new_val)
+ config[s] = new_val
+
lava = LAVADashboard(config["LAVA_XMLRPC_ENDPOINT"], config["BUNDLE_STREAM_NAME"])
lava.connect()
diff --git a/tempest-pull/docker-build-image b/tempest-pull/docker-build-image
new file mode 100755
index 0000000..67abb28
--- /dev/null
+++ b/tempest-pull/docker-build-image
@@ -0,0 +1,3 @@
+#!/bin/bash
+docker build -t tempest-pull .
+
diff --git a/tempest-pull/docker-run-container b/tempest-pull/docker-run-container
new file mode 100755
index 0000000..83444d8
--- /dev/null
+++ b/tempest-pull/docker-run-container
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# this is the URL of the LAVA instance to retrieve from
+LAVA_XMLRPC_ENDPOINT="https://openstack.validation.linaro.org/RPC2"
+
+# this is the name of the bundle stream to retrieve from
+BUNDLE_STREAM_NAME="/public/team/openstack/tempest-ci/"
+
+docker run --name tempest-pull \
+ -e LAVA_XMLRPC_ENDPOINT=${LAVA_XMLRPC_ENDPOINT} \
+ -e BUNDLE_STREAM_NAME=${BUNDLE_STREAM_NAME} \
+ -v /srv/ci-reporting/bundle-receipts:/srv/data/bundle-receipts \
+ -v /srv/ci-reporting/logs:/srv/data/logs \
+ --link neo4j:neo4j \
+ --rm=true \
+ tempest-pull