浏览代码

pulling official images from dockerhub (#3494)

* pulling official images from dockerhub

* nit

* [ci lang-only JavaScript]
Nate 7 年之前
父节点
当前提交
4472c049f6
共有 25 个文件被更改,包括 70 次插入170 次删除
  1. 1 1
      frameworks/JavaScript/express/express-mongodb.dockerfile
  2. 1 1
      frameworks/JavaScript/express/express-mysql.dockerfile
  3. 1 1
      frameworks/JavaScript/express/express.dockerfile
  4. 1 1
      frameworks/JavaScript/hapi/hapi-mysql.dockerfile
  5. 1 1
      frameworks/JavaScript/hapi/hapi-postgres.dockerfile
  6. 1 1
      frameworks/JavaScript/hapi/hapi.dockerfile
  7. 1 1
      frameworks/JavaScript/koa/koa-mysql.dockerfile
  8. 1 1
      frameworks/JavaScript/koa/koa-postgres.dockerfile
  9. 1 1
      frameworks/JavaScript/koa/koa.dockerfile
  10. 0 19
      frameworks/JavaScript/nodejs/app-mitol.js
  11. 0 43
      frameworks/JavaScript/nodejs/benchmark_config.json
  12. 0 33
      frameworks/JavaScript/nodejs/create-server-mitol.js
  13. 1 1
      frameworks/JavaScript/nodejs/mitol.dockerfile
  14. 0 5
      frameworks/JavaScript/nodejs/nodejs-default-mitol.dockerfile
  15. 0 5
      frameworks/JavaScript/nodejs/nodejs-mongodb-mitol.dockerfile
  16. 1 1
      frameworks/JavaScript/nodejs/nodejs-mongodb-raw.dockerfile
  17. 1 1
      frameworks/JavaScript/nodejs/nodejs-mongodb.dockerfile
  18. 1 1
      frameworks/JavaScript/nodejs/nodejs-mysql.dockerfile
  19. 1 1
      frameworks/JavaScript/nodejs/nodejs-postgres.dockerfile
  20. 1 1
      frameworks/JavaScript/nodejs/nodejs.dockerfile
  21. 1 1
      frameworks/JavaScript/sailsjs/sailsjs-postgres.dockerfile
  22. 1 1
      frameworks/JavaScript/sailsjs/sailsjs.dockerfile
  23. 0 6
      toolset/setup/docker/webservers/nodejs8.dockerfile
  24. 46 38
      toolset/travis/travis_diff.py
  25. 7 4
      toolset/utils/docker_helper.py

+ 1 - 1
frameworks/JavaScript/express/express-mongodb.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 1 - 1
frameworks/JavaScript/express/express-mysql.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 1 - 1
frameworks/JavaScript/express/express.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 1 - 1
frameworks/JavaScript/hapi/hapi-mysql.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 1 - 1
frameworks/JavaScript/hapi/hapi-postgres.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 1 - 1
frameworks/JavaScript/hapi/hapi.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 1 - 1
frameworks/JavaScript/koa/koa-mysql.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 1 - 1
frameworks/JavaScript/koa/koa-postgres.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 1 - 1
frameworks/JavaScript/koa/koa.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 0 - 19
frameworks/JavaScript/nodejs/app-mitol.js

@@ -1,19 +0,0 @@
-const cluster = require('cluster');
-const numCPUs = require('os').cpus().length;
-
-if (cluster.isMaster) {
-  // Fork workers.
-  for (let i = 0; i < numCPUs; i++) {
-    cluster.fork();
-  }
-
-  cluster.on('exit', (worker, code, signal) => {
-  	console.log([
-  	  'A process exit was triggered, most likely due to a failed database action',
-  	  'NodeJS test server shutting down now'].join('\n'));
-    process.exit(1);
-  });
-} else {
-  // Task for forked worker
-  require('./create-server-mitol');
-}

+ 0 - 43
frameworks/JavaScript/nodejs/benchmark_config.json

@@ -107,49 +107,6 @@
       "display_name": "nodejs",
       "notes": "",
       "versus": "nodejs"
-    },
-    "default-mitol": {
-      "json_url": "/json",
-      "plaintext_url": "/plaintext",
-      "db_url": "/db",
-      "query_url": "/queries?queries=",
-      "update_url": "/updates?queries=",
-      "fortune_url": "/fortunes",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Platform",
-      "database": "MySQL",
-      "framework": "None",
-      "language": "JavaScript",
-      "flavor": "NodeJS",
-      "orm": "Raw",
-      "platform": "nodejs",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "nodejs-mitol",
-      "notes": "",
-      "versus": "nodejs"
-    },
-    "mongodb-mitol": {
-      "db_url": "/db",
-      "query_url": "/queries?queries=",
-      "update_url": "/updates?queries=",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Platform",
-      "database": "MongoDB",
-      "framework": "None",
-      "language": "JavaScript",
-      "flavor": "NodeJS",
-      "orm": "Full",
-      "platform": "nodejs",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "nodejs-mitol",
-      "notes": "",
-      "versus": "nodejs"
     }
   }]
 }

