diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3509438a..d063dd41 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -7,7 +7,7 @@ on: - "master" - "dev" tags: - - "*.*.*.*.*" + - "*.*.*" - "stable" pull_request: @@ -17,7 +17,6 @@ on: schedule: - cron: "0 1 * * THU" - env: TARGET: GHCR DOCKER_BUILDKIT: 1 @@ -42,41 +41,41 @@ jobs: python_from: "python:3.9-slim-trixie" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v4 with: driver: docker - name: Docker meta id: docker_meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v6 with: images: ghcr.io/camptocamp/docker-odoo-project flavor: | - prefix=${{ matrix.odoo_serie }}-,onlatest=true + prefix=${{ matrix.odoo_serie }}-,onlatest=true tags: | - type=raw,value={{branch}}-latest - type=raw,value={{branch}}-{{date 'YYYYMMDD'}} - type=ref,event=tag - type=ref,event=pr - type=schedule,pattern={{branch}}-nightly - type=raw,value={{branch}} + type=raw,value={{branch}}-latest + type=raw,value={{branch}}-{{date 'YYYYMMDD'}} + type=ref,event=tag + type=ref,event=pr + type=schedule,pattern={{branch}}-nightly + type=raw,value={{branch}} - name: Setup build dir run: | VERSION=${{ matrix.odoo_serie }} SRC=build make setup - name: Build - uses: docker/build-push-action@v6 + uses: docker/build-push-action@v7 with: context: ./build build-args: | - VERSION=${{ matrix.odoo_serie }} + VERSION=${{ matrix.odoo_serie }} build-contexts: | - python=docker-image://${{ matrix.python_from }} + python=docker-image://${{ matrix.python_from }} push: false load: true tags: ci-5xx-latest:${{ matrix.odoo_serie }} @@ -85,35 +84,35 @@ jobs: - name: Test run: make VERSION=${{ matrix.odoo_serie }} test + - name: Scan image + id: scan + uses: sysdiglabs/scan-action@v6 + with: + sysdig-secure-url: https://eu1.app.sysdig.com + stop-on-failed-policy-eval: false + stop-on-processing-error: false + image-tag: ci-5xx-latest:${{ matrix.odoo_serie }} + skip-upload: false + sysdig-secure-token: ${{ secrets.SYSDIG_SECURE_TOKEN }} + - name: Login to GitHub Container Registry if: github.event_name == 'push' || github.event_name == 'schedule' - uses: docker/login-action@v2 + uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ secrets.GHCR_USER }} password: ${{ secrets.GHCR_TOKEN }} - - name: Scan image - id: scan - uses: sysdiglabs/scan-action@v6.1.3 - with: - sysdig-secure-url: https://eu1.app.sysdig.com - stop-on-failed-policy-eval: false - stop-on-processing-error: false - image-tag: ci-5xx-latest:${{ matrix.odoo_serie }} - skip-upload: false - sysdig-secure-token: ${{ secrets.SYSDIG_SECURE_TOKEN }} - - name: Tag & Push if: github.event_name == 'push' || github.event_name == 'schedule' id: docker_push - uses: docker/build-push-action@v6 + uses: docker/build-push-action@v7 with: context: ./build build-args: | - VERSION=${{ matrix.odoo_serie }} + VERSION=${{ matrix.odoo_serie }} build-contexts: | - python=docker-image://${{ matrix.python_from }} + python=docker-image://${{ matrix.python_from }} push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} diff --git a/14.0/base_requirements.txt b/14.0/base_requirements.txt index 04f7954f..9f2c4828 100644 --- a/14.0/base_requirements.txt +++ b/14.0/base_requirements.txt @@ -46,6 +46,7 @@ xlrd==1.2.0; python_version >= '3.8' zope.event==5.0 zope.interface==8.0 + whool==1.2.0 # Not part of official requirements, but used by some addons # colorama==0.3.9 diff --git a/14.0/src_requirements.txt b/14.0/src_requirements.txt index b1ecc161..c3635873 100644 --- a/14.0/src_requirements.txt +++ b/14.0/src_requirements.txt @@ -1,8 +1,5 @@ # Requirements for the project itself and for Odoo. # When we install Odoo with -e, odoo.py is available in the PATH and # 'openerp' in the PYTHONPATH -# -# They are installed only after all the project's files have been copied -# into the image (with ONBUILD) -e . -e src diff --git a/15.0/base_requirements.txt b/15.0/base_requirements.txt index 0bfca5b2..4af2d0ff 100644 --- a/15.0/base_requirements.txt +++ b/15.0/base_requirements.txt @@ -15,7 +15,7 @@ lxml-html-clean; python_version >= '3.12' # (Noble - removed from lxml, unpinned MarkupSafe==2.1.5 ; python_version >= '3.12' # (Noble) Mostly to have a wheel package num2words==0.5.6 ofxparse==0.21; python_version > '3.9' # (Jammy) -Pillow==12.1.1 # upstream: 10.3.0 +Pillow==12.1.1 ; python_version >= '3.12' # (Noble) Mostly to have a wheel package polib==1.1.0 psutil==5.9.8 ; python_version >= '3.12' # (Noble) Mostly to have a wheel package psycopg2==2.9.9 ; python_version >= '3.12' # (Noble) Mostly to have a wheel package @@ -43,6 +43,7 @@ zeep==3.4.0 zope.event==5.1.1 zope.interface==8.0 + whool==1.2.0 # Not part of official requirements, but used by some addons # colorama==0.3.9 diff --git a/15.0/src_requirements.txt b/15.0/src_requirements.txt index b1ecc161..c3635873 100644 --- a/15.0/src_requirements.txt +++ b/15.0/src_requirements.txt @@ -1,8 +1,5 @@ # Requirements for the project itself and for Odoo. # When we install Odoo with -e, odoo.py is available in the PATH and # 'openerp' in the PYTHONPATH -# -# They are installed only after all the project's files have been copied -# into the image (with ONBUILD) -e . -e src diff --git a/16.0/base_requirements.txt b/16.0/base_requirements.txt index 0b08a54c..eead1b72 100644 --- a/16.0/base_requirements.txt +++ b/16.0/base_requirements.txt @@ -19,7 +19,7 @@ MarkupSafe==2.1.5 ; python_version >= '3.12' # (Noble) Mostly to have a wheel p num2words==0.5.9 ofxparse==0.21; python_version > '3.9' # (Jammy) passlib==1.7.4 # min version = 1.7.2 (Focal with security backports) -Pillow==12.1.1 # upstream: 10.3.0 +Pillow==12.1.1 ; python_version >= '3.12' # (Noble) Mostly to have a wheel package polib==1.1.0 psutil==5.9.8 ; python_version >= '3.12' # (Noble) Mostly to have a wheel package psycopg2==2.9.9 ; python_version >= '3.12' # (Noble) Mostly to have a wheel package @@ -47,6 +47,7 @@ zeep==4.0.0 zope.event==5.1.1 zope.interface==8.0 + # Not part of official requirements, but used by some addons # colorama==0.3.9 gdata==2.0.18 diff --git a/16.0/src_requirements.txt b/16.0/src_requirements.txt index b1ecc161..c3635873 100644 --- a/16.0/src_requirements.txt +++ b/16.0/src_requirements.txt @@ -1,8 +1,5 @@ # Requirements for the project itself and for Odoo. # When we install Odoo with -e, odoo.py is available in the PATH and # 'openerp' in the PYTHONPATH -# -# They are installed only after all the project's files have been copied -# into the image (with ONBUILD) -e . -e src diff --git a/17.0/base_requirements.txt b/17.0/base_requirements.txt index 7b13465c..fe6e32d2 100644 --- a/17.0/base_requirements.txt +++ b/17.0/base_requirements.txt @@ -19,7 +19,7 @@ num2words==0.5.13 ; python_version >= '3.12' ofxparse==0.21 openpyxl==3.1.2 ; python_version >= '3.12' passlib==1.7.4 # min version = 1.7.2 (Focal with security backports) -Pillow==12.1.1 # upstream: 10.3.0 +Pillow==12.1.1 ; python_version >= '3.12' # (Noble) Mostly to have a wheel package polib==1.1.0 psutil==5.9.8 ; python_version >= '3.12' # (Noble) Mostly to have a wheel package psycopg2==2.9.9 ; python_version >= '3.12' # (Noble) Mostly to have a wheel package @@ -48,6 +48,7 @@ zeep==4.2.1 ; python_version >= '3.11' zope.event==5.1.1 zope.interface==8.0 + # Not part of official requirements, but used by some addons # colorama==0.3.9 gdata==2.0.18 diff --git a/17.0/src_requirements.txt b/17.0/src_requirements.txt index b1ecc161..c3635873 100644 --- a/17.0/src_requirements.txt +++ b/17.0/src_requirements.txt @@ -1,8 +1,5 @@ # Requirements for the project itself and for Odoo. # When we install Odoo with -e, odoo.py is available in the PATH and # 'openerp' in the PYTHONPATH -# -# They are installed only after all the project's files have been copied -# into the image (with ONBUILD) -e . -e src diff --git a/18.0/base_requirements.txt b/18.0/base_requirements.txt index 3c071166..8550d71e 100644 --- a/18.0/base_requirements.txt +++ b/18.0/base_requirements.txt @@ -22,7 +22,7 @@ num2words==0.5.13 ; python_version >= '3.12' ofxparse==0.21 openpyxl==3.1.2 ; python_version >= '3.12' passlib==1.7.4 # min version = 1.7.2 (Focal with security backports) -Pillow==12.1.1 # upstream: 10.3.0 +Pillow==12.1.1 ; python_version >= '3.12' # (Noble) Mostly to have a wheel package polib==1.1.1 psutil==5.9.8 ; python_version >= '3.12' # (Noble) Mostly to have a wheel package psycopg2==2.9.9 ; python_version >= '3.12' # (Noble) Mostly to have a wheel package @@ -50,6 +50,7 @@ zeep==4.2.1 ; python_version >= '3.11' zope.event==5.1.1 zope.interface==8.0 + # Not part of official requirements, but used by some addons # colorama==0.3.9 gdata==2.0.18 diff --git a/18.0/src_requirements.txt b/18.0/src_requirements.txt index b1ecc161..c3635873 100644 --- a/18.0/src_requirements.txt +++ b/18.0/src_requirements.txt @@ -1,8 +1,5 @@ # Requirements for the project itself and for Odoo. # When we install Odoo with -e, odoo.py is available in the PATH and # 'openerp' in the PYTHONPATH -# -# They are installed only after all the project's files have been copied -# into the image (with ONBUILD) -e . -e src diff --git a/19.0/base_requirements.txt b/19.0/base_requirements.txt index b8601c06..1ddca000 100644 --- a/19.0/base_requirements.txt +++ b/19.0/base_requirements.txt @@ -24,7 +24,7 @@ num2words==0.5.13 ; python_version >= '3.12' ofxparse==0.21 openpyxl==3.1.2 ; python_version >= '3.12' passlib==1.7.4 # min version = 1.7.2 (Focal with security backports) -Pillow==12.1.1 # upstream: 10.3.0 +Pillow==12.1.1 ; python_version >= '3.12' # (Noble) Mostly to have a wheel package polib==1.1.1 psutil==5.9.8 ; python_version >= '3.12' # (Noble) Mostly to have a wheel package psycopg2==2.9.9 ; python_version >= '3.12' and python_version < '3.13' # (Noble) @@ -53,6 +53,7 @@ zeep==4.3.1 ; python_version >= '3.13' zope.event==6.0 zope.interface==8.0 + # Not part of official requirements, but used by some addons # colorama==0.3.9 gdata==2.0.18 diff --git a/19.0/src_requirements.txt b/19.0/src_requirements.txt index b1ecc161..c3635873 100644 --- a/19.0/src_requirements.txt +++ b/19.0/src_requirements.txt @@ -1,8 +1,5 @@ # Requirements for the project itself and for Odoo. # When we install Odoo with -e, odoo.py is available in the PATH and # 'openerp' in the PYTHONPATH -# -# They are installed only after all the project's files have been copied -# into the image (with ONBUILD) -e . -e src diff --git a/HISTORY.rst b/HISTORY.rst index a5da4f60..1fae28a3 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -562,6 +562,7 @@ if the image, without onbuild instructions, with onbuild and full. * Reduce size of the 11.0 image by cleaning and optimizing layers + 2.5.0 (2018-01-11) ++++++++++++++++++ diff --git a/Makefile b/Makefile index d7d5c773..6d698f63 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ifndef VERSION -VERSION=18.0 +$(error VERSION is not set) endif IMAGE_LATEST=ci-5xx-latest:${VERSION} diff --git a/README.md b/README.md index dd87adfe..30cf4b8f 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ KWKHTMLTOPDF_SERVER_URL=: and you also need to specify report url to let kwkhtmltopdf server to retrive images/header etc... from odoo: ``` -ODOO_REPORT_URL= +ODOO_REPORT_URL= ``` ## ⚠️ Images moved to ghcr.io @@ -46,7 +46,7 @@ https://github.com/camptocamp/docker-odoo-project/pkgs/container/odoo-project ## Image Flavors -There are 4 flavors of the image: +There are 1 flavor of the image: - normal: `odoo-project:${odoo_version}-${tag_version}` @@ -61,10 +61,8 @@ The images should be build with `make`: Normal flavors: ``` -# generate image camptocamp/odoo-project:11.0-latest and camptocamp/odoo-project:11.0-latest -$ make VERSION=11.0 -# generate image camptocamp/odoo-project:10.0-latest and camptocamp/odoo-project:10.0-latest -$ make VERSION=10.0 +$ make VERSION=19.0 +$ make VERSION=18.0 ``` ## Configuration @@ -72,7 +70,7 @@ $ make VERSION=10.0 The host for the database is in `$DB_HOST` (`db` by default). A volume `/data/odoo` is declared, which is expected to contain Odoo's filestore -(this path is set in `openerp.cfg`). +(this path is set in `odoo.cfg`). Ports 8069 and 8072 are exposed by default. @@ -88,13 +86,13 @@ value, the configuration parameters will be left unchanged. ### ODOO_REPORT_URL The `ir.config_parameter` `report.url` will be automatically set to this -domain when the container starts.. +domain when the container starts. Default url is `http://localhost:8069`. As soon as we use kwkhtmltopdf we must set this URL to be accessible by you kwkhtmltopdf server ### KWKHTMLTOPDF_SERVER_URL -It point to the server that host the kwktmltopdf server to serve files +It points to the server that host the kwktmltopdf server to serve files ### MIGRATE @@ -129,11 +127,11 @@ one `MARABUNTA_MODE=full`. By default, [Marabunta](https://github.com/camptocamp/marabunta) does not allow to execute more than one version upgrade at a time. This is because it is -dangerous to execute a migration script (say 9.1.0) if the version of the code -is not the same (say 9.2.0). +dangerous to execute a migration script (say 19.1.0) if the version of the code +is not the same (say 19.2.0). For a production server, it works, because usually you only want to upgrade to -the last version N from N-1. But for development or a test server, you might +the last version N from N-1. But for development or a test server, you might want to take the risk of running all the migration scripts consecutively, this is what `MARABUNTA_ALLOW_SERIE=True` is for. @@ -234,16 +232,16 @@ It will load a dump lower than "odoo_sample_$MIG_LOAD_VERSION_CEIL.dmp" This is useful if you bumped odoo/VERSION as it won't match existing dumps. -For instance you have made a dump 10.1.0, you are now on the version -10.2.0, if you pass your current version it will search for a dump -lower than 10.2.0 and restore the 10.1.0. Then play the remaining +For instance you have made a dump 19.1.0, you are now on the version +19.2.0, if you pass your current version it will search for a dump +lower than 19.2.0 and restore the 19.1.0. Then play the remaining steps on top of it. ### Odoo Configuration Options The main configuration options of Odoo can be configured through environment variables. The name of the environment variables are the same of the options but uppercased (eg. `workers` becomes `WORKERS`). -Look in [11.0/templates/odoo.cfg.tmpl](11.0/templates/odoo.cfg.tmpl) to see the full list. +Look in [19.0/templates/odoo.cfg.tmpl](19.0/templates/odoo.cfg.tmpl) to see the full list. While most of the variables can be set in the `docker-compose.yml` file so we can have different values for different environments, the `ADDONS_PATH` **must** be set in the `Dockerfile` of your project with a line such as: @@ -307,7 +305,7 @@ docker compose run --rm odoo dropdb testdb Pytest uses a plugin (https://github.com/camptocamp/pytest-odoo) that corrects the -Odoo namespaces (`openerp.addons`/`odoo.addons`) when running the tests. +Odoo namespaces (`odoo.addons`) when running the tests. ### pytest-cov diff --git a/bin/docker-entrypoint.sh b/bin/docker-entrypoint.sh index ec037967..733c67d3 100755 --- a/bin/docker-entrypoint.sh +++ b/bin/docker-entrypoint.sh @@ -10,7 +10,7 @@ export PGUSER=${DB_USER} export PGDATABASE=${DB_NAME} export PGAPPNAME=${HOSTNAME} -# As 'docker compose exec' do not launch the entrypoint +# As 'docker compose exec' does not launch the entrypoint # init PG variable into .bashrc so it will be initialized # when doing 'docker compose exec odoo odoo bash' echo " @@ -19,14 +19,14 @@ export PGPORT=${DB_PORT} export PGUSER=${DB_USER} export PGDATABASE=${DB_NAME} export PGAPPNAME=${HOSTNAME} -" >>/odoo/.bashrc +" >> /odoo/.bashrc # Only set PGPASSWORD if there is no .pgpass file if [ ! -f /odoo/.pgpass ]; then export PGPASSWORD=${DB_PASSWORD} echo " export PGPASSWORD=${DB_PASSWORD} - " >>/odoo/.bashrc + " >> /odoo/.bashrc fi BASE_CMD=$(basename $1) @@ -40,18 +40,18 @@ case "$BASE_CMD" in ("runtests"|"testdb-gen"|"testdb-update") DEMO=true;; esac case "$(echo "${DEMO:-false}" | tr '[:upper:]' '[:lower:]')" in -"false") - echo "Running without demo data" - export DEMO=False WITHOUT_DEMO=True - ;; -"true") - echo "Running with demo data" - export DEMO=True WITHOUT_DEMO= - ;; -*) - echo "Value '${DEMO}' for DEMO is not a valid value in 'False', 'True'" - exit 1 - ;; + "false") + echo "Running without demo data" + export DEMO=False WITHOUT_DEMO=True + ;; + "true") + echo "Running with demo data" + export DEMO=True WITHOUT_DEMO= + ;; + *) + echo "Value '${DEMO}' for DEMO is not a valid value in 'False', 'True'" + exit 1 + ;; esac # Create configuration file from the template diff --git a/bin/list_dependencies.py b/bin/list_dependencies.py index b532ea73..0f47ccd4 100755 --- a/bin/list_dependencies.py +++ b/bin/list_dependencies.py @@ -8,11 +8,11 @@ # # Usage: # ./odoo/bin/list_dependencies.py local_module1,local_module2 -import sys -import os import ast +import os +import sys -LOCAL_CODE_PATH = os.getenv('LOCAL_CODE_PATH', "/odoo/odoo/addons") +LOCAL_CODE_PATH = os.getenv("LOCAL_CODE_PATH", "/odoo/odoo/addons") dependencies = set() local_modules = os.listdir(LOCAL_CODE_PATH) diff --git a/bin/runmigration b/bin/runmigration index 19b7c259..60caf3c9 100755 --- a/bin/runmigration +++ b/bin/runmigration @@ -45,38 +45,38 @@ CACHED_DUMP="$CACHE_DIR/odoo_sample_$VERSION.dmp" if [ "$LOAD_DB_CACHE" != "false" ]; then - # If we want to run the migration steps on top of a previous dump - # useful when odoo/VERSION was edited - if [ -n "$MIG_LOAD_VERSION_CEIL" ]; then - echo "New version - Searching for previous version dump 🔭" - if [ -d "$CACHE_DIR" ]; then - # Filter dumps of higher releases - export MAX_DUMP="$CACHE_DIR/odoo_sample_${MIG_LOAD_VERSION_CEIL}.dmp" - CACHED_DUMP=$(ls -v $CACHE_DIR/odoo_sample_*.dmp | awk '$0 < ENVIRON["MAX_DUMP"]' | tail -n1) - else - echo "No cached migration sample dump found" - fi + # If we want to run the migration steps on top of a previous dump + # useful when odoo/VERSION was edited + if [ -n "$MIG_LOAD_VERSION_CEIL" ]; then + echo "New version - Searching for previous version dump 🔭" + if [ -d "$CACHE_DIR" ]; then + # Filter dumps of higher releases + export MAX_DUMP="$CACHE_DIR/odoo_sample_${MIG_LOAD_VERSION_CEIL}.dmp" + CACHED_DUMP=$(ls -v $CACHE_DIR/odoo_sample_*.dmp | awk '$0 < ENVIRON["MAX_DUMP"]' | tail -n1) + else + echo "No cached migration sample dump found" fi + fi else - echo "Dump cache load disabled." + echo "Dump cache load disabled." fi if [ "$LOAD_DB_CACHE" != "false" -a -f "$CACHED_DUMP" ]; then - echo "🐘 🐘 Database dump ${CACHED_DUMP} found 🐘 🐘" - echo "Restore Database dump from cache 📦⮕ 🐘" - createdb -O $DB_USER $DB_NAME - psql -q -o /dev/null -f "$CACHED_DUMP" - echo "Do migration on top of restored dump" + echo "🐘 🐘 Database dump ${CACHED_DUMP} found 🐘 🐘" + echo "Restore Database dump from cache 📦⮕ 🐘" + createdb -O $DB_USER $DB_NAME + psql -q -o /dev/null -f "$CACHED_DUMP" + echo "Do migration on top of restored dump" else - echo "Do migration from scratch 🐢 🐢 🐢" + echo "Do migration from scratch 🐢 🐢 🐢" fi migrate # Create a dump if none exist for the current VERSION if [ "$CREATE_DB_CACHE" == "true" -a ! -f "$CACHED_DUMP" ]; then - echo "Save DB to cache $CACHED_DUMP 🐘⮕ 📦" - mkdir -p "$CACHE_DIR" - pg_dump -Fp -O -f "$CACHED_DUMP" - ls -l $CACHED_DUMP + echo "Save DB to cache $CACHED_DUMP 🐘⮕ 📦" + mkdir -p "$CACHE_DIR" + pg_dump -Fp -O -f "$CACHED_DUMP" + ls -l $CACHED_DUMP fi diff --git a/bin/runtests b/bin/runtests index ed50b75e..ba6ab307 100755 --- a/bin/runtests +++ b/bin/runtests @@ -33,11 +33,11 @@ wait_postgres.sh CACHE_DIR=${CACHE_DIR:=/tmp/cachedb} if [ -z $1 ]; then - LOCAL_ADDONS=$(find ${LOCAL_CODE_PATH}/* -maxdepth 0 -type d -and -not -name server_environment_files -printf "%f\n" | - awk -vORS=, '{print $1}' | - sed 's/,$/\n/') + LOCAL_ADDONS=$(find ${LOCAL_CODE_PATH}/* -maxdepth 0 -type d -and -not -name server_environment_files -printf "%f\n" | + awk -vORS=, '{print $1}' | + sed 's/,$/\n/') else - LOCAL_ADDONS=$1 + LOCAL_ADDONS=$1 fi ALL_DEPS_ADDONS=$(list_dependencies.py "$LOCAL_ADDONS") @@ -51,30 +51,30 @@ echo "Create database" createdb -O $DB_USER ${DB_NAME_TEST} if [[ ! -z "$SUBS_MD5" ]]; then - CACHED_DUMP="$CACHE_DIR/odoo_test_$SUBS_MD5.dmp" + CACHED_DUMP="$CACHE_DIR/odoo_test_$SUBS_MD5.dmp" fi echo "Submodule addons MD5 is: $SUBS_MD5" if [ "$LOAD_DB_CACHE" != "false" -a -f "$CACHED_DUMP" ]; then - echo "🐘 🐘 Database dump ${CACHED_DUMP} found 🐘 🐘" - echo "Restore Database dump from cache matching MD5 📦⮕ 🐘" - psql -q -o /dev/null -d $DB_NAME_TEST -f "$CACHED_DUMP" - psql -d $DB_NAME_TEST -P pager=off -c "SELECT name as installed_module FROM ir_module_module WHERE state = 'installed' ORDER BY name" + echo "🐘 🐘 Database dump ${CACHED_DUMP} found 🐘 🐘" + echo "Restore Database dump from cache matching MD5 📦⮕ 🐘" + psql -q -o /dev/null -d $DB_NAME_TEST -f "$CACHED_DUMP" + psql -d $DB_NAME_TEST -P pager=off -c "SELECT name as installed_module FROM ir_module_module WHERE state = 'installed' ORDER BY name" else - if [ "$LOAD_DB_CACHE" == "false" ]; then - echo "Dump cache load disabled." - else - echo "No cached dump found matching MD5 🐢 🐢 🐢" - fi - echo "🔨🔨 Install official/OCA modules 🔨🔨" - echo "${DEPS_ADDONS}" - odoo --stop-after-init --workers=0 --database $DB_NAME_TEST --log-level=warn --db-filter=$DB_NAME_TEST -i ${DEPS_ADDONS} - if [ "$CREATE_DB_CACHE" == "true" -a ! -z "$CACHED_DUMP" ]; then - echo "Generate dump $CACHED_DUMP into cache 🐘⮕ 📦" - mkdir -p "$CACHE_DIR" - pg_dump -Fp -d $DB_NAME_TEST -O -f "$CACHED_DUMP" - fi + if [ "$LOAD_DB_CACHE" == "false" ]; then + echo "Dump cache load disabled." + else + echo "No cached dump found matching MD5 🐢 🐢 🐢" + fi + echo "🔨🔨 Install official/OCA modules 🔨🔨" + echo "${DEPS_ADDONS}" + odoo --stop-after-init --workers=0 --database $DB_NAME_TEST --log-level=warn --db-filter=$DB_NAME_TEST -i ${DEPS_ADDONS} + if [ "$CREATE_DB_CACHE" == "true" -a ! -z "$CACHED_DUMP" ]; then + echo "Generate dump $CACHED_DUMP into cache 🐘⮕ 📦" + mkdir -p "$CACHE_DIR" + pg_dump -Fp -d $DB_NAME_TEST -O -f "$CACHED_DUMP" + fi fi echo "🔧🔧 Install odoo/addons modules 🔧🔧" odoo --stop-after-init --workers=0 --database $DB_NAME_TEST --test-enable --log-level=test --log-handler=":INFO" --db-filter=$DB_NAME_TEST -i ${LOCAL_ADDONS} diff --git a/build.sh b/build.sh index 20044811..e3345991 100755 --- a/build.sh +++ b/build.sh @@ -1,8 +1,5 @@ #!/bin/bash set -exo pipefail -if [ -z "$VERSION" ]; then - export VERSION=18.0 -fi if [ -z "$BUILD_TAG" ]; then export BUILD_TAG=odoo:${VERSION} fi @@ -24,11 +21,14 @@ if [ -z "$VERSION" ]; then exit 1 fi -if [ "$VERSION" = "14.0" ]; then - PYTHON_FROM="python:3.9-slim-trixie" -else - PYTHON_FROM="python:3.12-slim-trixie" -fi +case "$VERSION" in + "14.0") + PYTHON_FROM="python:3.9-slim-trixie" + ;; + *) + PYTHON_FROM="python:3.12-slim-trixie" + ;; +esac TMP=$(mktemp -d) echo "Working in $TMP" diff --git a/Dockerfile b/common/Dockerfile similarity index 100% rename from Dockerfile rename to common/Dockerfile diff --git a/MANIFEST.in b/common/MANIFEST.in similarity index 100% rename from MANIFEST.in rename to common/MANIFEST.in diff --git a/example/README.md b/example/README.md index 2befff63..7b6781d8 100644 --- a/example/README.md +++ b/example/README.md @@ -8,7 +8,7 @@ Follow the steps: 1. Create directories. This is mandatory, they will be copied in the image - mkdir -p odoo/addons data songs + mkdir -p odoo/addons data songs 2. Add a submodule for Odoo (official or OCA/OCB) @@ -25,7 +25,7 @@ Follow the steps: file](Dockerfile) that installs additional dependencies): FROM camptocamp/odoo-project:11.0 - MAINTAINER + LABEL maintainer="" ENV ADDONS_PATH=/odoo/odoo/addons,/odoo/external-src/server-tools,/odoo/src/odoo/addons diff --git a/example/docker-compose.yml b/example/docker-compose.yml index 91c39d86..774b056f 100644 --- a/example/docker-compose.yml +++ b/example/docker-compose.yml @@ -46,6 +46,7 @@ services: volumes: data-odoo: - data-db: # store pytest cache, allowing to use --lf or --ff (replay last or first failures) + data-db: + # store pytest cache, allowing to use --lf or --ff (replay last or first failures) data-odoo-pytest-cache: diff --git a/setup.sh b/setup.sh index 3ac97f2f..d5a260ec 100644 --- a/setup.sh +++ b/setup.sh @@ -20,8 +20,8 @@ fi SRC=${SRC:=(mktemp -d)} echo "Creating $SRC" -mkdir -p ${SRC} -cp Dockerfile MANIFEST.in ${SRC}/ +mkdir -p $SRC +cp -r common/. $SRC/ cp -r ${VERSION}/. $SRC/ cp -r bin/ $SRC cp -r install/ $SRC diff --git a/test.sh b/test.sh index 95ed61f6..ef09a619 100755 --- a/test.sh +++ b/test.sh @@ -15,17 +15,14 @@ set -Exeo pipefail # * VERSION (16.0, 17.0, ...) # * IMAGE_LATEST (tag of the 'latest' image built) # -# if VERSION is not set, we will use the default 18.0 + if [ -z "$VERSION" ]; then - export VERSION=18.0 + echo "VERSION environment variable is missing" + exit 1 fi if [ -z "$IMAGE_LATEST" ]; then export IMAGE_LATEST=odoo:${VERSION} fi -if [ -z "$VERSION" ]; then - echo "VERSION environment variable is missing" - exit 1 -fi ODOO_URL="https://github.com/odoo/odoo/archive/${VERSION}.tar.gz" @@ -61,6 +58,7 @@ docoruncmd() { } cp -ra ./example/. "$TMP/" + cd "$TMP" echo '>>> Downloading Odoo src'