Bug 1290531 - Remove tester-device Docker image; r?dustin draft
authorGregory Szorc <gps@mozilla.com>
Fri, 29 Jul 2016 13:17:16 -0700
changeset 395036 77a2afa9021e7d609d353f5801baacca4e0980b6
parent 395035 79f38d98e9e731d66cd40448e340c8b7a3823912
child 395037 b11e5bcdf6a23116d5aad179a30ebfe738b8b37c
push id24705
push userbmo:gps@mozilla.com
push dateMon, 01 Aug 2016 18:26:57 +0000
reviewersdustin
bugs1290531
milestone50.0a1
Bug 1290531 - Remove tester-device Docker image; r?dustin There are no references to tester-device in tree or in the gaia repo. Since it appears to be unused, remove it. According to garndt, this was used for testing in the remote device lab, which he things is no longer happening. The reason I found this is because it is the only thing using a custom "build.sh" to create Docker images. I'm rewriting the Docker image building functionality and tester-device is a one-off interfering with that work. Making it go away is the easiest way to unblock me. MozReview-Commit-ID: 4veem4uIXXi
testing/docker/tester-device/Dockerfile
testing/docker/tester-device/REGISTRY
testing/docker/tester-device/VERSION
testing/docker/tester-device/bin/entrypoint
testing/docker/tester-device/bin/validate_task.py
testing/docker/tester-device/build.sh
testing/docker/tester-device/tests/invalid_base_repo.yml
testing/docker/tester-device/tests/invalid_build.yml
testing/docker/tester-device/tests/invalid_head_repo.yml
testing/docker/tester-device/tests/public.yml
testing/docker/tester-device/tests/test_validation.py
testing/docker/tester-device/tests/valid.yml
deleted file mode 100644
--- a/testing/docker/tester-device/Dockerfile
+++ /dev/null
@@ -1,48 +0,0 @@
-FROM        ubuntu:14.04
-MAINTAINER  Greg Arndt <garndt@mozilla.com>
-
-RUN mkdir -p /home/worker/upload/logs
-
-WORKDIR /home/worker
-
-RUN apt-get install -y curl
-
-# Add PPA for latest nodejs versions. Do not need to run apt-get update after this
-# as the script already does it.
-RUN curl -sL https://deb.nodesource.com/setup | sudo bash -
-
-RUN apt-get upgrade -y && apt-get install -y \
-  build-essential \
-  ca-certificates \
-  nodejs \
-  python-dev \
-  mercurial \
-  git \
-  android-tools-adb \
-  android-tools-fastboot\
-  jq
-
-# Get pip and virtualenv
-RUN curl https://bootstrap.pypa.io/get-pip.py | python
-RUN pip install virtualenv
-
-RUN git config --global user.email "mozilla@example.com" && \
-    git config --global user.name "mozilla"
-
-
-# Get node packages
-RUN npm install -g taskcluster-vcs@2.3.12
-
-WORKDIR /home/worker
-
-ADD bin /home/worker/bin
-ADD data /home/worker/data
-ADD https://raw.githubusercontent.com/taskcluster/buildbot-step/master/buildbot_step /home/worker/bin/buildbot_step
-RUN chmod u+x /home/worker/bin/*
-
-ENV HOME /home/worker
-ENV SHELL /bin/bash
-ENV PATH $PATH:/home/worker/bin
-ENV CLOUD_HOST testdroid
-
-ENTRYPOINT ["entrypoint"]
deleted file mode 100644
--- a/testing/docker/tester-device/REGISTRY
+++ /dev/null
@@ -1,1 +0,0 @@
-taskclusterprivate
deleted file mode 100644
--- a/testing/docker/tester-device/VERSION
+++ /dev/null
@@ -1,1 +0,0 @@
-0.0.9
deleted file mode 100755
--- a/testing/docker/tester-device/bin/entrypoint
+++ /dev/null
@@ -1,43 +0,0 @@
-#! /bin/bash -e
-
-echo "Validating Task"
-python /home/worker/bin/validate_task.py
-
-echo "Retrieving device"
-res=`curl --request POST -H "Content-Type: application/json" -d "$DEVICE_CAPABILITIES" http://$CLOUD_HOST/device`
-error=`echo $res | jq .error`
-
-if [ "$error" != "null" ]; then
-    echo "[taskcluster:error] $error"
-    exit -1
-fi
-
-status=`echo $res | jq .session`
-
-if [ "$status" == "null" ]; then
-    echo "Session could not be created with a device."
-    exit -1
-fi
-
-export SESSION_ID=`echo $res | jq .session.id`
-export SERIAL_ID=`echo $res | jq -r .proxies.adb.serialId`
-export ADB_HOST=`echo $res | jq .proxies.adb.forwardHost`
-export ADB_PORT=`echo $res | jq .proxies.adb.port`
-export MARIONETTE_HOST=`echo $res | jq .proxies.marionette.forwardHost`
-export MARIONETTE_PORT=`echo $res | jq .proxies.marionette.port`
-export PROXY_HOST=`echo $res | jq -r .proxyHost`
-echo "Retrieved device.  Session: $SESSION_ID"
-
-curl -o /home/worker/data/device.json -s -H "Accept: application/json" http://$CLOUD_HOST/device/properties
-
-buildbot_step 'Clone gaia' tc-vcs checkout /home/worker/gaia/source $GAIA_BASE_REPOSITORY $GAIA_HEAD_REPOSITORY $GAIA_REV $GAIA_REF
-
-cd gaia/source/tests/python/gaia-ui-tests/
-python setup.py develop
-pip install -Ur gaiatest/tests/requirements.txt
-cd /home/worker/
-
-buildbot_step 'Running tests' eval $@
-
-echo "Releasing device."
-curl --request POST http://$CLOUD_HOST/device/release
deleted file mode 100644
--- a/testing/docker/tester-device/bin/validate_task.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/env python
-
-from __future__ import print_function
-import os
-import os.path
-import json
-import urllib2
-import sys
-import re
-import subprocess
-
-repo_matcher = re.compile(r'[a-z]+://(hg|git)\.mozilla\.org')
-image_matcher = re.compile(r'^https:\/\/queue\.taskcluster\.net\/v1\/task\/.+\/artifacts\/private\/build\/flame-kk\.zip$')
-
-def get_task(taskid):
-    return json.load(urllib2.urlopen('https://queue.taskcluster.net/v1/task/' + taskid))
-
-def check_task(task):
-    payload = task['payload']
-
-    if 'phone' not in payload.get('capabilities', {}).get('devices', {}):
-        print('Device capalities are required.', file=sys.stderr)
-        return -1
-
-    capabilities = payload['capabilities']['devices']['phone']
-
-    if 'build' not in capabilities:
-        print('Build image url is required', file=sys.stderr)
-        return -1
-
-    image = capabilities['build']
-
-    if not image_matcher.match(image):
-        print('Invalid image url', file=sys.stderr)
-        return -1
-
-    if 'GAIA_HEAD_REPOSITORY' not in payload['env']:
-        print('Task has no head gaia repository', file=sys.stderr)
-        return -1
-
-    repo = payload['env']['GAIA_HEAD_REPOSITORY']
-    # if it is not a mozilla repository, fail
-    if not repo_matcher.match(repo):
-        print('Invalid head repository', repo, file=sys.stderr)
-        return -1
-
-    if 'GAIA_BASE_REPOSITORY' not in payload['env']:
-        print('Task has no base gaia repository', file=sys.stderr)
-        return -1
-
-    repo = payload['env']['GAIA_BASE_REPOSITORY']
-    if not repo_matcher.match(repo):
-        print('Invalid base repository', repo, file=sys.stderr)
-        return -1
-
-    if 'artifacts' in payload:
-        artifacts = payload['artifacts']
-        # If any of the artifacts makes reference to 'public',
-        # abort the task
-        if any(map(lambda a: 'public' in a, artifacts)):
-            print('Cannot upload to public', file=sys.stderr)
-            return -1
-
-    return 0
-
-def main():
-    taskid = os.getenv('TASK_ID')
-
-    # If the task id is None, we assume we are running docker locally
-    if taskid is not None:
-        task = get_task(taskid)
-        sys.exit(check_task(task))
-
-if __name__ == '__main__':
-    main()
deleted file mode 100755
--- a/testing/docker/tester-device/build.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#! /bin/bash -ve
-
-while getopts "t:g:" arg; do
-  case $arg in
-    t)
-      TAG=$OPTARG
-      ;;
-    g)
-      GAIA_TESTVARS=$OPTARG
-      ;;
-  esac
-done
-
-pushd $(dirname $0)
-
-test $TAG
-test -f "$GAIA_TESTVARS"
-
-mkdir -p data
-cp $GAIA_TESTVARS data/gaia_testvars.json
-
-docker build -t $TAG .
-rm -f data/gaia_testvars.json
deleted file mode 100644
--- a/testing/docker/tester-device/tests/invalid_base_repo.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-taskId: 1
-task:
-  metadata:
-    name: '[TC] Gaia Python Integration Tests - device'
-    description: Gaia Python Integration Tests
-  workerType: testdroid-device
-  retries: 0
-
-  payload:
-    env:
-      DEVICE_CAPABILITIES: '{"type":"flame","memory":"319","sims": "1","build":"https://queue.taskcluster.net/v1/task/H0FPqxakT06Eg4wo4zPwMw/runs/0/artifacts/private/build/flame-kk.zip"}'
-      GAIA_HEAD_REPOSITORY: 'http://hg.mozilla.org/integration/gaia-central'
-      GAIA_BASE_REPOSITORY: 'http://github.com/mozilla-b2g/gaia'
-    command:
-      - entrypoint
-      - >
-        tc-vcs checkout /home/worker/gaia/source $GAIA_BASE_REPOSITORY $GAIA_HEAD_REPOSITORY $GAIA_REV $GAIA_REF &&
-        cd gaia/source/tests/python/gaia-ui-tests/ &&
-        python setup.py develop &&
-        pip install py &&
-        cd /home/worker/ &&
-        gaiatest --testvars=/home/worker/data/testdroid.json --testvars=/home/worker/data/acknowledge_risks.json --testvars=/home/worker/data/common.json --testvars=/home/worker/data/device.json --adb-host=$PROXY_HOST --adb-port=$ADB_PORT --address=$PROXY_HOST:$MARIONETTE_PORT --device $SERIAL_ID --xml-output=/home/worker/upload/logs/xml_output.xml --timeout=10000 --log-html=/home/worker/upload/logs/index.html --restart --type=b2g+sanity-dsds --log-mach=-  --log-raw=/home/worker/upload/logs/raw.log gaia/source/tests/python/gaia-ui-tests/gaiatest/tests/functional/manifest.ini
-    artifacts:
-      'private/device.json':
-        type: file
-        path: '/home/worker/data/device.json'
-      'private/logs':
-        type: directory
-        path: '/home/worker/upload/logs/'
deleted file mode 100644
--- a/testing/docker/tester-device/tests/invalid_build.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-taskId: 1
-task:
-  metadata:
-    name: '[TC] Gaia Python Integration Tests - device'
-    description: Gaia Python Integration Tests
-  workerType: testdroid-device
-  retries: 0
-
-  payload:
-    env:
-      DEVICE_CAPABILITIES: "{\"type\":\"flame\",\"memory\":\"319\",\"sims\": \"1\",\"build\":\"https://queue.some_other_domain.net/v1/task/fLOiHaudRkepg9yEiaM1Mg/artifacts/private/build/flame-kk.zip\"}"
-      GAIA_HEAD_REPOSITORY: 'http://hg.mozilla.org/integration/gaia-central'
-      GAIA_BASE_REPOSITORY: 'http://hg.mozilla.org/integration/gaia-central'
-    command:
-      - entrypoint
-      - >
-        tc-vcs checkout /home/worker/gaia/source $GAIA_BASE_REPOSITORY $GAIA_HEAD_REPOSITORY $GAIA_REV $GAIA_REF &&
-        cd gaia/source/tests/python/gaia-ui-tests/ &&
-        python setup.py develop &&
-        pip install py &&
-        cd /home/worker/ &&
-        gaiatest --testvars=/home/worker/data/testdroid.json --testvars=/home/worker/data/acknowledge_risks.json --testvars=/home/worker/data/common.json --testvars=/home/worker/data/device.json --adb-host=$PROXY_HOST --adb-port=$ADB_PORT --address=$PROXY_HOST:$MARIONETTE_PORT --device $SERIAL_ID --xml-output=/home/worker/upload/logs/xml_output.xml --timeout=10000 --log-html=/home/worker/upload/logs/index.html --restart --type=b2g+sanity-dsds --log-mach=-  --log-raw=/home/worker/upload/logs/raw.log gaia/source/tests/python/gaia-ui-tests/gaiatest/tests/functional/manifest.ini
-    artifacts:
-      'private/device.json':
-        type: file
-        path: '/home/worker/data/device.json'
-      'private/logs':
-        type: directory
-        path: '/home/worker/upload/logs/'
deleted file mode 100644
--- a/testing/docker/tester-device/tests/invalid_head_repo.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-taskId: 1
-task:
-  metadata:
-    name: '[TC] Gaia Python Integration Tests - device'
-    description: Gaia Python Integration Tests
-  workerType: testdroid-device
-  retries: 0
-
-  payload:
-    env:
-      DEVICE_CAPABILITIES: '{"type":"flame","memory":"319","sims": "1","build":"https://queue.taskcluster.net/v1/task/H0FPqxakT06Eg4wo4zPwMw/runs/0/artifacts/private/build/flame-kk.zip"}'
-      GAIA_BASE_REPOSITORY: 'http://hg.mozilla.org/integration/gaia-central'
-      GAIA_HEAD_REPOSITORY: 'http://github.com/mozilla-b2g/gaia'
-    command:
-      - entrypoint
-      - >
-        tc-vcs checkout /home/worker/gaia/source $GAIA_BASE_REPOSITORY $GAIA_HEAD_REPOSITORY $GAIA_REV $GAIA_REF &&
-        cd gaia/source/tests/python/gaia-ui-tests/ &&
-        python setup.py develop &&
-        pip install py &&
-        cd /home/worker/ &&
-        gaiatest --testvars=/home/worker/data/testdroid.json --testvars=/home/worker/data/acknowledge_risks.json --testvars=/home/worker/data/common.json --testvars=/home/worker/data/device.json --adb-host=$PROXY_HOST --adb-port=$ADB_PORT --address=$PROXY_HOST:$MARIONETTE_PORT --device $SERIAL_ID --xml-output=/home/worker/upload/logs/xml_output.xml --timeout=10000 --log-html=/home/worker/upload/logs/index.html --restart --type=b2g+sanity-dsds --log-mach=-  --log-raw=/home/worker/upload/logs/raw.log gaia/source/tests/python/gaia-ui-tests/gaiatest/tests/functional/manifest.ini
-    artifacts:
-      'private/device.json':
-        type: file
-        path: '/home/worker/data/device.json'
-      'private/logs':
-        type: directory
-        path: '/home/worker/upload/logs/'
deleted file mode 100644
--- a/testing/docker/tester-device/tests/public.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-taskId: 1
-task:
-  metadata:
-    name: '[TC] Gaia Python Integration Tests - device'
-    description: Gaia Python Integration Tests
-  workerType: testdroid-device
-  retries: 0
-
-  payload:
-    env:
-      DEVICE_CAPABILITIES: '{"type":"flame","memory":"319","sims": "1","build":"https://queue.taskcluster.net/v1/task/H0FPqxakT06Eg4wo4zPwMw/runs/0/artifacts/private/build/flame-kk.zip"}'
-      GAIA_BASE_REPOSITORY: 'http://hg.mozilla.org/integration/gaia-central'
-      GAIA_HEAD_REPOSITORY: 'http://github.com/mozilla-b2g/gaia'
-    command:
-      - entrypoint
-      - >
-        tc-vcs checkout /home/worker/gaia/source $GAIA_BASE_REPOSITORY $GAIA_HEAD_REPOSITORY $GAIA_REV $GAIA_REF &&
-        cd gaia/source/tests/python/gaia-ui-tests/ &&
-        python setup.py develop &&
-        pip install py &&
-        cd /home/worker/ &&
-        gaiatest --testvars=/home/worker/data/testdroid.json --testvars=/home/worker/data/acknowledge_risks.json --testvars=/home/worker/data/common.json --testvars=/home/worker/data/device.json --adb-host=$PROXY_HOST --adb-port=$ADB_PORT --address=$PROXY_HOST:$MARIONETTE_PORT --device $SERIAL_ID --xml-output=/home/worker/upload/logs/xml_output.xml --timeout=10000 --log-html=/home/worker/upload/logs/index.html --restart --type=b2g+sanity-dsds --log-mach=-  --log-raw=/home/worker/upload/logs/raw.log gaia/source/tests/python/gaia-ui-tests/gaiatest/tests/functional/manifest.ini
-    artifacts:
-      'public/device.json':
-        type: file
-        path: '/home/worker/data/device.json'
-      'private/logs':
-        type: directory
-        path: '/home/worker/upload/logs/'
deleted file mode 100755
--- a/testing/docker/tester-device/tests/test_validation.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env python
-
-import unittest
-import sys
-import yaml
-sys.path.append('../bin')
-from validate_task import check_task
-
-def load_task(task_file):
-    content = open(task_file, 'r')
-    return yaml.load(content)['task']
-
-class TaskValidationTest(unittest.TestCase):
-    def test_valid_task(self):
-        task = load_task('valid.yml')
-        self.assertEquals(check_task(task), 0)
-
-    def test_invalid_base_repo(self):
-        task = load_task('invalid_base_repo.yml')
-        self.assertEquals(check_task(task), -1)
-
-    def test_invalid_head_repo(self):
-        task = load_task('invalid_head_repo.yml')
-        self.assertEquals(check_task(task), -1)
-
-    def test_public_artifact(self):
-        task = load_task('public.yml')
-        self.assertEquals(check_task(task), -1)
-
-    def test_invalid_build(self):
-        task = load_task('invalid_build.yml')
-        self.assertEquals(check_task(task), -1)
-
-if __name__ == '__main__':
-    unittest.main()
deleted file mode 100644
--- a/testing/docker/tester-device/tests/valid.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-taskId: 1
-task:
-  metadata:
-    name: '[TC] Gaia Python Integration Tests - device'
-    description: Gaia Python Integration Tests
-  workerType: testdroid-device
-  retries: 0
-
-  payload:
-    env:
-      DEVICE_CAPABILITIES: "{\"type\":\"flame\",\"memory\":\"319\",\"sims\": \"1\",\"build\":\"https://queue.taskcluster.net/v1/task/fLOiHaudRkepg9yEiaM1Mg/artifacts/private/build/flame-kk.zip\"}"
-      GAIA_HEAD_REPOSITORY: 'http://hg.mozilla.org/integration/gaia-central'
-      GAIA_BASE_REPOSITORY: 'http://hg.mozilla.org/integration/gaia-central'
-    command:
-      - entrypoint
-      - >
-        tc-vcs checkout /home/worker/gaia/source $GAIA_BASE_REPOSITORY $GAIA_HEAD_REPOSITORY $GAIA_REV $GAIA_REF &&
-        cd gaia/source/tests/python/gaia-ui-tests/ &&
-        python setup.py develop &&
-        pip install py &&
-        cd /home/worker/ &&
-        gaiatest --testvars=/home/worker/data/testdroid.json --testvars=/home/worker/data/acknowledge_risks.json --testvars=/home/worker/data/common.json --testvars=/home/worker/data/device.json --adb-host=$PROXY_HOST --adb-port=$ADB_PORT --address=$PROXY_HOST:$MARIONETTE_PORT --device $SERIAL_ID --xml-output=/home/worker/upload/logs/xml_output.xml --timeout=10000 --log-html=/home/worker/upload/logs/index.html --restart --type=b2g+sanity-dsds --log-mach=-  --log-raw=/home/worker/upload/logs/raw.log gaia/source/tests/python/gaia-ui-tests/gaiatest/tests/functional/manifest.ini
-    artifacts:
-      'private/device.json':
-        type: file
-        path: '/home/worker/data/device.json'
-      'private/logs':
-        type: directory
-        path: '/home/worker/upload/logs/'