odoo-sh-gitlab-ci
This package simplifies and automates the process of updating Odoo.sh branches by interacting with a GitLab repository while using a GitHub repository as a container for multiple repositories. It ensures seamless management of submodules and branch synchronization, making the deployment process more efficient and maintainable.
Installation
Install the package using pip:
pip install odoo-sh-gitlab-ci
Usage
The package provides a command-line tool odoo_sh_deploy that can be used in two modes:
- Initialization Mode (
--initialize): Prepares the environment by configuring the SSH agent, adding SSH keys, and setting up Git configurations. - Deployment Mode: Performs the actual deployment to Odoo.sh.
Setting Up variables.sh
To simplify the configuration of environment variables, you can create a file called variables.sh in the root of your repository. Define your variables in this file using the following format:
export PRIVATE_DEPLOY_KEY="your_private_ssh_key"
export GITHUB_REPO="git@github.com:youruser/yourrepo.git"
export GITHUB_REPO_NAME="yourrepo"
export VERSION="18.0"
Example variables.sh
export PRIVATE_DEPLOY_KEY="-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA1o9qX..."
export GITHUB_REPO="git@github.com:youruser/yourrepo.git"
export GITHUB_REPO_NAME="yourrepo"
export VERSION="18.0"
Important: For security reasons, it is recommended to define PRIVATE_DEPLOY_KEY as a protected variable in GitLab CI/CD settings instead of hardcoding it in the variables.sh file.
GitLab CI Configuration
To use odoo-sh-gitlab-ci in a GitLab CI pipeline, follow these steps:
-
Add the
variables.shfile to Your Repository: Ensure thevariables.shfile is located in the root of your repository. -
Update
.gitlab-ci.yml: Use the following configuration in your.gitlab-ci.yml:odoo_sh_deploy: stage: pre tags: - odoo before_script: - 'command -v ssh-agent >/dev/null || ( apk add --update openssh )' - eval $(ssh-agent -s) - source variables.sh - pip install --root-user-action ignore odoo-sh-gitlab-ci - odoo_sh_deploy --initialize script: - source variables.sh - odoo_sh_deploy
before_script: This section installs the package and initializes the environment using the--initializeflag.script: This section performs the deployment usingodoo_sh_deploy.
-
Example Pipeline Stages: Here’s a full example of a pipeline that uses
odoo-sh-gitlab-ci:stages: - pre odoo_sh_deploy: stage: pre tags: - odoo before_script: - 'command -v ssh-agent >/dev/null || ( apk add --update openssh )' - eval $(ssh-agent -s) - source variables.sh - pip install --root-user-action ignore odoo-sh-gitlab-ci - odoo_sh_deploy --initialize script: - source variables.sh - odoo_sh_deploy
License
This project is licensed under the AGPL-3.0 License.
Release files for odoo-sh-gitlab-ci 1.0.25
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| odoo_sh_gitlab_ci-1.0.25.tar.gz | 8.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| odoo_sh_gitlab_ci-1.0.25-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.5 kB
Release files / odoo_sh_gitlab_ci-1.0.25.tar.gz
| Download URL | odoo_sh_gitlab_ci-1.0.25.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
217b6de8a46899a53d09935744780cd9f11d2b208c863819b61f55f681a7a996
|
|
BLAKE2b-256 checksum How to use checksums |
7a73c3a5ac2ceac12ad7e21f1472f95cbed2d0f4b8adca5640e13f04978ec216
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Release files / odoo_sh_gitlab_ci-1.0.25-py3-none-any.whl
| Download URL | odoo_sh_gitlab_ci-1.0.25-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
abd660cbcba604e9d14759aa23cbeef139dcc5b1ae7e4764308010ea088aa731
|
|
BLAKE2b-256 checksum How to use checksums |
e16347fae55cef024b0f2ca2a0b02c287c94453a8d1efa9462324dd11a9761ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|