{"record":{"id":"6ca242db3a72645c","repo":"kubernetes/kubernetes","slug":"please-add-s-as-dependencies-under-destination-s","errorCode":null,"errorMessage":"Please add %s as dependencies under destination %s","messagePattern":"Please add (.+?) as dependencies under destination (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hack/tools/publishing-verifier/publishing-verifier.go","lineNumber":150,"sourceCode":"}\n\nfunc checkDependencies(rule config.RepositoryRule, gomodDependencies map[string][]string) error {\n\tvar processedDeps []string\n\tbranch := rule.Branches[0]\n\tfor _, dep := range gomodDependencies[rule.DestinationRepository] {\n\t\tfound := false\n\t\tif len(branch.Dependencies) > 0 {\n\t\t\tfor _, dep2 := range branch.Dependencies {\n\t\t\t\tprocessedDeps = append(processedDeps, dep2.Repository)\n\t\t\t\tif dep2.Branch != \"master\" {\n\t\t\t\t\treturn fmt.Errorf(\"looking for master branch of %s and found : %s for destination\", dep2.Repository, rule.DestinationRepository)\n\t\t\t\t}\n\t\t\t\tif dep2.Repository == dep {\n\t\t\t\t\tfound = true\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"Please add %s as dependencies under destination %s\", gomodDependencies[rule.DestinationRepository], rule.DestinationRepository)\n\t\t}\n\t\tif !found {\n\t\t\treturn fmt.Errorf(\"Please add %s as a dependency under destination %s\", dep, rule.DestinationRepository)\n\t\t} else {\n\t\t\tfmt.Printf(\"dependency %s found\\n\", dep)\n\t\t}\n\t}\n\t// check if all deps are processed.\n\textraDeps := diffSlice(processedDeps, gomodDependencies[rule.DestinationRepository])\n\tif len(extraDeps) > 0 {\n\t\treturn fmt.Errorf(\"extra dependencies in rules for %s: %s\", rule.DestinationRepository, strings.Join(extraDeps, \",\"))\n\t}\n\treturn nil\n}\n\nfunc verifyPublishingBotRules() error {\n\trules, err := config.LoadRules(rulesFile)\n\tif err != nil {","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/kubernetes/kubernetes/blob/94c136764292cc5fac976c0de6587daaea56410f/hack/tools/publishing-verifier/publishing-verifier.go#L132-L168","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nbranches:\n  - name: master\n    source:\n      branch: master\n# go.mod has: replace k8s.io/apimachinery => ../apimachinery\n# after\nbranches:\n  - name: master\n    source:\n      branch: master\n    dependencies:\n      - repository: apimachinery\n        branch: master","handlingStrategy":"validation","validationCode":"// Pre-flight: if go.mod has staging replaces, the rule branch must declare dependencies.\nfunc checkHasDepsWhenNeeded(rules []RepositoryRule, gomodDeps map[string][]string) error {\n    for _, r := range rules {\n        if len(r.Branches) == 0 { continue }\n        b := r.Branches[0]\n        if deps, ok := gomodDeps[r.DestinationRepository]; ok && len(deps) > 0 && len(b.Dependencies) == 0 {\n            return fmt.Errorf(\"destination %s: go.mod has %v but branch declares no dependencies\", r.DestinationRepository, deps)\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["config","publishing-bot","kubernetes","yaml","dependencies","go-mod"],"backgroundTag":null,"analyzedSha":"94c136764292cc5fac976c0de6587daaea56410f","analyzedAt":"2026-08-08T23:58:27.554Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}