Skip to content

Commit

Permalink
feat(odoo_repos): clone with http
Browse files Browse the repository at this point in the history
  • Loading branch information
janikvonrotz committed Feb 6, 2025
1 parent 6ed6944 commit 9bfb9d3
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 7 deletions.
3 changes: 2 additions & 1 deletion roles/odoo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Deploy Odoo Docker container.
Configure the role.

```yml
# https://hub.docker.com/_/odoo/
# https://hub.docker.com/r/mintsystem/odoo/
odoo_revision: "16.0.20240603"
odoo_image: mintsystem/odoo:16.0.20240603
odoo_build_image: true # default: false
Expand Down Expand Up @@ -114,6 +114,7 @@ Once workers are active the longpolling port moves from 8069 to 8072 and therefo
Configure these vars when using the official Odoo image:

```yml
# https://hub.docker.com/_/odoo/
odoo_revision: "16.0.20240603"
odoo_image: odoo@sha256:df0276cdb0ff8bb7883058071daf898d90fdbf13045ae96d131584660878da84
odoo_conf: | # default: ""
Expand Down
13 changes: 13 additions & 0 deletions roles/odoo_repos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Configure the role.
odoo_data_dir: /usr/share/odoo # default: "/usr/share/{{ odoo_hostname }}"
odoo_revision: "16.0.20240603"
odoo_repo_key_file: /home/bot/.ssh/id_ed25519
github_personal_access_token: # default: "{{ vault_github_personal_access_token }}"
odoo_repos:
- path: enterprise
url: git@github.com:odoo/enterprise.git
Expand Down Expand Up @@ -39,6 +40,18 @@ The following tags are available:
## Docs
### Clone with http url
To clone private repos with an http url set the `vault_github_personal_access_token` var and define `github_username`. Use the following format to clone repos with http:

```yml
odoo_repos:
- path: enterprise
url: https://{{ github_username }}:{{ github_personal_access_token }}@github.com/odoo/enterprise.git
version: 8638ccc9cc26b997caee852e266b7ecc6f7c632a
```

### Pull repo manually

Navigate into the repo directory on the server `cd /usr/share/odoo01/enterprise` and run:
Expand Down
1 change: 1 addition & 0 deletions roles/odoo_repos/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
odoo_data_dir: /usr/share/{{ odoo_hostname }}
github_personal_access_token: "{{ vault_github_personal_access_token }}"
31 changes: 27 additions & 4 deletions roles/odoo_repos/tasks/odoo_repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ansible.builtin.debug:
msg: "Odoo version: {{ odoo_version }}"

- name: Pull repo branch
- name: Pull repo branch with ssh
ansible.builtin.git:
repo: "{{ item.url }}"
dest: "{{ odoo_data_dir }}/{{ item.path }}"
Expand All @@ -16,10 +16,10 @@
single_branch: "{{ item.single_branch | default(true) }}"
accept_hostkey: true
force: true
when: item.url is regex('git@')
when: item.url is regex('git@') and odoo_repo_key_file is defined
loop: "{{ odoo_repos }}"

- name: Checkout repo commit
- name: Checkout repo commit with ssh
ansible.builtin.git:
repo: "{{ item.url }}"
dest: "{{ odoo_data_dir }}/{{ item.path }}"
Expand All @@ -28,7 +28,30 @@
refspec: +refs/heads/{{ odoo_version }}:refs/remotes/origin/{{ odoo_version }}
accept_hostkey: true
force: true
when: item.url is regex('git@')
when: item.url is regex('git@') and odoo_repo_key_file is defined
loop: "{{ odoo_repos }}"
notify: Restart odoo container

- name: Pull repo branch with http
ansible.builtin.git:
repo: "{{ item.url }}"
dest: "{{ odoo_data_dir }}/{{ item.path }}"
version: "{{ odoo_version }}"
single_branch: "{{ item.single_branch | default(true) }}"
accept_hostkey: true
force: true
when: item.url is regex('https://') and github_username is defined
loop: "{{ odoo_repos }}"

- name: Checkout repo commit with http
ansible.builtin.git:
repo: "{{ item.url }}"
dest: "{{ odoo_data_dir }}/{{ item.path }}"
version: "{{ item.version }}"
refspec: +refs/heads/{{ odoo_version }}:refs/remotes/origin/{{ odoo_version }}
accept_hostkey: true
force: true
when: item.url is regex('https://') and github_username is defined
loop: "{{ odoo_repos }}"
notify: Restart odoo container

Expand Down
3 changes: 1 addition & 2 deletions roles/pushgateway/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ pushgateway_hostname: pushgateway01
pushgateway_args:
- --web.listen-address={{ pushgateway_port }}
#- --web.external-url=
- --web.route-prefix="/pushgateway"
- --web.route-prefix="/pushgateway"
- --persistence.file=/pushgateway/state

0 comments on commit 9bfb9d3

Please sign in to comment.