Serge Bazanski | 97b5cd7 | 2023-07-28 17:14:50 +0000 | [diff] [blame] | 1 | # Copyright 2020 The Monogon Project Authors. |
| 2 | # |
| 3 | # SPDX-License-Identifier: Apache-2.0 |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # This reimplements k8s.io/kubernetes-compatible version_x_defs, while namespacing |
| 18 | # stamp variables with KUBERNETES_*. |
| 19 | # The generated build defs then are defines by the workspace status script, see |
| 20 | # //build/print-workspace-status.sh. |
| 21 | |
| 22 | def version_x_defs(): |
| 23 | stamp_pkgs = [ |
| 24 | "k8s.io/component-base/version", |
| 25 | "k8s.io/client-go/pkg/version", |
| 26 | ] |
| 27 | |
| 28 | stable_stamp_vars = [ |
| 29 | "gitMajor", |
| 30 | "gitMinor", |
| 31 | "gitCommit", |
| 32 | "gitVersion", |
| 33 | ] |
| 34 | |
| 35 | x_defs = {} |
| 36 | for pkg in stamp_pkgs: |
| 37 | for var in stable_stamp_vars: |
| 38 | x_defs["%s.%s" % (pkg, var)] = "{STABLE_KUBERNETES_%s}" % var |
| 39 | return x_defs |