Skip to content
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

publishing: use deps in replace directive in rules #79330

Merged
merged 1 commit into from
Jun 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion hack/verify-publishing-bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_gomod_dependencies(rootdir, components):
for dep in components:
if dep == component:
continue
if ("k8s.io/" + dep + " v0.0.0") not in line:
if ("k8s.io/" + dep + " =>") not in line:
continue
print("\t"+dep)
if dep not in all_dependencies[component]:
Expand Down Expand Up @@ -80,10 +80,12 @@ def main():
if rule["destination"] not in gomod_dependencies:
raise Exception("missing go.mod for %s" % rule["destination"])
processed_repos.append(rule["destination"])
processed_deps = []
for dep in set(gomod_dependencies[rule["destination"]]):
found = False
if "dependencies" in branch:
for dep2 in branch["dependencies"]:
processed_deps.append(dep2["repository"])
if dep2["branch"] != "master":
raise Exception("Looking for master branch and found : %s for destination", dep2,
rule["destination"])
Expand All @@ -96,6 +98,9 @@ def main():
raise Exception("Please add %s as a dependency under destination %s in %s" % (dep, rule["destination"], rules_file))
else:
print(" found dependency %s" % dep)
extraDeps = set(processed_deps) - set(gomod_dependencies[rule["destination"]])
if len(extraDeps) > 0:
raise Exception("extra dependencies in rules for %s: %s" % (rule["destination"], ','.join(str(s) for s in extraDeps)))
items = set(gomod_dependencies.keys()) - set(processed_repos)
if len(items) > 0:
raise Exception("missing rules for %s" % ','.join(str(s) for s in items))
Expand Down
28 changes: 8 additions & 20 deletions staging/publishing/rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ rules:
branch: master
- repository: code-generator
branch: master
- repository: component-base
branch: master
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was ok to have extra deps listed in rules with godeps, but with go modules it leads to an awkward go.mod file: https://github.com/kubernetes/sample-controller/blob/d4d703847b23378cf5779831533cd96175d95632/go.mod#L28

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this check by the verify script now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the "extra deps" check.

required-packages:
- k8s.io/code-generator
- source:
Expand All @@ -234,8 +232,6 @@ rules:
branch: release-12.0
- repository: code-generator
branch: release-1.15
- repository: component-base
branch: release-1.15
required-packages:
- k8s.io/code-generator
smoke-test: |
Expand Down Expand Up @@ -354,8 +350,6 @@ rules:
branch: master
- repository: client-go
branch: master
- repository: component-base
branch: master
- source:
branch: release-1.15
dir: staging/src/k8s.io/sample-cli-plugin
Expand All @@ -370,8 +364,6 @@ rules:
branch: release-1.15
- repository: client-go
branch: release-12.0
- repository: component-base
branch: release-1.15
- destination: kube-proxy
library: true
branches:
Expand Down Expand Up @@ -406,8 +398,6 @@ rules:
branch: master
- repository: api
branch: master
- repository: component-base
branch: master
- source:
branch: release-1.15
dir: staging/src/k8s.io/kubelet
Expand All @@ -418,8 +408,6 @@ rules:
branch: release-1.15
- repository: api
branch: release-1.15
- repository: component-base
branch: release-1.15
- destination: kube-scheduler
library: true
branches:
Expand All @@ -430,8 +418,6 @@ rules:
dependencies:
- repository: apimachinery
branch: master
- repository: apiserver
branch: master
- repository: component-base
branch: master
- source:
Expand All @@ -442,8 +428,6 @@ rules:
dependencies:
- repository: apimachinery
branch: release-1.15
- repository: apiserver
branch: release-1.15
- repository: component-base
branch: release-1.15
- destination: kube-controller-manager
Expand All @@ -456,8 +440,6 @@ rules:
dependencies:
- repository: apimachinery
branch: master
- repository: apiserver
branch: master
- repository: component-base
branch: master
- source:
Expand All @@ -468,8 +450,6 @@ rules:
dependencies:
- repository: apimachinery
branch: release-1.15
- repository: apiserver
branch: release-1.15
- repository: component-base
branch: release-1.15
- destination: cluster-bootstrap
Expand Down Expand Up @@ -532,6 +512,8 @@ rules:
branch: master
- repository: apimachinery
branch: master
- repository: client-go
branch: master
- repository: cloud-provider
branch: master
- source:
Expand All @@ -544,6 +526,8 @@ rules:
branch: release-1.15
- repository: apimachinery
branch: release-1.15
- repository: client-go
branch: release-12.0
- repository: cloud-provider
branch: release-1.15
- destination: legacy-cloud-providers
Expand Down Expand Up @@ -630,6 +614,8 @@ rules:
dir: staging/src/k8s.io/kubectl
name: master
dependencies:
- repository: api
branch: master
- repository: apimachinery
branch: master
- repository: client-go
Expand All @@ -640,6 +626,8 @@ rules:
name: release-1.15
go: 1.12.5
dependencies:
- repository: api
branch: release-1.15
- repository: apimachinery
branch: release-1.15
- repository: client-go
Expand Down