Bug 1290531 - Invoke docker from Python, remove build.sh; r?dustin draft
authorGregory Szorc <gps@mozilla.com>
Fri, 29 Jul 2016 13:22:06 -0700
changeset 395038 498f549d7e7034d6307ac456309e8e837840e358
parent 395037 b11e5bcdf6a23116d5aad179a30ebfe738b8b37c
child 395039 64918948a9593c0eae09aca37c163ea87ab53f56
push id24705
push userbmo:gps@mozilla.com
push dateMon, 01 Aug 2016 18:26:57 +0000
reviewersdustin
bugs1290531
milestone50.0a1
Bug 1290531 - Invoke docker from Python, remove build.sh; r?dustin build.sh had been reduced to invoking `docker`. We move that invocation to Python and remove build.sh. Long live build.sh! MozReview-Commit-ID: FQBDJv4HSaU
taskcluster/taskgraph/docker.py
testing/docker/build.sh
--- a/taskcluster/taskgraph/docker.py
+++ b/taskcluster/taskgraph/docker.py
@@ -83,20 +83,30 @@ def build_image(name):
 
     # Verify that Docker is working.
     try:
         subprocess.check_output([docker_bin, '--version'])
     except subprocess.CalledProcessError:
         raise Exception('Docker server is unresponsive. Run `docker ps` and '
                         'check that Docker is running')
 
-    args = [os.path.join(IMAGE_DIR, 'build.sh'), name, tag]
+    args = [
+        docker_bin,
+        'build',
+        # Use --no-cache so we always get the latest package updates.
+        '--no-cache',
+        '-t', tag,
+        name,
+    ]
+
     res = subprocess.call(args, cwd=IMAGE_DIR)
     if res:
         raise Exception('error building image')
 
+    print('Successfully built %s and tagged with %s' % (name, tag))
+
     if tag.endswith(':latest'):
         print('*' * 50)
         print('WARNING: no VERSION file found in image directory.')
         print('Image is not suitable for deploying/pushing.')
         print('Create an image suitable for deploying/pushing by creating')
         print('a VERSION file in the image directory.')
         print('*' * 50)
deleted file mode 100755
--- a/testing/docker/build.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#! /bin/bash -e
-
-# This file is a wrapper around docker build with specific concerns around image
-# versions and registry deployment... It also attempts to detect any potential
-# missing dependencies and warns you about them.
-
-gecko_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
-
-build() {
-  local image_name=$1
-  local tag=$2
-  local folder="$gecko_root/testing/docker/$image_name"
-
-  # use --no-cache so that we always get the latest updates from yum
-  # and use the latest version of system-setup.sh
-  ( cd $folder/.. && docker build --no-cache -t $tag $image_name ) || exit 1
-
-  echo "Success built $image_name and tagged with $tag"
-}
-
-build $*