Add webhook

This commit is contained in:
SebClem 2021-12-06 16:11:12 +01:00
parent 29d283d341
commit 2ca81c05e4
No known key found for this signature in database
GPG Key ID: 3D8E353F900B1305
4 changed files with 46 additions and 2 deletions

View File

@ -8,4 +8,6 @@ renovate_git_endpoint: ""
renovate_git_token: "" renovate_git_token: ""
renovate_platform: gitea renovate_platform: gitea
renovate_github_token: "" renovate_github_token: ""
renovate_log_level: info renovate_log_level: info
renovate_bot_username: renovate-bot
renovate_webhook_secret: ""

View File

@ -1,2 +1,6 @@
--- ---
# handlers file for ansible-renovate-role # handlers file for ansible-renovate-role
- name: Restart webhook
service:
name: webhook
state: restarted

View File

@ -6,6 +6,11 @@
name: python3-pip name: python3-pip
state: present state: present
- name: Install webhook
package:
name: webhook
state: present
- name: Install requirements - name: Install requirements
pip: pip:
name: '{{ item.name }}' name: '{{ item.name }}'
@ -42,4 +47,13 @@
minute: "0" minute: "0"
job: "/etc/renovate/renovate" job: "/etc/renovate/renovate"
cron_file: renovate cron_file: renovate
user: root user: root
- name: add webhook conf
template:
src: webhook.conf.j2
dest: /etc/webhook.conf
owner: root
group: root
mode: u=rw,g=r,o=r
notify: Restart webhook

24
templates/webhook.conf.j2 Normal file
View File

@ -0,0 +1,24 @@
- id: renovate
execute-command: "/etc/renovate/renovate"
pass-arguments-to-command:
- source: string
name: --autodiscover
- source: string
name: false
- source: payload
name: repository.full_name
trigger-rule:
and:
- not:
match:
type: value
value: {{ renovate_bot_username }}
parameter:
source: payload
name: sender.login
- match:
type: value
value: {{ renovate_webhook_secret }}
parameter:
source: payload
name: secret