Skip to content

Commit

Permalink
feat: Added Renovate to auto update helm-values and github-actions (#979
Browse files Browse the repository at this point in the history
)
  • Loading branch information
kvanzuijlen authored Feb 1, 2024
1 parent c60cc57 commit e2c1450
Show file tree
Hide file tree
Showing 32 changed files with 3,625 additions and 4,341 deletions.
6 changes: 0 additions & 6 deletions .github/dependabot.yml

This file was deleted.

80 changes: 80 additions & 0 deletions .github/renovate-config.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
$schema: "https://docs.renovatebot.com/renovate-schema.json",
onboarding: false,
requireConfig: "ignored",
platform: "github",
repositories: ["jenkinsci/helm-charts"],
allowedPostUpgradeCommands: ["^\.github\/renovate-postupgrade\.sh {{{depName}}} {{{newVersion}}}$"],
prConcurrentLimit: 0,
semanticCommits: "enabled",
enabledManagers: [
"helm-values",
"github-actions",
"regex",
],
packageRules: [
{
matchDepNames: ["jenkins/inbound-agent"],
versioning: "regex:^(?<major>\\d+)?\\.(?<minor>\\w+?)?_(?<patch>\\w+)?-(?<build>\\d+)?$",
},
{
matchDepNames: ["jenkins/jenkins"],
versioning: "regex:^(?<major>\\d+?)\\.(?<minor>\\d+?)\\.(?<patch>\\d+?)(-(?<compatibility>\\w+))?$",
},
{
matchFileNames: ["charts/jenkins/**"],
postUpgradeTasks: {
commands: [
".github/renovate-postupgrade.sh {{{depName}}} {{{newVersion}}}",
],
fileFilters: ["charts/jenkins/**"],
executionMode: "branch",
},
},
],
customManagers: [
{
customType: "regex",
fileMatch: ["(^|/)\\.github/workflows/[^/]+\\.ya?ml$", "(^|/)\\.github/[^/]+\\.sh$"],
matchStrings: [
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\s+?[\\w\\s-]*?version:? (?<currentValue>.*)\\s",
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\sENV .*?_VERSION=(?<currentValue>.*)\\s",
],
},
{
customType: "regex",
fileMatch: [
"^charts/jenkins/Chart.yaml$",
"^charts/jenkins/values.yaml$",
],
matchStrings: [
"appVersion: (?<currentValue>.*?)\\s",
'repository: \\"jenkins/jenkins\\"\\s*?# tag: \\"(?<currentValue>.*?)\\"',
],
depNameTemplate: "jenkins/jenkins",
datasourceTemplate: "docker",
},
{
customType: "regex",
fileMatch: ["^charts/jenkins/values.yaml$"],
matchStringsStrategy: "recursive",
matchStrings: [
"installPlugins:[\\s\\w:.-]*?(?:\\r*\\n){2}",
"- (?<depName>.*?):(?<currentValue>.*?)\\s",
],
datasourceTemplate: "jenkins-plugins",
versioningTemplate: "regex:^(?<major>\\d+)?\\.(?<minor>\\w+?)?(\\.(?<patch>\\d+?))?$",
},
{
customType: "regex",
fileMatch: ["^charts/jenkins/Chart.yaml$"],
matchStringsStrategy: "recursive",
matchStrings: [
"artifacthub\\.io\\/images: \\|[\\s\\w:.\\/-]*(?:artifacthub)",
"image: (?<depName>.*?):(?<currentValue>.*?)\\s",
],
datasourceTemplate: "docker",
versioningTemplate: "regex:^(?<major>\\d+)?\\.(?<minor>\\w+?)?(_|\\.)(?<patch>\\w+)?(-(?<build>\\d+))?.*",
},
],
}
34 changes: 34 additions & 0 deletions .github/renovate-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# renovate: datasource=github-tags depName=mikefarah/yq
export YQ_VERSION=v4.40.5

# renovate: datasource=github-tags depName=helm/helm
export HELM_VERSION=v3.14.0

# renovate: datasource=github-tags depName=helm-unittest/helm-unittest
export HELM_UNITTEST_VERSION=v0.3.6

# renovate: datasource=github-tags depName=jenkins-x-plugins/jx-release-version
export JENKINS_JX_VERSION=v2.7.3

apt update

apt install -y curl git

curl -fsSL -o /tmp/helm.tar.gz https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz
mkdir -p /tmp/helm && tar -xf /tmp/helm.tar.gz -C /tmp/helm
mv /tmp/helm/linux-amd64/helm /usr/local/bin/helm
chmod a+x /usr/local/bin/helm

runuser -u ubuntu -- helm plugin install https://github.com/helm-unittest/helm-unittest --version ${HELM_UNITTEST_VERSION}

curl -fsSL -o /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64
chmod a+x /usr/local/bin/yq

curl -fsSL -o /tmp/jx-release.tar.gz https://github.com/jenkins-x-plugins/jx-release-version/releases/download/${JENKINS_JX_VERSION}/jx-release-version-linux-amd64.tar.gz
mkdir -p /tmp/jx && tar -xf /tmp/jx-release.tar.gz -C /tmp/jx
mv /tmp/jx/jx-release-version /usr/local/bin/jx-release-version
chmod a+x /usr/local/bin/jx-release-version

