You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#!/bin/bash
## Called by git-hooks or by hand, it should produce a master git-sub repository
## it should: ## - checkout the correct BRANCH of GIT_REPOS in DOCKER_UPDATE_PATH ## - launch a build of IMAGE with special option to copy the git repos checkouted ## - push the image to UPDATED_IMAGE_NAME
#!- . /etc/shlib #!-
DOCKER_UPDATE_PATH=${DOCKER_UPDATE_PATH:-/srv/docker-builder}
include common include pretty
usage="$exname COMPONENT CHARM MASTER_IMAGE_NAME BRANCH"
if [ "$#" == 0 ]; then print_usage exit 0 fi
COMPONENT_NAME="$1" CHARM="$2" MASTER_IMAGE_NAME="$3" BRANCH="$4"
if [ -z "$COMPONENT_NAME" ]; then print_error "You need to specify a component name as first argument." fi
if [ -z "$CHARM" ]; then print_error "You need to specify a charm name as second argument." fi
if [ -z "$MASTER_IMAGE_NAME" ]; then print_error "You need to specify a master image ame as first argument. (ie: docker.0k.io/odoo:master)" fi
if [ -z "$BRANCH" ]; then print_error "You need to specify a branch as fourth argument. (ie: 8.0/0k/dev/master)" fi
. /etc/charm/global.conf
## git-sub co should be so much better ! set -ex
mkdir -p "$DOCKER_UPDATE_PATH" cd "$DOCKER_UPDATE_PATH" rm -rf "$COMPONENT_NAME" time git sub clone $GIT_0K_CLONE_OPTIONS $GIT_0K_SUB_CLONE_OPTIONS -b "$BRANCH" \ "$GIT_0K_BASE"/0k/"$COMPONENT_NAME" docker rmi "$CHARM" || true export DOCKER_RUN_OPTS="-v $DOCKER_UPDATE_PATH/$COMPONENT_NAME:$DOCKER_UPDATE_PATH/$COMPONENT_NAME" time ODOO_CP_FROM_DIR="$DOCKER_UPDATE_PATH/$COMPONENT_NAME" EXTRA_CHARM_VARS="ODOO_CP_FROM_DIR" docker-build-charm "$CHARM"
docker tag "$CHARM" "$MASTER_IMAGE_NAME"
docker push "$MASTER_IMAGE_NAME"
|