2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-12-23 10:38:58 +00:00

add versioning support to travis.sh

This commit is contained in:
chabad360 2020-03-03 05:27:18 +00:00
parent 84d53bfcba
commit ca715e3e5c
2 changed files with 56 additions and 120 deletions

View File

@ -48,140 +48,60 @@ matrix:
- name: "Build Frappe python environment (v12)"
if: branch = master AND type != pull_request
script:
- git clone https://github.com/frappe/frappe --branch version-12
- cd frappe
- git fetch --tags
- export VERSION=$(git tag --list --sort=-version:refname "v12*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
- cd ..
- docker build -t frappe/frappe-worker:$VERSION -f build/frappe-worker/v12.Dockerfile .
- docker tag frappe/frappe-worker:$VERSION frappe/frappe-worker:version-12
- docker tag frappe/frappe-worker:$VERSION frappe/frappe-worker:v12
- docker push frappe/frappe-worker:$VERSION
- docker push frappe/frappe-worker:version-12
- docker push frappe/frappe-worker:v12
- ./travis.sh --worker --git-branch 12 --name frappe
- ./travis.sh --worker --tag v12 --name frappe --tag-only
- ./travis.sh --worker --tag version-12 --name frappe --tag-only
- name: "Build Frappe nginx + static assets (v12)"
if: branch = master AND type != pull_request
script:
- git clone https://github.com/frappe/frappe --branch version-12
- cd frappe
- git fetch --tags
- export VERSION=$(git tag --list --sort=-version:refname "v12*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
- cd ..
- docker build -t frappe/frappe-assets:$VERSION -f build/frappe-assets/v12.Dockerfile .
- docker tag frappe/frappe-assets:$VERSION frappe/frappe-assets:version-12
- docker tag frappe/frappe-assets:$VERSION frappe/frappe-assets:v12
- docker push frappe/frappe-assets:$VERSION
- docker push frappe/frappe-assets:version-12
- docker push frappe/frappe-assets:v12
- ./travis.sh --assets --git-branch 12 --name frappe
- ./travis.sh --assets --tag v12 --name frappe --tag-only
- ./travis.sh --assets --tag version-12 --name frappe --tag-only
- name: "Build ERPNext python environment (v12)"
if: branch = master AND type != pull_request
script:
- git clone https://github.com/frappe/erpnext --branch version-12
- cd erpnext
- git fetch --tags
- export VERSION=$(git tag --list --sort=-version:refname "v12*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
- cd ..
- docker build -t frappe/erpnext-worker:$VERSION -f build/erpnext-worker/v12.Dockerfile .
- docker tag frappe/erpnext-worker:$VERSION frappe/erpnext-worker:version-12
- docker tag frappe/erpnext-worker:$VERSION frappe/erpnext-worker:v12
- docker push frappe/erpnext-worker:$VERSION
- docker push frappe/erpnext-worker:version-12
- docker push frappe/erpnext-worker:v12
- ./travis.sh --worker --git-branch 12 --name erpnext
- ./travis.sh --worker --tag v12 --name erpnext --tag-only
- ./travis.sh --worker --tag version-12 --name erpnext --tag-only
- name: "Build ERPNext nginx + static assets (v12)"
if: branch = master AND type != pull_request
script:
- git clone https://github.com/frappe/erpnext --branch version-12
- cd erpnext
- git fetch --tags
- export VERSION=$(git tag --list --sort=-version:refname "v12*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
- cd ..
- docker build -t frappe/erpnext-assets:$VERSION -f build/erpnext-assets/v12.Dockerfile .
- docker tag frappe/erpnext-assets:$VERSION frappe/erpnext-assets:version-12
- docker tag frappe/erpnext-assets:$VERSION frappe/erpnext-assets:v12
- docker push frappe/erpnext-assets:$VERSION
- docker push frappe/erpnext-assets:version-12
- docker push frappe/erpnext-assets:v12
- ./travis.sh --assets --git-branch 12 --name erpnext
- ./travis.sh --assets --tag v12 --name erpnext --tag-only
- ./travis.sh --assets --tag version-12 --name erpnext --tag-only
- name: "Build Frappe socketio service (v12)"
if: branch = master AND type != pull_request
script:
- git clone https://github.com/frappe/frappe --branch version-12
- cd frappe
- git fetch --tags
- export VERSION=$(git tag --list --sort=-version:refname "v12*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
- cd ..
- docker build -t frappe/frappe-socketio:$VERSION -f build/frappe-socketio/v12.Dockerfile .
- docker tag frappe/frappe-socketio:$VERSION frappe/frappe-socketio:version-12
- docker tag frappe/frappe-socketio:$VERSION frappe/frappe-socketio:v12
- docker push frappe/frappe-socketio:$VERSION
- docker push frappe/frappe-socketio:version-12
- docker push frappe/frappe-socketio:v12
- ./travis.sh --socketio --git-branch 12 --name frappe
- ./travis.sh --socketio --tag v12 --name frappe --tag-only
- ./travis.sh --socketio --tag version-12 --name frappe --tag-only
- name: "Build Frappe python environment (v11)"
if: branch = master AND type != pull_request
script:
- git clone https://github.com/frappe/frappe --branch version-11
- cd frappe
- git fetch --tags
- export VERSION=$(git tag --list --sort=-version:refname "v11*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
- cd ..
- docker build -t frappe/frappe-worker:$VERSION -f build/frappe-worker/v11.Dockerfile .
- docker tag frappe/frappe-worker:$VERSION frappe/frappe-worker:version-11
- docker tag frappe/frappe-worker:$VERSION frappe/frappe-worker:v11
- docker push frappe/frappe-worker:$VERSION
- docker push frappe/frappe-worker:version-11
- docker push frappe/frappe-worker:v11
- ./travis.sh --worker --git-branch 11 --name frappe
- ./travis.sh --worker --tag v11 --name frappe --tag-only
- ./travis.sh --worker --tag version-11 --name frappe --tag-only
- name: "Build Frappe nginx + static assets (v11)"
if: branch = master AND type != pull_request
script:
- git clone https://github.com/frappe/frappe --branch version-11
- cd frappe
- git fetch --tags
- export VERSION=$(git tag --list --sort=-version:refname "v11*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
- cd ..
- docker build -t frappe/frappe-assets:$VERSION -f build/frappe-assets/v11.Dockerfile .
- docker tag frappe/frappe-assets:$VERSION frappe/frappe-assets:version-11
- docker tag frappe/frappe-assets:$VERSION frappe/frappe-assets:v11
- docker push frappe/frappe-assets:$VERSION
- docker push frappe/frappe-assets:version-11
- docker push frappe/frappe-assets:v11
- ./travis.sh --assets --git-branch 11 --name frappe
- ./travis.sh --assets --tag v11 --name frappe --tag-only
- ./travis.sh --assets --tag version-11 --name frappe --tag-only
- name: "Build ERPNext python environment (v11)"
if: branch = master AND type != pull_request
script:
- git clone https://github.com/frappe/erpnext --branch version-11
- cd erpnext
- git fetch --tags
- export VERSION=$(git tag --list --sort=-version:refname "v11*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
- cd ..
- docker build -t frappe/erpnext-worker:$VERSION -f build/erpnext-worker/v11.Dockerfile .
- docker tag frappe/erpnext-worker:$VERSION frappe/erpnext-worker:version-11
- docker tag frappe/erpnext-worker:$VERSION frappe/erpnext-worker:v11
- docker push frappe/erpnext-worker:$VERSION
- docker push frappe/erpnext-worker:version-11
- docker push frappe/erpnext-worker:v11
- ./travis.sh --worker --git-branch 11 --name erpnext
- ./travis.sh --worker --tag v11 --name erpnext --tag-only
- ./travis.sh --worker --tag version-11 --name erpnext --tag-only
- name: "Build ERPNext nginx + static assets (v11)"
if: branch = master AND type != pull_request
script:
- git clone https://github.com/frappe/erpnext --branch version-11
- cd erpnext
- git fetch --tags
- export VERSION=$(git tag --list --sort=-version:refname "v11*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
- cd ..
- docker build -t frappe/erpnext-assets:$VERSION -f build/erpnext-assets/v11.Dockerfile .
- docker tag frappe/erpnext-assets:$VERSION frappe/erpnext-assets:version-11
- docker tag frappe/erpnext-assets:$VERSION frappe/erpnext-assets:v11
- docker push frappe/erpnext-assets:$VERSION
- docker push frappe/erpnext-assets:version-11
- docker push frappe/erpnext-assets:v11
- ./travis.sh --assets --git-branch 11 --name erpnext
- ./travis.sh --assets --tag v11 --name erpnext --tag-only
- ./travis.sh --assets --tag version-11 --name erpnext --tag-only
- name: "Build Frappe socketio service (v11)"
if: branch = master AND type != pull_request
script:
- git clone https://github.com/frappe/frappe --branch version-11
- cd frappe
- git fetch --tags
- export VERSION=$(git tag --list --sort=-version:refname "v11*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
- cd ..
- docker build -t frappe/frappe-socketio:$VERSION -f build/frappe-socketio/v11.Dockerfile .
- docker tag frappe/frappe-socketio:$VERSION frappe/frappe-socketio:version-11
- docker tag frappe/frappe-socketio:$VERSION frappe/frappe-socketio:v11
- docker push frappe/frappe-socketio:$VERSION
- docker push frappe/frappe-socketio:version-11
- docker push frappe/frappe-socketio:v11
- ./travis.sh --socketio --git-branch 11 --name erpnext
- ./travis.sh --socketio --tag v11 --name erpnext --tag-only
- ./travis.sh --socketio --tag version-11 --name erpnext --tag-only

View File

@ -4,7 +4,6 @@
# This script takes care of the common steps
# found in the Travis CI builds.
POSITIONAL=()
while [[ $# -gt 0 ]]; do
key="$1"
@ -35,13 +34,24 @@ while [[ $# -gt 0 ]]; do
TAGONLY=1
shift
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
-g|--git-branch)
BRANCH="$2"
shift
shift
;;
esac
done
function gitVersion() {
echo "Pulling ${1} v${2}"
git clone https://github.com/frappe/${1} --branch version-${2}
cd ${1}
git fetch --tags
TAG=$(git tag --list --sort=-version:refname "v${2}*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
cd ..
DOCKERFILE="v${2}.Dockerfile"
}
function tagAndPush() {
echo "Tagging ${1} as \"${2}\" and pushing"
docker tag ${1} frappe/${1}:${2}
@ -49,27 +59,33 @@ function tagAndPush() {
}
function build () {
echo "Building ${1} ${3} image"
docker build -t ${1}-${3} -f build/${1}-worker/Dockerfile .
echo "Building ${1} ${3} image using ${4}"
docker build -t ${1}-${3} -f build/${1}-${3}/${4:-Dockerfile} .
tagAndPush "${1}-${3}" ${2}
}
if [[ $BRANCH ]]; then
gitVersion $NAME $BRANCH
fi
DOCKERFILE=${DOCKERFILE:-Dockerfile}
if [[ $WORKER ]]; then
if [[ $TAGONLY ]]; then
tagAndPush "${NAME}-worker" ${TAG}
tagAndPush "${NAME}-worker" ${TAG}
else
build $NAME $TAG worker
build $NAME $TAG worker ${DOCKERFILE}
fi
elif [[ $ASSETS ]]; then
if [[ $TAGONLY ]]; then
tagAndPush "${NAME}-assets" ${TAG}
else
build $NAME $TAG assets
build $NAME $TAG assets ${DOCKERFILE}
fi
elif [[ $SOCKETIO ]]; then
if [[ $TAGONLY ]]; then
tagAndPush "${NAME}-socketio" ${TAG}
else
build $NAME $TAG socketio
build $NAME $TAG socketio ${DOCKERFILE}
fi
fi