runuser -u ubuntu renovate
10 changes: 10 additions & 0 deletions .github/renovate-postupgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

CHARTVERSION="$(jx-release-version -previous-version=from-file:charts/jenkins/Chart.yaml)"
export CHARTVERSION
export DEPNAME="$1"
export NEWVERSION="$2"

helm unittest --strict -f 'unittests/*.yaml' charts/jenkins -u
yq eval '.version = env(CHARTVERSION)' -i charts/jenkins/Chart.yaml
sed -i "/git commit to be able to get more details./a \\\n## ${CHARTVERSION}\n\nUpdate \`${DEPNAME}\` to version \`${NEWVERSION}\`" charts/jenkins/CHANGELOG.md
6 changes: 5 additions & 1 deletion .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,19 @@ jobs:
- name: Set up Helm
uses: azure/setup-helm@v3
with:
# renovate: datasource=github-tags depName=helm/helm
version: v3.12.0

- name: Set up Python
uses: actions/setup-python@v5
with:
# renovate: datasource=docker depName=python
python-version: 3.11.4

- name: Set up chart-testing
uses: helm/chart-testing-action@v2
with:
# renovate: datasource=github-tags depName=helm/chart-testing
version: v3.8.0

- name: Run chart-testing (list-changed)
Expand All @@ -50,7 +53,8 @@ jobs:
if: steps.list-changed.outputs.changed == 'true'
run: |
helm env
helm plugin install https://github.com/helm-unittest/helm-unittest --version 0.3.6
# renovate: datasource=github-tags depName=helm-unittest/helm-unittest
helm plugin install https://github.com/helm-unittest/helm-unittest --version v0.3.6
- name: Run chart-testing (lint)
run: ct lint --config ct.yaml
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/renovate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Renovate
on:
schedule:
- cron: "0/15 * * * *"
workflow_dispatch:

jobs:
renovate:
runs-on: ubuntu-latest
steps:
- name: Get token
id: get_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.JENKINS_DEPENDENCY_UPDATER_APP_ID }}
private_key: ${{ secrets.JENKINS_DEPENDENCY_UPDATER_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4

- name: Self-hosted Renovate
uses: renovatebot/[email protected]
with:
token: "${{ steps.get_token.outputs.token }}"
docker-cmd-file: .github/renovate-entrypoint.sh
docker-user: root
configurationFile: .github/renovate-config.json5
env:
LOG_LEVEL: 'debug'
77 changes: 0 additions & 77 deletions .github/workflows/sync-lts.yaml

This file was deleted.

1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ $ helm unittest --strict -f 'unittests/*.yaml' charts/jenkins
PASS PersistentVolumeClaim charts/jenkins/unittests/home-pvc-test.yaml
PASS Configuration as Code charts/jenkins/unittests/jcasc-config-test.yaml
PASS Jenkins Agent Service charts/jenkins/unittests/jenkins-agent-svc-test.yaml
PASS Jenkins Backup Cronjob charts/jenkins/unittests/jenkins-backup-cronjob-test.yaml
PASS Controller Prometheus PrometheusRule charts/jenkins/unittests/jenkins-controller-alerting-rules-test.yaml
PASS Controller Primary Ingress charts/jenkins/unittests/jenkins-controller-ingress-1.19-test.yaml
PASS Controller Primary Ingress charts/jenkins/unittests/jenkins-controller-ingress-test.yaml
Expand Down
8 changes: 7 additions & 1 deletion charts/jenkins/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ Use the following links to reference issues, PRs, and commits prior to v2.6.0.
The changelog until v1.5.7 was auto-generated based on git commits.
Those entries include a reference to the git commit to be able to get more details.

## 5.0.0

> [!CAUTION]
> Several fields have been renamed or removed. See [UPGRADING.md](./UPGRADING.md#to-500)
The Helm Chart is now updated automatically via [Renovate](https://docs.renovatebot.com/)

## 4.12.1

Update Jenkins image and appVersion to jenkins lts release version 2.426.3


## 4.12.0

Add support for [generic ephemeral storage](https://github.com/jenkinsci/kubernetes-plugin/pull/1489) in `agent.volumes` and `agents.workspaceVolume`.
Expand Down
4 changes: 1 addition & 3 deletions charts/jenkins/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: jenkins
home: https://jenkins.io/
version: 4.12.1
version: 5.0.0
appVersion: 2.426.3
description: Jenkins - Build great things at any scale! The leading open source automation server, Jenkins provides over 1800 plugins to support building, deploying and automating any project.
sources:
Expand Down Expand Up @@ -40,7 +40,5 @@ annotations:
image: kiwigrid/k8s-sidecar:1.24.4
- name: inbound-agent
image: jenkins/inbound-agent:3192.v713e3b_039fb_e-5
- name: backup
image: maorfr/kube-tasks:0.2.0
artifacthub.io/category: "integration-delivery"
artifacthub.io/license: "Apache-2.0"
Loading

0 comments on commit e2c1450

Please sign in to comment.