File tree 5 files changed +66
-43
lines changed
config/jobs/kubernetes/test-infra
5 files changed +66
-43
lines changed Original file line number Diff line number Diff line change @@ -159,25 +159,6 @@ presubmits:
159
159
requests :
160
160
memory : " 2Gi"
161
161
162
- - name : pull-test-infra-verify-labels
163
- branches :
164
- - master
165
- run_if_changed : ' ^label_sync/labels.yaml'
166
- decorate : true
167
- labels :
168
- preset-service-account : " true"
169
- preset-bazel-scratch-dir : " true"
170
- spec :
171
- containers :
172
- - image : gcr.io/k8s-testimages/kubekins-e2e:v20190420-93fab49-experimental
173
- command :
174
- - runner.sh
175
- args :
176
- - ./hack/verify-labels.sh
177
- resources :
178
- requests :
179
- memory : " 2Gi"
180
-
181
162
- name : pull-test-infra-verify-file-perms
182
163
branches :
183
164
- master
Original file line number Diff line number Diff line change @@ -112,6 +112,30 @@ sh_test(
112
112
],
113
113
)
114
114
115
+ sh_binary (
116
+ name = "update-labels" ,
117
+ srcs = ["update-labels.sh" ],
118
+ args = ["$(location //label_sync)" ],
119
+ data = ["//label_sync" ],
120
+ )
121
+
122
+ sh_test (
123
+ name = "verify-labels" ,
124
+ srcs = ["verify-labels.sh" ],
125
+ args = [
126
+ "$(location :update-labels)" ,
127
+ "$(location //label_sync)" ,
128
+ ],
129
+ data = [
130
+ ":update-labels" ,
131
+ "//label_sync" ,
132
+ "//label_sync:labels.md" ,
133
+ "//label_sync:labels.md.tmpl" ,
134
+ "//label_sync:labels.yaml" ,
135
+ ],
136
+ tags = ["lint" ],
137
+ )
138
+
115
139
test_suite (
116
140
name = "verify-all" ,
117
141
tags = ["lint" ], # picks up all non-manual targets with this tag
Original file line number Diff line number Diff line change @@ -17,13 +17,25 @@ set -o errexit
17
17
set -o nounset
18
18
set -o pipefail
19
19
20
- TESTINFRA_ROOT=$( git rev-parse --show-toplevel)
21
- LABELS_CONFIG=${LABELS_CONFIG:- " ${TESTINFRA_ROOT} /label_sync/labels.yaml" }
22
- LABELS_DOCS_TEMPLATE=${LABELS_DOCS_TEMPLATE:- " ${TESTINFRA_ROOT} /label_sync/labels.md.tmpl" }
23
- LABELS_DOCS_OUTPUT=${LABELS_DOCS_OUTPUT:- " ${TESTINFRA_ROOT} /label_sync/labels.md" }
20
+ if [[ -n " ${BUILD_WORKSPACE_DIRECTORY:- } " ]]; then # Running inside bazel
21
+ echo " Updating labels..." >&2
22
+ elif ! command -v bazel & > /dev/null; then
23
+ echo " Install bazel at https://bazel.build" >&2
24
+ exit 1
25
+ else
26
+ (
27
+ set -o xtrace
28
+ bazel run @io_k8s_test_infra//hack:update-labels
29
+ )
30
+ exit 0
31
+ fi
24
32
25
- bazel run //label_sync -- \
26
- --config=${LABELS_CONFIG} \
27
- --action=docs \
28
- --docs-template=${LABELS_DOCS_TEMPLATE} \
29
- --docs-output=${LABELS_DOCS_OUTPUT}
33
+ label_sync=$PWD /$1
34
+ cd " $BUILD_WORKSPACE_DIRECTORY "
35
+ out=${2:- label_sync/ labels.md}
36
+
37
+ " $label_sync " \
38
+ --config=label_sync/labels.yaml \
39
+ --action=docs \
40
+ --docs-template=label_sync/labels.md.tmpl \
41
+ " --docs-output=$out "
Original file line number Diff line number Diff line change @@ -17,17 +17,29 @@ set -o errexit
17
17
set -o nounset
18
18
set -o pipefail
19
19
20
- TESTINFRA_ROOT=$( git rev-parse --show-toplevel)
20
+ if [[ -n " ${TEST_WORKSPACE:- } " ]]; then # Running inside bazel
21
+ echo " Validating labels..." >&2
22
+ elif ! command -v bazel & > /dev/null; then
23
+ echo " Install bazel at https://bazel.build" >&2
24
+ exit 1
25
+ else
26
+ (
27
+ set -o xtrace
28
+ bazel test --test_output=streamed @io_k8s_test_infra//hack:verify-labels
29
+ )
30
+ exit 0
31
+ fi
21
32
22
- TMP_LABELS_DOCS=$( mktemp)
23
- trap ' rm -f "${TMP_LABELS_DOCS}"' EXIT
24
- LABELS_DOCS_OUTPUT=" ${TMP_LABELS_DOCS} " ${TESTINFRA_ROOT} /hack/update-labels.sh
33
+ out=$TEST_TMPDIR /labels.md.expected
34
+ BUILD_WORKSPACE_DIRECTORY=" $PWD " " $@ " " $out "
25
35
26
36
27
- DIFF=$( diff " ${TMP_LABELS_DOCS} " " ${TESTINFRA_ROOT} /label_sync/labels.md" || true)
28
- if [ ! -z " $DIFF " ]; then
29
- echo " ${DIFF} "
30
- echo " "
31
- echo " FAILED: labels.yaml was updated without updating labels.md, please run 'hack/update-labels.sh'"
37
+ DIFF=$( diff label_sync/labels.md " $out " || true)
38
+ if [[ -n " $DIFF " ]]; then
39
+ echo " < unexpected" >&2
40
+ echo " > missing" >&2
41
+ echo " ${DIFF} " >&2
42
+ echo " " >&2
43
+ echo " ERROR: labels.md out of date. Fix with hack/update-labels.sh" >&2
32
44
exit 1
33
45
fi
Original file line number Diff line number Diff line change @@ -2131,9 +2131,6 @@ test_groups:
2131
2131
- name : pull-test-infra-verify-deps
2132
2132
gcs_prefix : kubernetes-jenkins/pr-logs/directory/pull-test-infra-verify-deps
2133
2133
num_columns_recent : 20
2134
- - name : pull-test-infra-verify-labels
2135
- gcs_prefix : kubernetes-jenkins/pr-logs/directory/pull-test-infra-verify-labels
2136
- num_columns_recent : 20
2137
2134
- name : pull-test-infra-verify-file-perms
2138
2135
gcs_prefix : kubernetes-jenkins/pr-logs/directory/pull-test-infra-verify-file-perms
2139
2136
num_columns_recent : 20
@@ -7235,9 +7232,6 @@ dashboards:
7235
7232
- name : verify-deps
7236
7233
test_group_name : pull-test-infra-verify-deps
7237
7234
base_options : width=10
7238
- - name : verify-labels
7239
- test_group_name : pull-test-infra-verify-labels
7240
- base_options : width=10
7241
7235
- name : verify-codegen
7242
7236
test_group_name : pull-test-infra-verify-codegen
7243
7237
base_options : width=10
You can’t perform that action at this time.
0 commit comments