Create rolling releases using the Gitlab API. (#171)

* Create rolling releases using the Gitlab API.

This commit builds rolling releases of Container images using the latest commit
on master branch if the pipeline passed for it. The script which gets the
references is still un-tested and should be tested.

The latest commit hashes are passed as arguments to the Dockerfile, which is
then used by PIP to install the specific version of the dependency.
This commit is contained in:
Abhilash Raj
2017-11-03 18:43:59 -07:00
committed by GitHub
parent 743bc8522c
commit 3434446987
9 changed files with 127 additions and 45 deletions

View File

@@ -1,24 +1,47 @@
#!/bin/bash
set -e
# Use this script to build docker images.
if [[ "$TRAVIS" ]]
then
if [ "$TRAVIS_BRANCH" = "master" ]; then
CORE_TAG="latest"
WEB_TAG="latest"
else
CORE_TAG="$TRAVIS_BRANCH"
WEB_TAG="$TRAVIS_BRANCH"
fi
else
CORE_TAG=`cat core/VERSION`
WEB_TAG=`cat web/VERSION`
fi
set -ex
DOCKER=docker
$DOCKER build -t maxking/mailman-core:$CORE_TAG core/
$DOCKER build -t maxking/mailman-web:$WEB_TAG web/
# Set the env variable to later test this release before it is deployed.
if [ "$1" = "dev" ]; then
export DEV=true
fi
if [ "$TRAVIS_EVENT_TYPE" = "cron" ] || [ "$DEV" = "true" ] ; then
python -m pip install python-gitlab
# Get the latest commit for repositories and set their reference values to be
# used in the development builds.
CORE_REF=$(python get_latest_ref.py mailman/mailman)
CLIENT_REF=$(python get_latest_ref.py mailman/mailmanclient)
POSTORIUS_REF=$(python get_latest_ref.py mailman/postorius)
HYPERKITTY_REF=$(python get_latest_ref.py mailman/hyperkitty)
DJ_MM3_REF=$(python get_latest_ref.py mailman/django-mailman3)
MM3_HK_REF=$(python get_latest_ref.py mailman/mailman-hyperkitty)
# Build the mailman-core image.
$DOCKER build -f core/Dockerfile.dev \
--build-arg CORE_REF=$CORE_REF \
--build-arg MM3_HK_REF=$MM3_HK_REF \
-t maxking/mailman-core:rolling core/
# Build the mailman-web image.
$DOCKER build -f web/Dockerfile.dev \
--build-arg POSTORIUS_REF=$POSTORIUS_REF \
--build-arg CLIENT_REF=$CLIENT_REF \
--build-arg HYPERKITTY_REF=$HYPERKITTY_REF \
--build-arg DJ_MM3_REF=$DJ_MM3_REF \
-t maxking/mailman-web:rolling web/
else
# Do the normal building process.
if [ "$TRAVIS_BRANCH" = "master" ]; then
TAG="latest"
else
TAG="$TRAVIS_BRANCH"
fi
$DOCKER build -t maxking/mailman-core:$TAG core/
$DOCKER build -t maxking/mailman-web:$TAG web/
fi