diff --git a/.github/workflows/renovate-changelog.yaml b/.github/workflows/renovate-changelog.yaml new file mode 100644 index 0000000000..61bc6c02dd --- /dev/null +++ b/.github/workflows/renovate-changelog.yaml @@ -0,0 +1,61 @@ +name: Add Changelog Entry for Renovate PRs + +on: + pull_request: + types: [opened, synchronize] + branches: + - main + +jobs: + add-changelog: + if: startsWith(github.head_ref, 'renovate/sumologic-kubernetes-collection') + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + ref: ${{ github.head_ref }} + + - name: Create changelog entry + run: | + # Create PR-based filename + PR_NUMBER="${{ github.event.pull_request.number }}" + CHANGELOG_FILE=".changelog/${PR_NUMBER}.changed.txt" + + # Ensure .changelog directory exists + mkdir -p .changelog + + # Extract version information from git diff + OLD_VERSION="" + NEW_VERSION="" + + # Check for version changes in values.yaml + if git diff HEAD~1 HEAD -- deploy/helm/sumologic/values.yaml | grep -E "tag.*sumo-"; then + OLD_VERSION=$(git diff HEAD~1 HEAD -- deploy/helm/sumologic/values.yaml | grep -E "^\-.*tag:" | head -1 | sed 's/.*tag: *["'"'"']*\([^"'"'"' ]*\)["'"'"']*.*/\1/' | grep "sumo-" || echo "") + NEW_VERSION=$(git diff HEAD~1 HEAD -- deploy/helm/sumologic/values.yaml | grep -E "^\+.*tag:" | head -1 | sed 's/.*tag: *["'"'"']*\([^"'"'"' ]*\)["'"'"']*.*/\1/' | grep "sumo-" || echo "") + fi + + # Create changelog message + if [[ -n "$OLD_VERSION" && -n "$NEW_VERSION" ]]; then + CHANGELOG_TEXT="Upgraded otel collector version from $OLD_VERSION to $NEW_VERSION" + else + CHANGELOG_TEXT="chore(deps): Update dependencies" + fi + + echo "$CHANGELOG_TEXT" > "$CHANGELOG_FILE" + echo "Created changelog file: $CHANGELOG_FILE with content: $CHANGELOG_TEXT" + + - name: Commit changelog + run: | + # Configure git + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + + # Add and commit changelog + git add .changelog/ + git commit -m "chore: Add changelog entry for dependency update" + git push origin ${{ github.head_ref }} diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000000..12cc49d3d3 --- /dev/null +++ b/renovate.json @@ -0,0 +1,58 @@ +{ + "enabledManagers": ["custom.regex"], + "customManagers": [ + { + "customType": "regex", + "description": "Update Sumo Logic container images in values.yaml (repository/tag pattern)", + "fileMatch": ["^deploy/helm/sumologic/values\\.yaml$"], + "matchStrings": [ + "repository:\\s*\"?(?public\\.ecr\\.aws/sumologic/sumologic-otel-collector)\"?\\s*\\n\\s*tag:\\s*\"?(?[^\"\\s]+)\"?" + ], + "datasourceTemplate": "docker", + "versioningTemplate": "regex:^(?0)\\.(?[0-9]+)\\.(?[0-9]+)-sumo-(?[0-9]+)$" + }, + { + "customType": "regex", + "description": "Update Sumo Logic container images in test files", + "fileMatch": ["^tests/helm/testdata/goldenfile/.*\\.yaml$"], + "matchStrings": [ + "image:\\s*\"?(?public\\.ecr\\.aws/sumologic/sumologic-otel-collector):(?[a-zA-Z0-9._-]+)\"?" + ], + "datasourceTemplate": "docker", + "versioningTemplate": "regex:^(?0)\\.(?[0-9]+)\\.(?[0-9]+)-sumo-(?[0-9]+)$" + }, + { + "customType": "regex", + "description": "Update version references in documentation tables", + "fileMatch": ["^deploy/helm/sumologic/README\\.md$"], + "matchStrings": [ + "\\|\\s*`(sumologic\\.otelcolImage\\.tag|opentelemetry-operator\\.manager\\.collectorImage\\.tag)`\\s*\\|.*?\\|\\s*`(?[0-9.]+(?:-[a-z0-9-]+)?)`\\s*\\|" + ], + "datasourceTemplate": "docker", + "depNameTemplate": "public.ecr.aws/sumologic/sumologic-otel-collector", + "versioningTemplate": "regex:^(?0)\\.(?[0-9]+)\\.(?[0-9]+)-sumo-(?[0-9]+)$" + }, + { + "customType": "regex", + "description": "Update OpenTelemetry Collector version in docs README table", + "fileMatch": ["^docs/README\\.md$"], + "matchStrings": [ + "\\|\\s*OpenTelemetry Collector\\s*\\|\\s*(?[0-9]+\\.[0-9]+\\.[0-9]+)\\s*\\|" + ], + "datasourceTemplate": "docker", + "depNameTemplate": "public.ecr.aws/sumologic/sumologic-otel-collector", + "versioningTemplate": "loose", + "extractVersionTemplate": "^(?[0-9]+\\.[0-9]+\\.[0-9]+)" + } + ], + "packageRules": [ + { + "description": "Group OpenTelemetry Collector updates together", + "matchDatasources": ["docker"], + "matchPackageNames": ["public.ecr.aws/sumologic/sumologic-otel-collector"], + "groupName": "sumologic-kubernetes-collection", + "separateMinorPatch": false, + "allowedVersions": "/^0\\.[0-9]+\\.[0-9]+(\\-sumo\\-[0-9]+)?$/" + } + ] +}