aboutsummaryrefslogtreecommitdiff
path: root/kolla
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-01-19 09:51:47 +0000
committerGerrit Code Review <review@openstack.org>2016-01-19 09:51:47 +0000
commit11cdd5b8eafc880310bc2353b88eb716f0398314 (patch)
tree8627faacc3da35b1bee8c0562cdbbda1984b2c17 /kolla
parent5bce0212b2e95ea668c5616ffe08a5febbb1b3fc (diff)
parent7093d37f1825182366939cf64faa477040d29aa2 (diff)
downloadkolla-11cdd5b8eafc880310bc2353b88eb716f0398314.tar.gz
kolla-11cdd5b8eafc880310bc2353b88eb716f0398314.zip
Merge "Expose the docker build_arg to build.py"
Diffstat (limited to 'kolla')
-rwxr-xr-xkolla/cmd/build.py3
-rw-r--r--kolla/common/config.py2
-rw-r--r--kolla/tests/test_build.py20
3 files changed, 23 insertions, 2 deletions
diff --git a/kolla/cmd/build.py b/kolla/cmd/build.py
index e7c54a435..aff472d83 100755
--- a/kolla/cmd/build.py
+++ b/kolla/cmd/build.py
@@ -261,7 +261,8 @@ class WorkerThread(Thread):
nocache=self.nocache,
rm=True,
pull=pull,
- forcerm=self.forcerm):
+ forcerm=self.forcerm,
+ buildargs=self.conf.build_args):
stream = json.loads(response.decode('utf-8'))
if 'stream' in stream:
diff --git a/kolla/common/config.py b/kolla/common/config.py
index 30da779c8..2d0bdef4d 100644
--- a/kolla/common/config.py
+++ b/kolla/common/config.py
@@ -63,6 +63,8 @@ _CLI_OPTS = [
cfg.BoolOpt('debug', short='d', default=False,
deprecated_group='kolla-build',
help='Turn on debugging log level'),
+ cfg.DictOpt('build-args',
+ help='Set docker build time variables'),
cfg.StrOpt('include-header', short='i',
deprecated_group='kolla-build',
help=('Path to custom file to be added at '
diff --git a/kolla/tests/test_build.py b/kolla/tests/test_build.py
index 380e46021..afc2e7546 100644
--- a/kolla/tests/test_build.py
+++ b/kolla/tests/test_build.py
@@ -45,4 +45,22 @@ class WorkerThreadTest(base.TestCase):
mock_client().build.assert_called_once_with(
path=FAKE_IMAGE['path'], tag=FAKE_IMAGE['fullname'],
- nocache=False, rm=True, pull=True, forcerm=True)
+ nocache=False, rm=True, pull=True, forcerm=True,
+ buildargs=None)
+
+ @mock.patch('docker.Client')
+ def test_build_image_with_build_arg(self, mock_client):
+ build_args = {
+ 'HTTP_PROXY': 'http://localhost:8080',
+ 'NO_PROXY': '127.0.0.1'
+ }
+ self.conf.set_override('build_args', build_args)
+ worker = build.WorkerThread(mock.Mock(),
+ mock.Mock(),
+ self.conf)
+ worker.builder(FAKE_IMAGE)
+
+ mock_client().build.assert_called_once_with(
+ path=FAKE_IMAGE['path'], tag=FAKE_IMAGE['fullname'],
+ nocache=False, rm=True, pull=True, forcerm=True,
+ buildargs=build_args)