From 118c905bfb22b8e7117c5ea3c178bb8714d2f81a Mon Sep 17 00:00:00 2001 From: Kjeld Schouten Date: Sat, 18 Nov 2023 14:55:04 +0100 Subject: [PATCH] feat(ci): handle renovate container bumping from within renovate --- .github/renovate-config.js | 80 ++++++++++++++++++++++++++++++++------ 1 file changed, 69 insertions(+), 11 deletions(-) diff --git a/.github/renovate-config.js b/.github/renovate-config.js index ee1ba762a7a..75598b15a20 100644 --- a/.github/renovate-config.js +++ b/.github/renovate-config.js @@ -5,19 +5,77 @@ module.exports = { onboarding: false, platform: "github", repositories: ["truecharts/charts"], + allowPostUpgradeCommandTemplating: true, + allowedPostUpgradeCommands: ["^.*"], + regexManagers: [ + { + fileMatch: ["(^|/)Chart\\.yaml$"], + matchStrings: [ + '#\\s?renovate: image=(?.*?)\\s?appVersion:\\s?\\"?(?[\\w+\\.\\-]*)', + ], + datasourceTemplate: "docker", + }, + ], packageRules: [ { - description: "lockFileMaintenance", - matchUpdateTypes: [ - "pin", - "digest", - "patch", - "minor", - "major", - "lockFileMaintenance", - ], - dependencyDashboardApproval: false, - stabilityDays: 0, + matchManagers: ["helm-requirements", "helm-values", "regex"], + datasources: ["docker"], + matchUpdateTypes: ["major"], + postUpgradeTasks: { + commands: [ + `version=$(grep '^version:' {{{parentDir}}}/Chart.yaml | awk '{print $2}') + major=$(echo $version | cut -d. -f1) + minor=$(echo $version | cut -d. -f2) + patch=$(echo $version | cut -d. -f3) + major=$(expr $minor + 1) + echo "Replacing $version with $major.$minor.$patch" + sed -i "s/^version:.*/version: $\{major\}.$\{minor\}.$\{patch\}/g" {{{parentDir}}}/Chart.yaml + cat {{{parentDir}}}/Chart.yaml + `, + ], + }, + fileFilters: ["**/Chart.yaml"], + executionMode: "branch", + }, + { + matchManagers: ["helm-requirements", "helm-values", "regex"], + datasources: ["docker"], + matchUpdateTypes: ["minor"], + postUpgradeTasks: { + commands: [ + `version=$(grep '^version:' {{{parentDir}}}/Chart.yaml | awk '{print $2}') + major=$(echo $version | cut -d. -f1) + minor=$(echo $version | cut -d. -f2) + patch=$(echo $version | cut -d. -f3) + minor=$(expr $minor + 1) + echo "Replacing $version with $major.$minor.$patch" + sed -i "s/^version:.*/version: $\{major\}.$\{minor\}.$\{patch\}/g" {{{parentDir}}}/Chart.yaml + cat {{{parentDir}}}/Chart.yaml + `, + ], + }, + fileFilters: ["**/Chart.yaml"], + executionMode: "branch", + }, + { + matchManagers: ["helm-requirements", "helm-values", "regex"], + datasources: ["docker"], + matchUpdateTypes: ["patch", "digest", "pin"], + postUpgradeTasks: { + commands: [ + `version=$(grep '^version:' {{{parentDir}}}/Chart.yaml | awk '{print $2}') + major=$(echo $version | cut -d. -f1) + minor=$(echo $version | cut -d. -f2) + patch=$(echo $version | cut -d. -f3) + patch=$(expr $minor + 1) + echo "Replacing $version with $major.$minor.$patch" + sed -i "s/^version:.*/version: $\{major\}.$\{minor\}.$\{patch\}/g" {{{parentDir}}}/Chart.yaml + cat {{{parentDir}}}/Chart.yaml + `, + ], + }, + fileFilters: ["**/Chart.yaml"], + executionMode: "branch", }, ], };