+ 0 - 33
frameworks/JavaScript/nodejs/create-server-mitol.js

@@ -1,33 +0,0 @@
-// Forked workers will run this code when found to not be
-// the master of the cluster.
-
-const http = require('mns');
-const parseurl = require('parseurl'); // faster than native nodejs url package
-
-// Initialize routes & their handlers (once)
-const routing = require('./routing');
-const basicHandler = routing.BasicHandler;
-const queryHandler = routing.QueryHandler;
-const routeNotImplemented = require('./helper').responses.routeNotImplemented;
-
-module.exports = http.createServer(function (req, res) {
-  const url = parseurl(req);
-  const route = url.pathname;
-
-  // Routes that do no require a `queries` parameter
-  if (basicHandler.has(route)) {
-    return basicHandler.handle(route, req, res);
-  } else {
-    // naive: only works if there is one query param, as is the case in TFB
-    let queries = url.query && url.query.split('=')[1];
-    queries = ~~(queries) || 1;
-    queries = Math.min(Math.max(queries, 1), 500);
-
-    if (queryHandler.has(route)) {
-      return queryHandler.handle(route, queries, req, res);
-    } else {
-      return routeNotImplemented(req, res);
-    }
-  }
-
-}).listen(8080, () => console.log("NodeJS worker listening on port 8080"));

+ 1 - 1
frameworks/JavaScript/nodejs/mitol.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 0 - 5
frameworks/JavaScript/nodejs/nodejs-default-mitol.dockerfile

@@ -1,5 +0,0 @@
-FROM techempower/mitol:0.1
-
-ENV NODE_HANDLER mysql-raw
-
-CMD ["node", "app-mitol.js"]

+ 0 - 5
frameworks/JavaScript/nodejs/nodejs-mongodb-mitol.dockerfile

@@ -1,5 +0,0 @@
-FROM techempower/mitol:0.1
-
-ENV NODE_HANDLER mongoose
-
-CMD ["node", "app-mitol.js"]

+ 1 - 1
frameworks/JavaScript/nodejs/nodejs-mongodb-raw.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 1 - 1
frameworks/JavaScript/nodejs/nodejs-mongodb.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 1 - 1
frameworks/JavaScript/nodejs/nodejs-mysql.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 1 - 1
frameworks/JavaScript/nodejs/nodejs-postgres.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 1 - 1
frameworks/JavaScript/nodejs/nodejs.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 1 - 1
frameworks/JavaScript/sailsjs/sailsjs-postgres.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 1 - 1
frameworks/JavaScript/sailsjs/sailsjs.dockerfile

@@ -1,4 +1,4 @@
-FROM techempower/nodejs8:0.1
+FROM node:9.10.1
 
 COPY ./ ./
 

+ 0 - 6
toolset/setup/docker/webservers/nodejs8.dockerfile

@@ -1,6 +0,0 @@
-FROM techempower/base:0.1
-
-ENV NODE_ENV=production
-
-RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
-RUN apt install -y nodejs

+ 46 - 38
toolset/travis/travis_diff.py

@@ -2,15 +2,9 @@
 
 # @file:        toolset/travis/travis_diff.py
 # @author:      Nate Brady
