Skip to content

Commit

Permalink
[ADD] undo content of commit 'Tecnativa/pull/175' we need it
Browse files Browse the repository at this point in the history
  • Loading branch information
zamberjo committed Nov 22, 2023
1 parent 6795d15 commit ce3fd65
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 1 deletion.
1 change: 1 addition & 0 deletions 14.0.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ ONBUILD RUN groupadd -g $GID odoo -o \
ONBUILD ENTRYPOINT ["/opt/odoo/common/entrypoint"]
ONBUILD CMD ["/usr/local/bin/odoo"]
ONBUILD ARG AGGREGATE=true
ONBUILD ARG AUTO_REQUIREMENTS=false
ONBUILD ARG DEFAULT_REPO_PATTERN="https://github.com/OCA/{}.git"
ONBUILD ARG DEFAULT_REPO_PATTERN_ODOO="https://github.com/OCA/OCB.git"
ONBUILD ARG DEPTH_DEFAULT=1
Expand Down
1 change: 1 addition & 0 deletions 15.0.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ ONBUILD RUN groupadd -g $GID odoo -o \
ONBUILD ENTRYPOINT ["/opt/odoo/common/entrypoint"]
ONBUILD CMD ["/usr/local/bin/odoo"]
ONBUILD ARG AGGREGATE=true
ONBUILD ARG AUTO_REQUIREMENTS=false
ONBUILD ARG DEFAULT_REPO_PATTERN="https://github.com/OCA/{}.git"
ONBUILD ARG DEFAULT_REPO_PATTERN_ODOO="https://github.com/OCA/OCB.git"
ONBUILD ARG DEPTH_DEFAULT=1
Expand Down
6 changes: 5 additions & 1 deletion build.d/200-dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
from glob import glob
from os.path import basename, join, splitext

from doodbalib import CUSTOM_DIR, FILE_APT_BUILD, SRC_DIR
from doodbalib import AUTO_REQUIREMENTS, CUSTOM_DIR, FILE_APT_BUILD, SRC_DIR
from doodbalib.installer import INSTALLERS, install, logger

# Build dependencies installed before any others
install("apt", FILE_APT_BUILD)

for name in INSTALLERS:
req_files = []
if name == "pip" and AUTO_REQUIREMENTS:
req_files += glob(join(SRC_DIR, "*", "requirements.txt"))
# Search also in subdirectories
req_files += glob(join(SRC_DIR, "*", "*", "requirements.txt"))
# Normal dependency installation
req_files.append(join(CUSTOM_DIR, "dependencies", "%s.txt" % name))
for req_file in req_files:
Expand Down
123 changes: 123 additions & 0 deletions build.sh
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."
1 change: 1 addition & 0 deletions lib/doodbalib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
AUTO_REPOS_YAML = "%s.yaml" % AUTO_REPOS_YAML

CLEAN = os.environ.get("CLEAN") == "true"
AUTO_REQUIREMENTS = os.environ.get("AUTO_REQUIREMENTS") == "true"
LOG_LEVELS = frozenset({"DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"})
FILE_APT_BUILD = os.path.join(CUSTOM_DIR, "dependencies", "apt_build.txt")
PRIVATE = "private"
Expand Down

0 comments on commit ce3fd65

Please sign in to comment.