Skip to main content

Simplify and automate Odoo.sh deployment using GitLab and GitHub.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odoo_sh_gitlab_ci-1.0.21.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

odoo_sh_gitlab_ci-1.0.21-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file odoo_sh_gitlab_ci-1.0.21.tar.gz.

File metadata

  • Download URL: odoo_sh_gitlab_ci-1.0.21.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for odoo_sh_gitlab_ci-1.0.21.tar.gz
Algorithm Hash digest
SHA256 826b6ee200c87e8fa374040e070901c0eaef6c5b2a1990b0d1ce4fbf89ba9a6b
MD5 709343796f70141555a5e9731d2a9c22
BLAKE2b-256 78e5b6506390d0c21d2cc7215373fa4b6e98148de0d2e5b64284ecdcf3613ae1

See more details on using hashes here.

File details

Details for the file odoo_sh_gitlab_ci-1.0.21-py3-none-any.whl.

File metadata

File hashes

Hashes for odoo_sh_gitlab_ci-1.0.21-py3-none-any.whl
Algorithm Hash digest
SHA256 e7a9c69969dade1ffe0c14209af7be116eebd4e23fe6b6a6cb0a7386bf74fb74
MD5 66b97c7b110558402ad69dd9dd3715a6
BLAKE2b-256 831054d07965f029ab067b617336d8c27594d560d360caaa49c244923fd8de55

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page