blob: ddd1347639ec394391dfe5cc26aa99dd201a17ce [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",
Lorenz Brunf6402112020-05-04 16:50:31 +020031 "gitTreeState",
32 ]
33
34 stable_stamp_vars = [
Serge Bazanskibb7db922020-04-30 12:43:10 +020035 "gitMajor",
36 "gitMinor",
Serge Bazanskibb7db922020-04-30 12:43:10 +020037 "gitVersion",
38 ]
39
40 # Generate the cross-product.
41 x_defs = {}
42 for pkg in stamp_pkgs:
43 for var in stamp_vars:
44 x_defs["%s.%s" % (pkg, var)] = "{KUBERNETES_%s}" % var
Lorenz Brunf6402112020-05-04 16:50:31 +020045 for pkg in stamp_pkgs:
46 for var in stable_stamp_vars:
47 x_defs["%s.%s" % (pkg, var)] = "{STABLE_KUBERNETES_%s}" % var
Serge Bazanskibb7db922020-04-30 12:43:10 +020048 return x_defs