blob: bb409bf34813d9881b58d4b38cb419ba7e87e3bf [file] [log] [blame]
Serge Bazanskibb7db922020-04-30 12:43:10 +02001# 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
22def version_x_defs():
23 stamp_pkgs = [
24 "k8s.io/component-base/version",
25 "k8s.io/client-go/pkg/version",
26 ]
27
28 stamp_vars = [
29 "buildDate",
30 "gitCommit",
31 "gitMajor",
32 "gitMinor",
33 "gitTreeState",
34 "gitVersion",
35 ]
36
37 # Generate the cross-product.
38 x_defs = {}
39 for pkg in stamp_pkgs:
40 for var in stamp_vars:
41 x_defs["%s.%s" % (pkg, var)] = "{KUBERNETES_%s}" % var
42 return x_defs