Skip to content

Commit f2236c4

Browse files
chore: added renovate bot for otel updates (#4029)
* added renovate bot for otel updates * update the pattern * updated the versioningTemplate * added changelog action * fix: Format renovate-changelog.yaml with Prettier
1 parent ae0fed7 commit f2236c4

File tree

2 files changed

+119
-0
lines changed

2 files changed

+119
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Add Changelog Entry for Renovate PRs
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
branches:
7+
- main
8+
9+
jobs:
10+
add-changelog:
11+
if: startsWith(github.head_ref, 'renovate/sumologic-kubernetes-collection')
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
ref: ${{ github.head_ref }}
22+
23+
- name: Create changelog entry
24+
run: |
25+
# Create PR-based filename
26+
PR_NUMBER="${{ github.event.pull_request.number }}"
27+
CHANGELOG_FILE=".changelog/${PR_NUMBER}.changed.txt"
28+
29+
# Ensure .changelog directory exists
30+
mkdir -p .changelog
31+
32+
# Extract version information from git diff
33+
OLD_VERSION=""
34+
NEW_VERSION=""
35+
36+
# Check for version changes in values.yaml
37+
if git diff HEAD~1 HEAD -- deploy/helm/sumologic/values.yaml | grep -E "tag.*sumo-"; then
38+
OLD_VERSION=$(git diff HEAD~1 HEAD -- deploy/helm/sumologic/values.yaml | grep -E "^\-.*tag:" | head -1 | sed 's/.*tag: *["'"'"']*\([^"'"'"' ]*\)["'"'"']*.*/\1/' | grep "sumo-" || echo "")
39+
NEW_VERSION=$(git diff HEAD~1 HEAD -- deploy/helm/sumologic/values.yaml | grep -E "^\+.*tag:" | head -1 | sed 's/.*tag: *["'"'"']*\([^"'"'"' ]*\)["'"'"']*.*/\1/' | grep "sumo-" || echo "")
40+
fi
41+
42+
# Create changelog message
43+
if [[ -n "$OLD_VERSION" && -n "$NEW_VERSION" ]]; then
44+
CHANGELOG_TEXT="Upgraded otel collector version from $OLD_VERSION to $NEW_VERSION"
45+
else
46+
CHANGELOG_TEXT="chore(deps): Update dependencies"
47+
fi
48+
49+
echo "$CHANGELOG_TEXT" > "$CHANGELOG_FILE"
50+
echo "Created changelog file: $CHANGELOG_FILE with content: $CHANGELOG_TEXT"
51+
52+
- name: Commit changelog
53+
run: |
54+
# Configure git
55+
git config --local user.email "action@github.com"
56+
git config --local user.name "GitHub Action"
57+
58+
# Add and commit changelog
59+
git add .changelog/
60+
git commit -m "chore: Add changelog entry for dependency update"
61+
git push origin ${{ github.head_ref }}

renovate.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"enabledManagers": ["custom.regex"],
3+
"customManagers": [
4+
{
5+
"customType": "regex",
6+
"description": "Update Sumo Logic container images in values.yaml (repository/tag pattern)",
7+
"fileMatch": ["^deploy/helm/sumologic/values\\.yaml$"],
8+
"matchStrings": [
9+
"repository:\\s*\"?(?<depName>public\\.ecr\\.aws/sumologic/sumologic-otel-collector)\"?\\s*\\n\\s*tag:\\s*\"?(?<currentValue>[^\"\\s]+)\"?"
10+
],
11+
"datasourceTemplate": "docker",
12+
"versioningTemplate": "regex:^(?<major>0)\\.(?<minor>[0-9]+)\\.(?<patch>[0-9]+)-sumo-(?<build>[0-9]+)$"
13+
},
14+
{
15+
"customType": "regex",
16+
"description": "Update Sumo Logic container images in test files",
17+
"fileMatch": ["^tests/helm/testdata/goldenfile/.*\\.yaml$"],
18+
"matchStrings": [
19+
"image:\\s*\"?(?<depName>public\\.ecr\\.aws/sumologic/sumologic-otel-collector):(?<currentValue>[a-zA-Z0-9._-]+)\"?"
20+
],
21+
"datasourceTemplate": "docker",
22+
"versioningTemplate": "regex:^(?<major>0)\\.(?<minor>[0-9]+)\\.(?<patch>[0-9]+)-sumo-(?<build>[0-9]+)$"
23+
},
24+
{
25+
"customType": "regex",
26+
"description": "Update version references in documentation tables",
27+
"fileMatch": ["^deploy/helm/sumologic/README\\.md$"],
28+
"matchStrings": [
29+
"\\|\\s*`(sumologic\\.otelcolImage\\.tag|opentelemetry-operator\\.manager\\.collectorImage\\.tag)`\\s*\\|.*?\\|\\s*`(?<currentValue>[0-9.]+(?:-[a-z0-9-]+)?)`\\s*\\|"
30+
],
31+
"datasourceTemplate": "docker",
32+
"depNameTemplate": "public.ecr.aws/sumologic/sumologic-otel-collector",
33+
"versioningTemplate": "regex:^(?<major>0)\\.(?<minor>[0-9]+)\\.(?<patch>[0-9]+)-sumo-(?<build>[0-9]+)$"
34+
},
35+
{
36+
"customType": "regex",
37+
"description": "Update OpenTelemetry Collector version in docs README table",
38+
"fileMatch": ["^docs/README\\.md$"],
39+
"matchStrings": [
40+
"\\|\\s*OpenTelemetry Collector\\s*\\|\\s*(?<currentValue>[0-9]+\\.[0-9]+\\.[0-9]+)\\s*\\|"
41+
],
42+
"datasourceTemplate": "docker",
43+
"depNameTemplate": "public.ecr.aws/sumologic/sumologic-otel-collector",
44+
"versioningTemplate": "loose",
45+
"extractVersionTemplate": "^(?<version>[0-9]+\\.[0-9]+\\.[0-9]+)"
46+
}
47+
],
48+
"packageRules": [
49+
{
50+
"description": "Group OpenTelemetry Collector updates together",
51+
"matchDatasources": ["docker"],
52+
"matchPackageNames": ["public.ecr.aws/sumologic/sumologic-otel-collector"],
53+
"groupName": "sumologic-kubernetes-collection",
54+
"separateMinorPatch": false,
55+
"allowedVersions": "/^0\\.[0-9]+\\.[0-9]+(\\-sumo\\-[0-9]+)?$/"
56+
}
57+
]
58+
}

0 commit comments

Comments
 (0)