Bug 1290531 - Invoke docker from Python, remove build.sh; r=dustin
authorGregory Szorc <gps@mozilla.com>
Fri, 29 Jul 2016 13:22:06 -0700
changeset 307535 4ec50d432877c8dc9cfdd9b8192a125533ae7e64
parent 307534 9b290fa0e180d016c95441b880c64e07c424e7ab
child 307536 d61de5431643721093c23fc70f3a52c62fd3f626
push id30969
push usergszorc@mozilla.com
push dateMon, 01 Aug 2016 18:28:55 +0000
treeherderautoland@ed95bb78b383 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdustin
bugs1290531
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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 $*