Serge Bazanski | e23717d | 2020-11-03 20:08:23 +0100 | [diff] [blame] | 1 | # Compatibility for version_x_defs from k8s.io/component-base & co. |
| 2 | # This makes all the defs be autopopulated from //bzl:workspace-status.sh. |
| 3 | |
Serge Bazanski | c3f36e9 | 2020-11-03 19:34:42 +0100 | [diff] [blame] | 4 | def version_x_defs(): |
| 5 | stamp_pkgs = [ |
| 6 | "k8s.io/component-base/version", |
| 7 | "k8s.io/client-go/pkg/version", |
| 8 | ] |
| 9 | |
| 10 | # This should match the list of vars in kube::version::ldflags |
| 11 | # It should also match the list of vars set in hack/print-workspace-status.sh. |
| 12 | stamp_vars = [ |
| 13 | "buildDate", |
| 14 | "gitCommit", |
| 15 | "gitMajor", |
| 16 | "gitMinor", |
| 17 | "gitTreeState", |
| 18 | "gitVersion", |
| 19 | ] |
| 20 | |
| 21 | # Generate the cross-product. |
| 22 | x_defs = {} |
| 23 | for pkg in stamp_pkgs: |
| 24 | for var in stamp_vars: |
Serge Bazanski | e23717d | 2020-11-03 20:08:23 +0100 | [diff] [blame] | 25 | x_defs["%s.%s" % (pkg, var)] = "{STABLE_KUBERNETES_%s}" % var |
Serge Bazanski | c3f36e9 | 2020-11-03 19:34:42 +0100 | [diff] [blame] | 26 | return x_defs |