Skip to content
Snippets Groups Projects
Commit bbaf0ca90ec6 authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

:pencil: add CREATED and REVISION in all build args, and fix --build-arg to work

parent 009bfee247e9
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,8 @@
"""
# Version 2.19
import argparse
import datetime
import json
import logging
import os
import signal
......@@ -9,8 +10,8 @@
import json
import logging
import os
import signal
from subprocess import call
from subprocess import call, check_output
import sys
from six.moves import configparser
......@@ -24,7 +25,7 @@
_logger = logging.getLogger(__name__)
__version__ = '0.1.2'
__version__ = '0.1.3'
__date__ = '2018-04-04'
__updated__ = '2018-11-19'
......@@ -89,5 +90,6 @@
)
parser.add_argument(
'--build-arg',
help="add dev feature to generated image [default: %(default)s]",
help="build arg for the image, formated like FOO=BAR "
"[default: %(default)s]",
default=None,
......@@ -93,4 +95,5 @@
default=None,
nargs='*',
)
parser.add_argument(
'--no-pull',
......@@ -94,7 +97,8 @@
)
parser.add_argument(
'--no-pull',
help="indicate to docker to not pull the base image [default: %(default)s]",
help="indicate to docker to not pull the base image "
"[default: %(default)s]",
action='store_true',
)
# TODO (maybe) add argument for other build arg
......@@ -153,7 +157,14 @@
signal.signal(signal.SIGTERM, signal_handler)
# TODO docker build
buildargs = nmspc.build_arg
buildargs = dict()
buildargs['REVISION'] = check_output('hg identify -i'.split()).split()[0]
buildargs['CREATED'] = datetime.datetime.now().isoformat()
if nmspc.build_arg:
for arg in nmspc.build_arg:
a = arg.split('=')
buildargs[a[0]] = a[1]
logging.debug("Build args: %s", buildargs)
dockerfile = 'Dockerfile'
if dev:
debug_dockerfile = 'Dockerfile.debug'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment