kubernetes/kubernetes · error
Please add %s as dependencies under destination %s
Error message
Please add %s as dependencies under destination %s
What it means
checkDependencies (publishing-verifier.go:149-151) fires when the destination's go.mod declares staging dependencies but the rule's master branch declares zero dependencies (len(branch.Dependencies) == 0). The verifier expects the rule to mirror every intra-staging replace directive. The first %s is the full list of go.mod dependencies, the second is the destination repository.
Source
Thrown at hack/tools/publishing-verifier/publishing-verifier.go:150
}
func checkDependencies(rule config.RepositoryRule, gomodDependencies map[string][]string) error {
var processedDeps []string
branch := rule.Branches[0]
for _, dep := range gomodDependencies[rule.DestinationRepository] {
found := false
if len(branch.Dependencies) > 0 {
for _, dep2 := range branch.Dependencies {
processedDeps = append(processedDeps, dep2.Repository)
if dep2.Branch != "master" {
return fmt.Errorf("looking for master branch of %s and found : %s for destination", dep2.Repository, rule.DestinationRepository)
}
if dep2.Repository == dep {
found = true
}
}
} else {
return fmt.Errorf("Please add %s as dependencies under destination %s", gomodDependencies[rule.DestinationRepository], rule.DestinationRepository)
}
if !found {
return fmt.Errorf("Please add %s as a dependency under destination %s", dep, rule.DestinationRepository)
} else {
fmt.Printf("dependency %s found\n", dep)
}
}
// check if all deps are processed.
extraDeps := diffSlice(processedDeps, gomodDependencies[rule.DestinationRepository])
if len(extraDeps) > 0 {
return fmt.Errorf("extra dependencies in rules for %s: %s", rule.DestinationRepository, strings.Join(extraDeps, ","))
}
return nil
}
func verifyPublishingBotRules() error {
rules, err := config.LoadRules(rulesFile)
if err != nil {View on GitHub (pinned to 94c1367642)
Solutions
- Read the destination module's go.mod replace section and list each k8s.io peer module under the master branch dependencies with branch: master.
- Re-run the verifier; it should now progress to per-dependency matching.
- If a replace directive is not a real staging dependency, confirm the go.mod is correct before adding it.
Example fix
# before
branches:
- name: master
source:
branch: master
# go.mod has: replace k8s.io/apimachinery => ../apimachinery
# after
branches:
- name: master
source:
branch: master
dependencies:
- repository: apimachinery
branch: master Defensive patterns
Strategy: validation
Validate before calling
// Pre-flight: if go.mod has staging replaces, the rule branch must declare dependencies.
func checkHasDepsWhenNeeded(rules []RepositoryRule, gomodDeps map[string][]string) error {
for _, r := range rules {
if len(r.Branches) == 0 { continue }
b := r.Branches[0]
if deps, ok := gomodDeps[r.DestinationRepository]; ok && len(deps) > 0 && len(b.Dependencies) == 0 {
return fmt.Errorf("destination %s: go.mod has %v but branch declares no dependencies", r.DestinationRepository, deps)
}
}
return nil
} Prevention
- Whenever you add a replace directive to a staging go.mod, immediately add matching dependencies to the rule.
- Keep rules.yaml and go.mod replace sections in sync in the same commit.
When it happens
Trigger: A staging module's go.mod has replace directives onto other k8s.io modules, but the corresponding rule branch has no dependencies: block at all.
Common situations: A new module gained staging dependencies (new replace directives in go.mod) but the rules.yaml branch was not updated; the dependencies block was accidentally deleted.
Related errors
- Please add %s as a dependency under destination %s
- extra dependencies in rules for %s: %s
- looking for master branch of %s and found : %s for destinati
- use of deprecated `dir` field in rules for `%s`
- cannot have more than one directory (%s) per source branch `
AI-assisted analysis of kubernetes/kubernetes@94c1367642 (2026-08-08).
Data as JSON: /api/errors/6ca242db3a72645c.
Report an issue: GitHub.