From f66e03e51d2d603ab974784ee0b8560a300574ea Mon Sep 17 00:00:00 2001 From: David Kilias Date: Fri, 28 Jul 2023 20:29:15 +0200 Subject: [PATCH 1/4] add renovate to cron on pottwal --- host-pottwal.yml | 7 ++++- host_vars/pottwal.n39.eu/vars.yml | 5 ++++ host_vars/pottwal.n39.eu/vault | 47 ++++++++++++++++++------------ templates/pottwal/renovate-cron.j2 | 8 +++++ 4 files changed, 47 insertions(+), 20 deletions(-) create mode 100644 templates/pottwal/renovate-cron.j2 diff --git a/host-pottwal.yml b/host-pottwal.yml index f6db66c..4ddb125 100644 --- a/host-pottwal.yml +++ b/host-pottwal.yml @@ -529,6 +529,12 @@ proxy_preserve_host: "On" notify: Restart apache2 + - name: Ensure renovate bot cronjob is present + ansible.builtin.template: + src: templates/pottwal/renovate-cron.j2 + dest: /etc/cron.d/hourly/renovate.sh + mode: "0640" + handlers: - name: Restart prosody community.docker.docker_container: @@ -540,4 +546,3 @@ service: name: apache2 state: restarted - diff --git a/host_vars/pottwal.n39.eu/vars.yml b/host_vars/pottwal.n39.eu/vars.yml index 6e0662a..53b68c7 100644 --- a/host_vars/pottwal.n39.eu/vars.yml +++ b/host_vars/pottwal.n39.eu/vars.yml @@ -57,3 +57,8 @@ grafana_admin_password: "{{ vault_grafana_admin_password }}" homebox_host_port: 8092 homebox_domain_name: inventory.n39.eu homebox_image: ghcr.io/hay-kot/homebox:v0.9.2 + +renovate_image: renovate/renovate:36.25.0 +renovate_forgejo_pat: "{{ vault_renovate_forgejo_pat }}" +renovate_github_pat: "{{ vault_renovate_github_pat }}" +renovate_git_user: "Renovate Bot " \ No newline at end of file diff --git a/host_vars/pottwal.n39.eu/vault b/host_vars/pottwal.n39.eu/vault index 422b1e7..25d8476 100644 --- a/host_vars/pottwal.n39.eu/vault +++ b/host_vars/pottwal.n39.eu/vault @@ -1,20 +1,29 @@ $ANSIBLE_VAULT;1.1;AES256 -35323634353263613464653863633861303539636238333464653633653164353632306233626231 -3766386232326433383932636136313831346131336335360a383639643334613033336134373566 -36343465336365363732363931383031356532336235313537396338316465366537313032616261 -6634393966623662390a383335316661613332633165333936396335666637306163363133323363 -33613639306537396136643438623937363336376332353634333130313434623433303264393461 -38663337396465343937396438333261393463303866306234323138396563653837373334356239 -64653231633066656662306530656139316530316263356135363538303061646432353338323237 -66663161333133313762366261343434666238376537636433313461343065646565633130333061 -33376537316338666662643639623637396366336263656537326363663936616234343235373636 -33373039373033333533363366356435633863633434643963633664613238363961363733366437 -61353936613065303230616239646334313130636133653461663561303037383663643761376235 -33303661663063613635306438613738613064386466656430343130356131663262353239326334 -63323630333466356263646162336437646133616565353430313737313332363330663236383830 -33366138303665386561393136616238346335633163313330386434323239623736333562363862 -66636165373264353132626232633537613536303362366535653438303261323735666331363439 -61613939373333616364303134353437333965386239623933393932373434666234373736316166 -63373935356162326230653437643030313262373965353831396361646136663938336334646633 -65313166613131396665393363633166663137363564393063363330366364373936643831373030 -333465303435636163616236306264646666 +65353165303639396537626136366637383534393738646531386430633363663839303830353436 +3831356138383062346161386134366463356137366430330a376266333533343863626230643938 +63396435383064306565636266373534653430393537386436653639326664626639316664303734 +3564323135343866360a633235353935343335633633653737303666303832613933373064623666 +37633135623730653561653833643830323938316430373963343139613662643666363063666437 +30666461383832613764623463393032326530373532313434623834316330353163346231373232 +39353931373338636230363564656563313230613362633065303036656365346333633261383262 +30343264306631393664373563366363323233376338326630353731306264303539626462386236 +30303964613563306164313331313430666336616265633963393737633537653361306135306166 +65333331346338643030653833356661333732643932393938613464626562313864323938353466 +33626165386431643733303238636432386365623263626137636235373166393763613563306162 +35333331376138663739396534633062646338393331356164353966616433326364386362646466 +36646561626266396665643336636333613637333964316430313536316463663333646566646538 +30303736626333323931313065363165316262363833363966306334383263636461623639376666 +35653235303437303263363261376261303563653662366465316630383330666335396636646132 +62616362383531633033333830633661326532653432373266653432393662363161343137393431 +37306262386565386539353136373862333333663336323666373961613661333336303935386661 +33303063346536633732666364626233623835386534363064326638363565303638306134613834 +64313862343632616639343739343830333834363731663239613935386362373934666662383338 +36343431376661663564346666346631333965356364343538313235373836653539343062366362 +65356335383334383732323264366535383430613635396461653638643535313665663638646165 +63363730646130653964616435306564306431393464633536653633326237353931353264386232 +38613836346536646234393662303330363135633666646338643734666363393264366330333436 +30373931613636643839316465363532626364623730643335313739656534646635326238623137 +33626530343366373861636566623037613239343264633230346537303062356161666137306135 +63353636363237663930386237643161643535663064303038353361333462346139616262323438 +39383363346639306632633135306631343939336230383133613163333639636264616164663737 +62306134616665636337 diff --git a/templates/pottwal/renovate-cron.j2 b/templates/pottwal/renovate-cron.j2 new file mode 100644 index 0000000..70ad8b0 --- /dev/null +++ b/templates/pottwal/renovate-cron.j2 @@ -0,0 +1,8 @@ +#!/bin/bash +docker run --rm \ + -e RENOVATE_TOKEN={{ renovate_forgejo_pat }} \ + -e RENOVATE_ENDPOINT=https://{{ forgejo_domain_name }}/api/v1 \ + -e RENOVATE_PLATFORM=gitea \ + -e RENOVATE_GIT_AUTHOR={{ renovate_git_user }} \ + -e GITHUB_COM_TOKEN={{ renovate_github_pat }} \ + {{ renovate_image }} --autodiscover \ No newline at end of file From 8e1b6445cb50b2ae15f3a1ba29221cae26945532 Mon Sep 17 00:00:00 2001 From: David Kilias Date: Fri, 28 Jul 2023 21:11:12 +0200 Subject: [PATCH 2/4] fix: use correct cronscript location --- host-pottwal.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/host-pottwal.yml b/host-pottwal.yml index 4ddb125..78e9af4 100644 --- a/host-pottwal.yml +++ b/host-pottwal.yml @@ -532,8 +532,8 @@ - name: Ensure renovate bot cronjob is present ansible.builtin.template: src: templates/pottwal/renovate-cron.j2 - dest: /etc/cron.d/hourly/renovate.sh - mode: "0640" + dest: /etc/cron.hourly/renovate-bot + mode: "0700" handlers: - name: Restart prosody From 856255b7c699bf62202c461ab0613058b2c46ed0 Mon Sep 17 00:00:00 2001 From: David Kilias Date: Fri, 28 Jul 2023 21:12:02 +0200 Subject: [PATCH 3/4] fi: quote git user name to resolve bash parsing issues --- templates/pottwal/renovate-cron.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/pottwal/renovate-cron.j2 b/templates/pottwal/renovate-cron.j2 index 70ad8b0..74a2874 100644 --- a/templates/pottwal/renovate-cron.j2 +++ b/templates/pottwal/renovate-cron.j2 @@ -3,6 +3,6 @@ docker run --rm \ -e RENOVATE_TOKEN={{ renovate_forgejo_pat }} \ -e RENOVATE_ENDPOINT=https://{{ forgejo_domain_name }}/api/v1 \ -e RENOVATE_PLATFORM=gitea \ - -e RENOVATE_GIT_AUTHOR={{ renovate_git_user }} \ + -e RENOVATE_GIT_AUTHOR={{ renovate_git_user | quote }} \ -e GITHUB_COM_TOKEN={{ renovate_github_pat }} \ {{ renovate_image }} --autodiscover \ No newline at end of file From 3a6efe1f0277c65910fe69c572edda5264c05e3d Mon Sep 17 00:00:00 2001 From: David Kilias Date: Sat, 29 Jul 2023 01:44:30 +0200 Subject: [PATCH 4/4] add handler to restart cron service after on cronjob change --- host-pottwal.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/host-pottwal.yml b/host-pottwal.yml index 78e9af4..5816f36 100644 --- a/host-pottwal.yml +++ b/host-pottwal.yml @@ -534,6 +534,7 @@ src: templates/pottwal/renovate-cron.j2 dest: /etc/cron.hourly/renovate-bot mode: "0700" + notify: reload cron handlers: - name: Restart prosody @@ -546,3 +547,12 @@ service: name: apache2 state: restarted + + - name: reload cron + ansible.builtin.shell: + cmd: service cron reload + warn: no + # Use the shell call because the task sometimes has problems finding the service state + # service: + # name: cron + # state: restarted \ No newline at end of file