šŸ“„ Submodules

Submodules

02.11.2025

See https://github.com/loym-com/tools-odoo-sh

Script

The script will only work for branch named Staging.

nano ~/submodules.sh  # Paste the script below
# DO FIRST TIME
prepare() { git config --global user.email "henrik@loym.com" git config --global user.name "Henrik Norlin" mkdir -p ~/.ssh }
# STAGING: UPDATE ALL SUBMODULES update() { first git submodule update --init --remote git commit -am "git submodule update" git push --set-upstream origin Staging }

# STAGING: ADD ONE MODULE (not in OCA yet, therefore "beta") beta() { first gh_user=$1 gh_repo=$2 gh_branch=$3 module=$4 path=beta/.$module ln_target=.$module/$module ln_link=beta/$module url="git@github.com:$gh_user/$gh_repo.git" git submodule add -b $gh_branch $url $path && ln -s $ln_target $ln_link && git add --all && git commit -m "beta $module" && git push --set-upstream origin Staging }

# UPDATE() AND BETA() WILL DO THIS FIRST
first() { chmod 600 ~/.ssh/id_ed25519 eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_ed25519 cd ~/src/user git checkout Staging }
eval $@
chmod +x ~/update_submodules && bash ~/update_submodules prepare && nano -p ~/.ssh/id_ed25519
# Paste your private key
bash ~/update_submodules main

If you see this in the log:

modified:   my-user/my-repo (modified content)

Then do the command on the line below (replace my-user/my-repo and consider if you really want to reset):

cd ~/src/user/my-user/my-repo && git reset --hard && cd ~/src/user && bash ~/update_submodules main

Add submodules

odoo.sh user interface

Update submodules

First time

Create key pair, store them outside of odoo.sh and copy the public key into Github.

ssh-keygen -t ed25519 -C "your_email@example.com"
clip < ~/.ssh/id_ed25519  # Paste in a safe place
clip < ~/.ssh/id_ed25519.pub  # Paste in a safe place, and in https://github.com/settings/keys

New build

Prepare private key

nano ~/.ssh/id_ed25519  # Paste your private key
chmod 600 ~/.ssh/id_ed25519

Before updating submodules

Activate the private key

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

Update submodules and push to repo

Go to the repo of the odoo.sh project.

cd ~/src/user

Check that you are in the correct branch.

git branch

Switch to the branch you want to be in.

git checkout <branch name>

Update the submodules.

git submodule update --init --remote

See the result.

git status

Commit the changes.

git commit -am "git submodule update"

Push the latest commit to the repo.

git push

First push should be like this:

git push --set-upstream origin <branch name>

If git push was successful, the default behavior of odoo.sh is to update previous build.

In odoo.sh go to builds and see if a container is rebuilding.