forked from Tecnativa/doodba
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] undo content of commit 'Tecnativa/pull/175' we need it
- Loading branch information
Showing
5 changed files
with
131 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
#!/bin/bash | ||
|
||
scriptname=$(basename "$(readlink -nf "${0}")") | ||
scriptpath=$(dirname "$(readlink -e -- "${0}")") | ||
|
||
odoo="" | ||
rebase=0 | ||
github=0 | ||
|
||
print_help() { | ||
cat >&2 <<EOF | ||
Usage: | ||
${scriptname} --odoo VERSION | ||
Arguments: | ||
-o, --odoo version de odoo a hacer build | ||
-r, --rebase actualiza el repositorio con upstream | ||
-g, --github actualiza la imagen en github | ||
-h, --help muestra esta ayuda y finaliza | ||
Examples: | ||
${scriptname} -o 8 | ||
${scriptname} --odoo 11 | ||
${scriptname} --odoo 14 --rebase --github | ||
${scriptname} --odoo 15 -g | ||
EOF | ||
exit 1 | ||
} | ||
|
||
OPTIONS=o:rgh | ||
LONGOPTS=odoo:,rebase:,github:,help | ||
PARSED=$(getopt --options=${OPTIONS} --longoptions=${LONGOPTS} \ | ||
--name="${scriptname}" -- "${@}") | ||
if [[ ${?} -ne 0 ]]; then | ||
echo >&2 "PARSE_ERROR" | ||
exit 2 | ||
fi | ||
eval set -- "${PARSED}" | ||
|
||
while :; do | ||
case "${1}" in | ||
-o | --odoo) | ||
odoo="${2}" | ||
shift 2 | ||
;; | ||
-r | --rebase) | ||
rebase=1 | ||
shift | ||
;; | ||
-g | --github) | ||
github=1 | ||
shift | ||
;; | ||
-h | --help) | ||
print_help | ||
;; | ||
--) | ||
shift | ||
break | ||
;; | ||
*) | ||
echo >&2 "PROGRAMMING_ERROR" | ||
exit 3 | ||
;; | ||
esac | ||
done | ||
|
||
if [[ ${#} -gt 0 ]]; then | ||
echo >&2 "Positional arguments found:" "${@}" | ||
exit 4 | ||
fi | ||
|
||
if [[ -z "${odoo}" ]]; then | ||
echo >&2 "${scriptname}: Missing '-o/--odoo' argument." | ||
exit 1 | ||
fi | ||
|
||
echo "[INFO] Backup previous image..." | ||
docker pull dockermaster.aurestic.com/nubeaerp/odoo-base:${odoo}.0-onbuild | ||
if [[ $? -eq 0 ]]; then | ||
docker tag \ | ||
dockermaster.aurestic.com/nubeaerp/odoo-base:${odoo}.0-onbuild \ | ||
dockermaster.aurestic.com/nubeaerp/odoo-base:${odoo}.0-onbuild-backup | ||
echo "[INFO] Backup image: dockermaster.aurestic.com/nubeaerp/odoo-base:${odoo}.0-onbuild-backup" | ||
else | ||
echo "[INFO] First time image build..." | ||
fi | ||
|
||
if [[ ${rebase} -eq 1 ]]; then | ||
echo "[INFO] Updating repository..." | ||
git branch -D master-upd | ||
git fetch upstream master:master-upd | ||
git rebase master-upd | ||
git push origin master | ||
if [[ $? -eq 0 ]]; then | ||
echo "[INFO] Repository updated" | ||
else | ||
echo "[ERROR] Repository update failed, manual intervention required" | ||
exit 5 | ||
fi | ||
fi | ||
|
||
echo "[INFO] Building ${odoo}.0-onbuild image..." | ||
docker build \ | ||
-t dockermaster.aurestic.com/nubeaerp/odoo-base:${odoo}.0-onbuild \ | ||
-f ${odoo}.0.Dockerfile . | ||
|
||
if [[ ${rebase} -eq 1 ]]; then | ||
echo "[INFO] reTagging image to ghcr.io/aurestic/odoo-base:${odoo}.0-onbuild" | ||
docker tag \ | ||
dockermaster.aurestic.com/nubeaerp/odoo-base:${odoo}.0-onbuild \ | ||
ghcr.io/aurestic/odoo-base:${odoo}.0-onbuild | ||
fi | ||
|
||
echo "[INFO] Pushing image..." | ||
docker push dockermaster.aurestic.com/nubeaerp/odoo-base:${odoo}.0-onbuild | ||
if [[ ${rebase} -eq 1 ]]; then | ||
docker push ghcr.io/aurestic/odoo-base:${odoo}.0-onbuild | ||
fi | ||
|
||
echo "[INFO] Process end." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters