aboutsummaryrefslogtreecommitdiffstats
path: root/mcp/patches/docker/0001-tasks.py-Allow-passing-extra-build-arg.patch
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2018-11-21 16:57:10 +0100
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>2018-11-21 18:14:15 +0100
commitf03a33bc58135acc7e4420efaaf34c26a32d6142 (patch)
tree8c302374639934a4d842bc79f9b8ebf4e6d957db /mcp/patches/docker/0001-tasks.py-Allow-passing-extra-build-arg.patch
parent3fef67294b7e2b880217e2e1e0cafee6e4d6e9bc (diff)
[docker] build: Allow cache invalidation
While at it, fix emoji issues with latest virtualenv [1]. JIRA: FUEL-398 [1] https://github.com/pypa/pipenv/issues/3223 Change-Id: Ice5937222bf75c1ddadc6b9f1994635bc10faf57 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Diffstat (limited to 'mcp/patches/docker/0001-tasks.py-Allow-passing-extra-build-arg.patch')
-rw-r--r--mcp/patches/docker/0001-tasks.py-Allow-passing-extra-build-arg.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/mcp/patches/docker/0001-tasks.py-Allow-passing-extra-build-arg.patch b/mcp/patches/docker/0001-tasks.py-Allow-passing-extra-build-arg.patch
new file mode 100644
index 000000000..cf1c57d31
--- /dev/null
+++ b/mcp/patches/docker/0001-tasks.py-Allow-passing-extra-build-arg.patch
@@ -0,0 +1,59 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2018 Mirantis Inc., Enea AB and others.
+:
+: All rights reserved. This program and the accompanying materials
+: are made available under the terms of the Apache License, Version 2.0
+: which accompanies this distribution, and is available at
+: http://www.apache.org/licenses/LICENSE-2.0
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Sun, 9 Sep 2018 23:18:39 +0200
+Subject: [PATCH] tasks.py: Allow passing extra --build-arg
+
+E.g. A, B with values "a", respectively "b c":
+$ invoke build saltmaster-reclass --build-arg-extra='A="a" B="b c"'
+will be passed down as:
+--build-arg A="a" --build-arg B="b c"
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ tasks.py | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/tasks.py b/tasks.py
+index d6bf3bc..59e217d 100644
+--- a/tasks.py
++++ b/tasks.py
+@@ -3,6 +3,7 @@
+
+
+ from invoke import Collection, task
++from shlex import split
+ from string import Template
+ import re
+ import ast
+@@ -25,7 +26,7 @@ def all(ctx, dry=False, push=False, dry_targets=False, filter=None, **kwargs):
+ dry=dry, push=push, dry_targets=dry_targets, filter=filter, **kwargs)
+
+ @task
+-def build(ctx, target, require=[], dist='debian', dist_rel='stretch', salt=None, formula_rev=None, push=False, dry=False, dry_targets=False, **kwargs):
++def build(ctx, target, require=[], dist='debian', dist_rel='stretch', salt=None, formula_rev=None, push=False, dry=False, dry_targets=False, build_arg_extra='', **kwargs):
+
+ kwargs['dist'] = dist
+ kwargs['dist_rel'] = dist_rel
+@@ -35,6 +36,7 @@ def build(ctx, target, require=[], dist='debian', dist_rel='stretch', salt=None,
+ kwargs['require'] = require
+ kwargs['salt'] = salt
+ kwargs['target'] = target
++ kwargs['build_arg_extra'] = ' --build-arg '.join([''] + split(build_arg_extra.replace('"', '"\\"')))
+ # command formating + update
+ fmt = {'tag': ''}
+ fmt.update(ctx.dockermake)
+@@ -60,6 +62,7 @@ def build(ctx, target, require=[], dist='debian', dist_rel='stretch', salt=None,
+ \t--requires ${requires} \
+ \t--build-arg SALT_VERSION="${salt}" \
+ \t--build-arg SALT_FORMULA_VERSION="${formula_rev}" \
++ \t${build_arg_extra} \
+ \t${push} ${options} \
+ ${fin}""").safe_substitute(fmt)
+ ctx.run(cmd.replace(' ', ''))