feat(image): addons git repos

This commit is contained in:
Janik von Rotz committed 2025-03-06 17:09:28 +01:00
1 parent 7ce0060f84
commit e2bc176bb0
2 files changed
+12 -2

No files matched your search

+10 -1
View File
@@ -240,11 +240,20 @@ Define the mail configuration with these env vars:
The image can clone git repositories.
* `GIT_SSH_PUBLIC_KEY` Public key for SSH connection.
* `GIT_SSH_PRIVATE_KEY` Base64 encoded private key for SSH connection.
* `GIT_SSH_PRIVATE_KEY` Base64 encoded private key for SSH connection: `cat ~/.ssh/id_ed2551 | base64 -w0`
* `GITHUB_USERNAME` Username for git clone command with https.
* `GITHUB_PERSONAL_ACCESS_TOKEN` Token for git clone command with https.
* `ADDONS_GIT_REPOS` Comma seperated list of git clone urls appended with `#` and branch name.
You can use https and git urls for `ADDONS_GIT_REPOS`:
```bash
ADDON_GIT_REPO=git@github.com:OCA/server-tools.git#16.0,git@github.com:Mint-System/Odoo-Apps-Server-Tools.gi#16.0
ADDON_GIT_REPO=https://github.com/OCA/server-tools.git#16.0,https://github.com/Mint-System/Odoo-Apps-Server-Tools.gi#16.0
```
If you use git url a valid SSH private/public key is required.
### Addons Path
The entrypoint script searches for module folders in the addons path and creates a new addons path.
+2 -1
View File
@@ -30,10 +30,11 @@ if [ -n "$ADDONS_GIT_REPOS" ]; then
GIT_PATH=$(parse-url "$GIT_URL" path | sed 's/.git//g')
GIT_LOCAL_PATH="/var/lib/odoo/git/${GIT_HOSTNAME}/$GIT_PATH"
ssh-keyscan -t rsa,dsa "$GIT_HOSTNAME" > ~/.ssh/known_hosts 2>/dev/null
if [ ! -d "$GIT_LOCAL_PATH/.git" ]; then
# Clone git repo and submodules
mkdir -p "$GIT_LOCAL_PATH"
ssh-keyscan -t rsa,dsa "$GIT_HOSTNAME" > ~/.ssh/known_hosts 2>/dev/null
if [ "${GIT_PROTO}${GIT_HOSTNAME}" = "https://github.com" ] && [ -n "$GITHUB_USERNAME" ]; then
GIT_URL="${GIT_PROTO}${GITHUB_USERNAME}:${GITHUB_PERSONAL_ACCESS_TOKEN}@${GIT_HOSTNAME}/${GIT_PATH}.git"