# HG changeset patch # User Vincent Hatakeyama <vincent.hatakeyama@xcg-consulting.fr> # Date 1466071422 -7200 # Thu Jun 16 12:03:42 2016 +0200 # Node ID 12ab8841690ad5afda578707ec7e77d887a90c59 # Parent 1639785382a3fc420934931518bae75a3f7b8f59 Add docker_build script diff --git a/VERSION b/VERSION new file mode 100644 --- /dev/null +++ b/VERSION @@ -0,0 +1,1 @@ +1.2 diff --git a/do_tests b/do_tests --- a/do_tests +++ b/do_tests @@ -13,7 +13,7 @@ # # - access to pg database # -# Version 1.0 +# Version 1.2 here=$(dirname $0) project_home=$here/.. dbname=$(basename $(readlink -f $project_home))_test diff --git a/docker_build b/docker_build new file mode 100755 --- /dev/null +++ b/docker_build @@ -0,0 +1,46 @@ +#!/bin/zsh +# template version 1.2 + +# TODO add a way to bypass the value, maybe with a key in the setup.cfg file +repository=dockerhub.xcg.io +# TODO add a way to bypass the value, maybe with a key in the setup.cfg file +project_home=$(dirname $0)/.. +image=$(basename $(readlink -f $project_home)) + +pushd $project_home + +# Ensureconf +hg cfensureconf || { echo 'hg cfensureconf failed' ; popd ; exit 1; } + +popd + +# Grab latest base image +ODOO_TYPE=$(cat $project_home/odoo_type) + +if [ "$ODOO_TYPE" = "odoo8" ]; +then + docker pull xcgd/odoo:8.0 || { echo 'Pull failed' ; exit 1; } +else + docker pull xcgd/odoo:7.0 || { echo 'Pull failed' ; exit 1; } +fi + +docker build -t $repository/$image $project_home || { echo 'Build failed' ; exit 1; } + +# tip is latest in docker +for tag in $(cd $project_home &&Â hg id -t); +do + if [[ ! -z "$tag" && "tip" != "$tag" ]] + then + echo "Docker tag with hg tag: $tag" + docker tag -f $repository/$image $repository/$image:$tag || { echo 'Tag failed' ; exit 1; } + fi +done + +for bookmark in $(cd $project_home && hg id -B); +do + echo "Docker tag with hg bookmark: $bookmark" + docker tag -f $repository/$image $repository/$image:$bookmark || { echo 'Tag failed' ; exit 1; } +done + +echo "Pushing docker image" +docker push $repository/$image || { echo 'Push failed' ; exit 1; } diff --git a/run_tests b/run_tests --- a/run_tests +++ b/run_tests @@ -1,6 +1,6 @@ #!/bin/zsh # vim: set shiftwidth=4 softtabstop=4: -# Version 1.0 +# Version 1.2 dbname=$1 here=$(dirname $0) if [[ -z "$dbname" ]]; diff --git a/setup.cfg b/setup.cfg --- a/setup.cfg +++ b/setup.cfg @@ -1,42 +1,16 @@ [bumpversion] -current_version = 1.1 -parse = (?P<major>\d+)\.(?P<minor>\d+)(?P<release>(_a|b|rc|.)?)(?P<patch>\d*)(_post(?P<post>\d+))? +current_version = 1.2 +parse = (?P<major>\d+)\.(?P<minor>\d+) serialize = - {major}.{minor}{release}{patch}.post{post} - {major}.{minor}{release}{patch} - {major}.{minor}{release} {major}.{minor} -tag_name = TAG_{new_version} [bumpversion:file:VERSION] -[bumpversion:file:doc/conf.py] -search = - release = '{current_version}' -replace = - release = '{new_version}' +[bumpversion:file:do_tests] -[bumpversion:part:release] -values = - a - b - rc - . -optional_value = . +[bumpversion:file:run_tests] -[bumpversion:file:requirements] - -[bumpversion:file:bin/do_tests] - -[bumpversion:file:bin/run_tests] - -[bumpversion:file:bin/start] +[bumpversion:file:start] -[bumpversion:file:conf/dev/odoo.conf] - -[bumpversion:file:doc/Makefile] +[bumpversion:file:docker_build] -[bumpversion:file:dev_install] - -[bumpversion:file:.drone.yml] - diff --git a/start b/start --- a/start +++ b/start @@ -5,7 +5,7 @@ # # You can set ODOO_DATA_DIR and ODOO_DB_HOST if you want to avoid using the default value ($HOME/var/tmp and localhost) # -# Version 1.1 +# Version 1.2 here=$(readlink -f $(dirname $0)/..) echo "Starting odoo for development" python=python