-# @description: This script is only for use within Travis-CI. It is meant to look through the commit history
-#   and determine whether or not the current framework test directory needs to be run.
-#
-# Notes: This script will run in python 2 and 3. print is being used instead of the logging import because
-#   travis does not echo python logging during the before_script lifecycle.
-
-# TODO: Needs to be updated to look at the new Travis test possibilities
-#       of TEST, TESTDIR, and TESTLANG. IE. Only run a single framework test
-#       in TESTLANG if it's the only one that's changed
+# @description: This script is only for use within Travis-CI. It is meant to
+# look through the commit history and determine whether or not the current
+# framework test directory needs to be run.
 
 import subprocess
 import os
@@ -22,12 +16,14 @@ from sets import Set
 def get_docker_changes(changes_output):
     return list(
         Set(
-            re.findall(r"toolset/setup/docker/.+/(.+)\.dockerfile",
-                       changes_output, re.M)))
+            re.findall(r"toolset/setup/docker/.+/(.+)\.dockerfile", changes_output,
+                       re.M)))
 
 
 def fw_found_in_changes(test, changes_output):
-    return re.search(r"frameworks/" + test + "/", changes_output, re.M)
+    return re.search(
+        r"frameworks/" + test + "/",
+        changes_output, re.M)
 
 
 # Cleans up diffing and grep output and into an array of strings
@@ -49,7 +45,7 @@ print("TRAVIS_COMMIT      : {!s}".format(os.getenv("TRAVIS_COMMIT")))
 is_PR = (os.getenv("TRAVIS_PULL_REQUEST") != "false")
 commit_range = ""
 first_commit = ""
-last_commit = ""
+last_commit  = ""
 
 if is_PR:
     print('I am testing a pull request')
@@ -88,7 +84,7 @@ changes = clean_output(
         'git log --name-only --pretty="format:" {!s}'.format(commit_range)
     ]))
 print("Determining what to run based on the following file changes: \n{!s}"
-      .format(changes))
+    .format(changes))
 
 # COMMIT MESSAGES:
 # Before any complicated diffing, check for forced runs from the commit message
@@ -96,15 +92,16 @@ print("Determining what to run based on the following file changes: \n{!s}"
 last_commit_msg = subprocess.check_output(
     ["bash", "-c", "git log --format=%B -n 1 {!s}".format(last_commit)])
 print("Parsing commit message for travis commands: {!s}"
-      .format(last_commit_msg))
+    .format(last_commit_msg))
 
 test_dirs = []
 run_tests = []
 
 # Break the test env variable down into test directories
 if os.getenv("TESTLANG"):
-    test_dirs = map(lambda x: os.getenv("TESTLANG") + '/' + x,
-                    os.listdir("frameworks/" + os.getenv("TESTLANG")))
+    dir = "frameworks/" + os.getenv("TESTLANG") + "/"
+    test_dirs = map(lambda x: os.getenv("TESTLANG") + "/" + x,
+                    filter(lambda x: os.path.isdir(dir + x), os.listdir(dir)))
 elif os.getenv("TESTDIR"):
     test_dirs = os.getenv("TESTDIR").split(' ')
 
@@ -116,39 +113,50 @@ if re.search(r'\[ci run-all\]', last_commit_msg, re.M):
 
 # Forced *fw-only* specific tests
 if re.search(r'\[ci fw-only .+\]', last_commit_msg, re.M):
-    tests = re.findall(r'\[ci fw-only (.+)\]', last_commit_msg,
-                       re.M)[0].strip().split(' ')
+    tests = re.findall(r'\[ci fw-only (.+)\]', last_commit_msg, re.M)[0].strip().split(' ')
     for test in tests:
         if test in test_dirs:
-            print(
-                "{!s} has been forced to run from the commit message.".format(
-                    test))
+            print("{!s} has been forced to run from the commit message.".format(test))
             run_tests.append(test)
 
     # quit here because we're using "only"
     quit_diffing()
 
+# Forced *lang-only* specific tests
+if re.search(r'\[ci lang-only .+\]', last_commit_msg, re.M):
+    langs = re.findall(r'\[ci lang-only (.+)\]', last_commit_msg, re.M)[0].strip().split(' ')
+    for test in test_dirs:
+        for lang in langs:
+            if test.startswith(lang + "/"):
+                print("{!s} has been forced to run from the commit message.".format(test))
+                run_tests.append(test)
+
+    # quit here because we're using "only"
+    quit_diffing()
+
 # Forced framework run in addition to other tests
 if re.search(r'\[ci fw .+\]', last_commit_msg, re.M):
-    tests = re.findall(r'\[ci fw (.+)\]', last_commit_msg,
-                       re.M)[0].strip().split(' ')
+    tests = re.findall(r'\[ci fw (.+)\]', last_commit_msg, re.M)[0].strip().split(' ')
     for test in tests:
         if test in test_dirs:
-            print(
-                "{!s} has been forced to run from the commit message.".format(
-                    test))
+            print("{!s} has been forced to run from the commit message.".format(test))
             run_tests.append(test)
 
-# TODO: any changes in the toolset folder will generate a full run.
-#       Instead limit this to core toolset files and work on diffing
-#       docker dependencies
+# Forced lang run in addition to other running tests
+if re.search(r'\[ci lang .+\]', last_commit_msg, re.M):
+    langs = re.findall(r'\[ci lang (.+)\]', last_commit_msg, re.M)[0].strip().split(' ')
+    for test in test_dirs:
+        for lang in langs:
+            if test.startswith(lang + "/"):
+                print("{!s} has been forced to run from the commit message.".format(test))
+                run_tests.append(test)
+
+
 # Ignore travis and docker directory changes
 # Also for now, ignore the old linux setup folders, as we don't want to
 # trigger a full run as we remove old fw_depends scripts. [ci run-all] will
 # still work if it's needed.
-
-if re.search(r'^toolset/(?!(travis/|setup/|continuous/))', changes,
-             re.M) is not None:
+if re.search(r'^toolset/(?!(travis/|setup/|continuous/))', changes, re.M) is not None:
     print("Found changes to core toolset. Running all tests.")
     run_tests = test_dirs
     quit_diffing()
@@ -169,11 +177,11 @@ for test in test_dirs:
     found = False
     while i <= len(docker_changes) - 1 and not found:
 
-        # Generates output of files that contain a FROM import for this dependency
+        # Generates output of files that contain a FROM for this dependency
         more_changes = subprocess.check_output([
-            'bash', '-c',
-            'grep -RP "FROM tfb/' + re.escape(docker_changes[i].replace(
-                '.dockerfile', '')) + '(:|$)" . || echo ""'
+            'bash', '-c', 'grep -RP "FROM tfb/' +
+                          re.escape(docker_changes[i].replace('.dockerfile', ''))
+                          + '(:|$)" . || echo ""'
         ])
         print("more_changes: {!s}".format(more_changes))
         if fw_found_in_changes(test, more_changes):
@@ -186,4 +194,4 @@ for test in test_dirs:
             Set(get_docker_changes(more_changes)) - Set(docker_changes))
         i += 1
 
-quit_diffing()
+quit_diffing()

+ 7 - 4
toolset/utils/docker_helper.py

@@ -468,7 +468,7 @@ def __gather_dependencies(docker_file):
                 tokens = line.strip().split(' ')
                 if tokens[0] == "FROM":
                     # This is magic that our base image points to
-                    if tokens[1] != "ubuntu:16.04":
+                    if tokens[1].startswith('techempower/'):
                         dep_ref = tokens[1].strip().split(':')[0].strip()
                         if '/' not in dep_ref:
                             raise AttributeError(
@@ -509,8 +509,8 @@ def __build_dependencies(benchmarker_config,
             log_prefix = dep + ": "
             pulled = False
 
-            # Do not pull images if we are building specifically
-            if not benchmarker_config.build:
+            # Do not pull techempower/ images if we are building specifically
+            if not benchmarker_config.build and 'techempower/' not in dep:
                 client = docker.DockerClient(
                     base_url=benchmarker_config.server_docker_host)
                 try:
@@ -529,7 +529,10 @@ def __build_dependencies(benchmarker_config,
                         log("Found published image; skipping build",
                             prefix=log_prefix)
                     except:
-                        pass
+                        log("Docker pull failed; %s could not be found; terminating" % dep,
+                            prefix=log_prefix,
+                            color=Fore.RED)
+                        return 1
 
             if not pulled:
                 dep_ref = dep.strip().split(':')[0].strip()