-
Notifications
You must be signed in to change notification settings - Fork 176
feat(deps): add Dependabot configuration for automated Go dependency updates #3477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,268 @@ | ||||||
| # Dependabot Configuration Guide | ||||||
|
|
||||||
| This document explains how Dependabot is configured for this repository and how it works. | ||||||
|
|
||||||
| ## What is Dependabot? | ||||||
|
|
||||||
| Dependabot is a GitHub native tool that automatically: | ||||||
| - Scans dependencies for security vulnerabilities | ||||||
| - Creates pull requests to update dependencies | ||||||
| - Keeps dependencies up-to-date with minimal manual intervention | ||||||
|
|
||||||
| ## Current Configuration | ||||||
|
|
||||||
| We have Dependabot configured for **Go modules only** (main module at `/`). | ||||||
|
|
||||||
| ### Update Schedule | ||||||
|
|
||||||
| - **Day**: Monday | ||||||
| - **Time**: 09:00 AM Eastern Time | ||||||
| - **Frequency**: Weekly | ||||||
|
|
||||||
| ### What Gets Updated | ||||||
|
|
||||||
| 1. **Direct dependencies** - all packages listed in `require` section of `go.mod` (all updates) | ||||||
| 2. **Indirect dependencies** - transitive dependencies from `go.sum` (all updates) | ||||||
|
|
||||||
| Security vulnerabilities in both direct and indirect dependencies are always updated, regardless of configuration. | ||||||
|
|
||||||
| ## How Dependabot Works | ||||||
|
|
||||||
| ### 1. Automatic PR Creation | ||||||
|
|
||||||
| Every Monday morning, Dependabot: | ||||||
| 1. Scans `go.mod` and `go.sum` files | ||||||
| 2. Checks for available updates | ||||||
| 3. Groups related updates together (see grouping strategy below) | ||||||
| 4. Creates PRs with: | ||||||
| - Updated `go.mod` and `go.sum` | ||||||
| - Changelog links | ||||||
| - Release notes | ||||||
| - Compatibility score | ||||||
|
|
||||||
| ### 2. Grouping Strategy | ||||||
|
|
||||||
| To reduce PR noise, updates are grouped: | ||||||
|
|
||||||
| | Group | Pattern | Update Types | Description | | ||||||
| |-------|---------|--------------|-------------| | ||||||
| | `aws-sdk` | `github.com/aws/aws-sdk-go-v2*` | minor, patch | AWS SDK updates together | | ||||||
| | `k8s-ecosystem` | `k8s.io/*`, `sigs.k8s.io/*`, `github.com/openshift/*` | minor, patch | Kubernetes/OpenShift deps together | | ||||||
| | `testing` | `github.com/onsi/ginkgo*`, `github.com/onsi/gomega*` | minor, patch | Test framework updates together | | ||||||
| | `opentelemetry` | `go.opentelemetry.io/otel*` | minor, patch | OpenTelemetry deps together | | ||||||
| | `golang-x` | `golang.org/x/*` | minor, patch | Go extended libraries together | | ||||||
| | `go-openapi` | `github.com/go-openapi/*` | minor, patch | OpenAPI libraries together | | ||||||
| | `patch-updates` | `*` | patch | All remaining patch updates (evaluated last) | | ||||||
|
|
||||||
| **Major version updates** are always created as individual PRs for careful review. | ||||||
|
|
||||||
| ### 3. Pull Request Metadata | ||||||
|
|
||||||
| Each Dependabot PR includes: | ||||||
| - **Labels**: `dependencies`, `go`, `automated` | ||||||
| - **Reviewers**: Team members from OWNERS file (jcantrill, vparfonov, Clee2691) | ||||||
| - **Assignees**: jcantrill (for tracking) | ||||||
| - **Commit message**: Prefixed with `chore(deps):` for consistency | ||||||
| - **Auto-rebase**: Enabled (see conflict resolution below) | ||||||
|
|
||||||
| ### 4. PR Limits | ||||||
|
|
||||||
| Maximum of **10 open PRs** at any time to prevent overwhelming the review queue. | ||||||
|
|
||||||
| ## Conflict Resolution | ||||||
|
|
||||||
| ### Automatic Rebase | ||||||
|
|
||||||
| Dependabot has `rebase-strategy: "auto"` enabled, which means: | ||||||
|
|
||||||
| 1. **When base branch changes**: Dependabot automatically rebases its PRs | ||||||
| 2. **When conflicts occur**: Dependabot will: | ||||||
| - Attempt to auto-rebase | ||||||
| - If rebase succeeds: Updates the PR automatically | ||||||
| - If rebase fails: Closes the PR and recreates it on next run | ||||||
|
|
||||||
|
Comment on lines
+82
to
+83
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: set -eu
printf '%s\n' '--- cited documentation ---'
sed -n '68,102p' .github/DEPENDABOT.md
printf '%s\n' '--- repository Dependabot files ---'
git ls-files '.github/*dependabot*' '.github/*DEPENDABOT*'
printf '%s\n' '--- failed-rebase and recreation references ---'
rg -n -i --glob '!node_modules' --glob '!dist' 'failed rebase|rebase fails|recreate|dependabot.*rebase|rebase.*dependabot|close.*pull request|pull request.*recreate' .github README.md 2>/dev/null || true
printf '%s\n' '--- relevant Dependabot configuration ---'
if [ -f .github/dependabot.yml ]; then cat -n .github/dependabot.yml; fiRepository: openshift/cluster-logging-operator Length of output: 5313 🌐 Web query:
💡 Result: <source_evidence> Citations:
Replace the automatic failed-rebase claim with a supported manual procedure.
🤖 Prompt for AI AgentsSource: MCP tools |
||||||
| ### Handling Merge Conflicts | ||||||
|
|
||||||
| **Scenario 1: Clean rebase** | ||||||
| ``` | ||||||
| Base branch updated → Dependabot rebases → PR auto-updates → Ready for merge | ||||||
| ``` | ||||||
|
|
||||||
| **Scenario 2: Rebase conflict** | ||||||
| ``` | ||||||
| Base branch updated → Dependabot rebase fails → PR closed → New PR created next Monday | ||||||
| ``` | ||||||
|
|
||||||
| **Manual intervention needed when:** | ||||||
| - Custom changes were made to dependency versions in `go.mod` | ||||||
| - Lock file (`go.sum`) has manual modifications | ||||||
| - Multiple competing dependency updates | ||||||
|
|
||||||
| ### Manual Conflict Resolution | ||||||
|
|
||||||
| If you need to manually resolve conflicts in a Dependabot PR: | ||||||
|
|
||||||
| ```bash | ||||||
| # 1. Checkout the PR branch | ||||||
| gh pr checkout <PR-number> | ||||||
|
|
||||||
| # 2. Rebase on master | ||||||
| git rebase master | ||||||
|
|
||||||
| # 3. Resolve conflicts in go.mod/go.sum | ||||||
| # Edit files as needed | ||||||
|
|
||||||
| # 4. Continue rebase | ||||||
| git add go.mod go.sum | ||||||
| git rebase --continue | ||||||
|
|
||||||
| # 5. Force push (Dependabot will detect and accept it) | ||||||
| git push --force-with-lease | ||||||
| ``` | ||||||
|
|
||||||
| **Note**: You can also comment `@dependabot rebase` on the PR to trigger a rebase. | ||||||
|
|
||||||
| ## Dependabot Commands | ||||||
|
|
||||||
| You can interact with Dependabot via PR comments: | ||||||
|
|
||||||
| | Command | Description | | ||||||
| |---------|-------------| | ||||||
| | `@dependabot rebase` | Rebase the PR against the base branch | | ||||||
| | `@dependabot recreate` | Recreate the PR from scratch | | ||||||
| | `@dependabot merge` | Merge the PR (if CI passes) | | ||||||
| | `@dependabot squash and merge` | Squash and merge the PR | | ||||||
| | `@dependabot cancel merge` | Cancel a previous merge request | | ||||||
| | `@dependabot reopen` | Reopen a closed PR | | ||||||
| | `@dependabot close` | Close the PR and ignore future updates | | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🌐 Web query:
💡 Result: <source_evidence> Citations:
🏁 Script executed: sed -n '125,145p' .github/DEPENDABOT.mdRepository: openshift/cluster-logging-operator Length of output: 1015 Remove the obsolete Current GitHub documentation no longer supports Suggested fix-| `@dependabot close` | Close the PR and ignore future updates |📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| | `@dependabot ignore this dependency` | Never update this dependency again | | ||||||
| | `@dependabot ignore this major version` | Ignore updates to this major version | | ||||||
| | `@dependabot ignore this minor version` | Ignore updates to this minor version | | ||||||
|
|
||||||
| ## Reviewing Dependabot PRs | ||||||
|
|
||||||
| ### Quick Review Checklist | ||||||
|
|
||||||
| 1. **Check CI status**: All tests must pass | ||||||
| 2. **Review changelog**: Click through to release notes | ||||||
| 3. **Check compatibility**: Look at the compatibility score | ||||||
| 4. **Security updates**: Prioritize these | ||||||
| 5. **Breaking changes**: Review carefully for major versions | ||||||
| 6. **Run vulnerability scan**: `make lint-vuln` to verify fixes | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n -C 3 '(^|\s)(lint-vuln|lint|lint-repo):|govulncheck|^include ' MakefileRepository: openshift/cluster-logging-operator Length of output: 781 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- documentation ---'
cat -n .github/DEPENDABOT.md | sed -n '140,175p;240,262p'
printf '%s\n' '--- makefile and included definitions ---'
find . -path '*/Makefile' -o -path '*/Variables.mk' | sort
rg -n -C 4 '(^|[[:space:]])(lint-vuln|lint|lint-repo|vuln|govulncheck)[[:space:]]*:|govulncheck|^include[[:space:]]' --glob 'Makefile' --glob 'Variables.mk' --glob '*.mk' .Repository: openshift/cluster-logging-operator Length of output: 3454 🏁 Script executed: set -euo pipefail
printf '%s\n' '--- documentation ---'
cat -n .github/DEPENDABOT.md | sed -n '140,175p;240,262p'
printf '%s\n' '--- makefile files ---'
find . -type f \( -name 'Makefile' -o -name 'Variables.mk' -o -name '*.mk' \) -print | sort
printf '%s\n' '--- vulnerability targets and scanner ---'
rg -n -C 4 '(^|[[:space:]])(lint-vuln|lint|lint-repo|vuln)[[:space:]]*:|govulncheck|^include[[:space:]]' --glob 'Makefile' --glob 'Variables.mk' --glob '*.mk' .Repository: openshift/cluster-logging-operator Length of output: 3477 Use supported vulnerability-scan commands.
Define 🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it't done here #3475 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
repo="openshift/cluster-logging-operator"
pr_number="3475"
gh pr view "$pr_number" --repo "$repo" --json number,state,mergedAt,url,title,files
printf '\n--- .github/DEPENDABOT.md patch ---\n'
gh api "repos/$repo/pulls/$pr_number/files?per_page=100" --paginate \
--jq '.[] | select(.filename == ".github/DEPENDABOT.md") | .patch'Length of output: 1164 🏁 Script executed: #!/bin/bash
set -euo pipefail
repo="openshift/cluster-logging-operator"
pr_number="3475"
gh api "repos/$repo/pulls/$pr_number/files?per_page=100" --paginate \
--jq '.[] | select(.filename == "Makefile" or .filename == ".bingo/Variables.mk" or .filename == ".bingo/variables.env") | "\n--- \(.filename) ---\n\(.patch)"'Length of output: 3654
It defines
You are interacting with an AI system. |
||||||
|
|
||||||
| ### Security Updates | ||||||
|
|
||||||
| Security updates are labeled and should be prioritized: | ||||||
| - Review the CVE details in the PR description | ||||||
| - Verify with `govulncheck -show color,verbose ./...` | ||||||
| - Merge quickly after CI passes | ||||||
|
|
||||||
| ### Testing Dependabot Updates | ||||||
|
|
||||||
| ```bash | ||||||
| # 1. Checkout the PR | ||||||
| gh pr checkout <PR-number> | ||||||
|
|
||||||
| # 2. Run full test suite | ||||||
| make check | ||||||
|
|
||||||
| # 3. Run vulnerability scan | ||||||
| make lint-vuln | ||||||
|
|
||||||
| # 4. Build and test locally | ||||||
| make build | ||||||
| make test-unit | ||||||
| ``` | ||||||
|
|
||||||
| ## Troubleshooting | ||||||
|
|
||||||
| ### PR Keeps Getting Recreated | ||||||
|
|
||||||
| **Cause**: Base branch has incompatible changes | ||||||
|
|
||||||
| **Solution**: | ||||||
| 1. Manually merge the PR with conflict resolution | ||||||
| 2. Or ignore the dependency: `@dependabot ignore this dependency` | ||||||
|
|
||||||
| ### Too Many PRs | ||||||
|
|
||||||
| **Cause**: Multiple dependencies have updates | ||||||
|
|
||||||
| **Solutions**: | ||||||
| 1. Merge compatible PRs in batches | ||||||
| 2. Reduce `open-pull-requests-limit` in config | ||||||
| 3. Adjust grouping strategy to be more aggressive | ||||||
|
|
||||||
| ### CI Fails on Dependabot PR | ||||||
|
|
||||||
| **Common causes**: | ||||||
| - Breaking API changes in dependency | ||||||
| - Test compatibility issues | ||||||
| - Transitive dependency conflicts | ||||||
|
|
||||||
| **Solutions**: | ||||||
| 1. Check dependency changelog for breaking changes | ||||||
| 2. Update calling code if needed | ||||||
| 3. Pin to previous version if update is incompatible | ||||||
| 4. Comment `@dependabot ignore this major version` | ||||||
|
|
||||||
| ### Dependabot Not Creating PRs | ||||||
|
|
||||||
| **Check**: | ||||||
| 1. Is Dependabot enabled for the repo? (Settings → Security → Dependabot) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🌐 Web query:
💡 Result: <source_evidence> Citations:
🏁 Script executed: sed -n '206,216p' .github/DEPENDABOT.mdRepository: openshift/cluster-logging-operator Length of output: 577 🌐 Web query:
💡 Result: <source_evidence> Citations:
Update the Dependabot settings path. The documented path omits Advanced Security. GitHub UI variants place it under either Security and quality or Security. Suggested fix-1. Is Dependabot enabled for the repo? (Settings → Security → Dependabot)
+1. Is Dependabot enabled for the repo? (Settings → Security and quality → Advanced Security → Dependabot; some views use Settings → Security → Advanced Security → Dependabot)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| 2. Are there existing PRs at the limit? (default: 10) | ||||||
| 3. Check Dependabot logs: Repository → Insights → Dependency graph → Dependabot | ||||||
|
|
||||||
| ## Disabling Updates for Specific Dependencies | ||||||
|
|
||||||
| If a dependency should not be auto-updated (e.g., pinned for compatibility): | ||||||
|
|
||||||
| **Option 1**: Via PR comment | ||||||
| ``` | ||||||
| @dependabot ignore this dependency | ||||||
| ``` | ||||||
|
|
||||||
| **Option 2**: Via config file | ||||||
| ```yaml | ||||||
| updates: | ||||||
| - package-ecosystem: "gomod" | ||||||
| directory: "/" | ||||||
| ignore: | ||||||
| - dependency-name: "github.com/example/package" | ||||||
| # Ignore all updates | ||||||
| - dependency-name: "k8s.io/client-go" | ||||||
| # Ignore only major version updates | ||||||
| update-types: ["version-update:semver-major"] | ||||||
| ``` | ||||||
|
|
||||||
| ## Best Practices | ||||||
|
|
||||||
| 1. **Review weekly**: Set aside time Monday afternoons to review Dependabot PRs | ||||||
| 2. **Security first**: Merge security updates ASAP | ||||||
| 3. **Group merging**: Merge compatible patches together to reduce churn | ||||||
| 4. **Test before merge**: Run `make check` on important updates | ||||||
| 5. **Keep PRs fresh**: Don't let PRs sit too long; they'll need rebasing | ||||||
| 6. **Monitor CI**: Set up Slack/email notifications for failed Dependabot builds | ||||||
|
|
||||||
| ## Integration with govulncheck | ||||||
|
|
||||||
| Our `make lint` now includes vulnerability scanning with `govulncheck`. This complements Dependabot: | ||||||
|
|
||||||
| - **Dependabot**: Proactively creates PRs for vulnerable dependencies | ||||||
| - **govulncheck**: Verifies vulnerabilities are actually fixed | ||||||
|
|
||||||
| Workflow: | ||||||
| 1. Dependabot creates PR for security update | ||||||
| 2. CI runs `make lint` which includes `govulncheck` | ||||||
| 3. Verify warning count decreases | ||||||
| 4. Merge if clean | ||||||
|
|
||||||
| ## Configuration File Location | ||||||
|
|
||||||
| `.github/dependabot.yml` - Edit this file to modify Dependabot behavior | ||||||
|
|
||||||
| ## Further Reading | ||||||
|
|
||||||
| - [Dependabot documentation](https://docs.github.com/en/code-security/dependabot) | ||||||
| - [Configuration options](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file) | ||||||
| - [Go modules support](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem) | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| # Dependabot configuration for automated dependency updates | ||
| # Documentation: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
|
||
| version: 2 | ||
| updates: | ||
| # Go modules - main dependencies | ||
| - package-ecosystem: "gomod" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" | ||
| day: "monday" | ||
| time: "09:00" | ||
| timezone: "America/New_York" | ||
| # Group updates to reduce PR noise | ||
| groups: | ||
| # Group AWS SDK updates together | ||
| aws-sdk: | ||
| patterns: | ||
| - "github.com/aws/aws-sdk-go-v2*" | ||
| update-types: | ||
| - "minor" | ||
| - "patch" | ||
| # Group Kubernetes/OpenShift updates together | ||
| k8s-ecosystem: | ||
| patterns: | ||
| - "k8s.io/*" | ||
| - "sigs.k8s.io/*" | ||
| - "github.com/openshift/*" | ||
| update-types: | ||
| - "minor" | ||
| - "patch" | ||
| # Group testing dependencies | ||
| testing: | ||
| patterns: | ||
| - "github.com/onsi/ginkgo*" | ||
| - "github.com/onsi/gomega*" | ||
| update-types: | ||
| - "minor" | ||
| - "patch" | ||
| # Group OpenTelemetry dependencies | ||
| opentelemetry: | ||
| patterns: | ||
| - "go.opentelemetry.io/otel*" | ||
| update-types: | ||
| - "minor" | ||
| - "patch" | ||
| # Group Go extended libraries | ||
| golang-x: | ||
| patterns: | ||
| - "golang.org/x/*" | ||
| update-types: | ||
| - "minor" | ||
| - "patch" | ||
| # Group OpenAPI libraries | ||
| go-openapi: | ||
| patterns: | ||
| - "github.com/go-openapi/*" | ||
| update-types: | ||
| - "minor" | ||
| - "patch" | ||
| # Group all remaining patch updates together (must be last - catches everything else) | ||
| patch-updates: | ||
| patterns: | ||
| - "*" | ||
| update-types: | ||
| - "patch" | ||
| open-pull-requests-limit: 10 | ||
| reviewers: | ||
| - "jcantrill" | ||
| - "vparfonov" | ||
| - "Clee2691" | ||
| assignees: | ||
| - "jcantrill" | ||
| labels: | ||
| - "dependencies" | ||
| - "go" | ||
| - "automated" | ||
| commit-message: | ||
| prefix: "chore(deps)" | ||
| include: "scope" | ||
| # Rebase strategy: auto-rebase PRs when base branch is updated | ||
| rebase-strategy: "auto" | ||
| # Allow both direct and indirect dependency updates | ||
| # Indirect deps (transitive dependencies) will only create PRs for: | ||
| # - Security vulnerabilities (always, regardless of this config) | ||
| # - Version updates that are explicitly allowed below | ||
| allow: | ||
| - dependency-type: "direct" | ||
| - dependency-type: "indirect" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: openshift/cluster-logging-operator
Length of output: 3985
🌐 Web query:
GitHub Dependabot options reference allow update-types security indirect dependencies security updates ignore rules💡 Result:
<source_evidence>
Citations:
🏁 Script executed:
Repository: openshift/cluster-logging-operator
Length of output: 3822
Document the actual Dependabot scope.
The configuration allows version updates for both direct and indirect dependencies. It does not limit indirect version updates to security updates.
allow.update-types: ["security"]would also be invalid; supported values are semantic-version update types, and they do not control security updates.ignorerules can still exclude dependencies from security updates.Suggested documentation fix
📝 Committable suggestion
🤖 Prompt for AI Agents