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
--- 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 $*