Skip to main content

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:

  1. Add the variables.sh file to Your Repository: Ensure the variables.sh file is located in the root of your repository.

  2. 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 --initialize flag.
    • script: This section performs the deployment using odoo_sh_deploy.
  3. 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.23

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for odoo-sh-gitlab-ci 1.0.23
File Size Uploaded
odoo_sh_gitlab_ci-1.0.23.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for odoo-sh-gitlab-ci 1.0.23
File Interpreter ABI Platform
odoo_sh_gitlab_ci-1.0.23-py3-none-any.whl Python 3 none any Details

Total release size: 12.9 kB

Release files / odoo_sh_gitlab_ci-1.0.23.tar.gz

Download URL odoo_sh_gitlab_ci-1.0.23.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9355cadc6a29766049ec2f89ae2d4f76c9416e953bc0c938789075826a2ea12c
BLAKE2b-256 checksum
How to use checksums
837ed5912c7012eb020b8bec2df5e4c848f00fa5084041a007faa32069ebedca
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.23-py3-none-any.whl

Download URL odoo_sh_gitlab_ci-1.0.23-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
81371cd5b1010fe500c7301fc64bb1ef556808cbda72c9ed08d8cebbc17e2bee
BLAKE2b-256 checksum
How to use checksums
96f0347764de035fb5237ed07df2370e6a669d08958d1905eb87e6cf8c5ac6d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release history Release notifications | RSS feed

This release

1.0.23 This release

2 release files

1.0.22

2 release files

1.0.21

2 release files

1.0.20

2 release files

1.0.18

2 release files

1.0.17

2 release files

1.0.15

2 release files

1.0.14

1 release file

1.0.13

1 release file

1.0.12

1 release file

1.0.11

1 release file

1.0.10

1 release file

1.0.9

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page