forked from kubernetes/test-infra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_summaries-go.sh
executable file
·87 lines (73 loc) · 2.67 KB
/
update_summaries-go.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -exu
cd $(dirname $0)
start=$(date +%s)
if [[ -e ${GOOGLE_APPLICATION_CREDENTIALS-} ]]; then
gcloud auth activate-service-account --key-file="${GOOGLE_APPLICATION_CREDENTIALS}"
fi
gcloud config set project k8s-gubernator
bq show <<< $'\n'
date
bq --headless --format=json query --max_rows 1000000 \
"select
path,
timestamp_to_sec(started) started,
elapsed,
tests_run,
tests_failed,
result,
executor,
job,
number
from
[k8s-gubernator:build.all]
where
timestamp_to_sec(started) > TIMESTAMP_TO_SEC(DATE_ADD(CURRENT_DATE(), -14, 'DAY'))
and job != 'ci-kubernetes-coverage-unit'" \
> triage_builds.json
bq query --allow_large_results --headless --max_rows 0 --replace --destination_table k8s-gubernator:temp.triagego \
"select
timestamp_to_sec(started) started,
path build,
test.name name,
test.failure_text failure_text
from
[k8s-gubernator:build.all]
where
test.failed
and timestamp_to_sec(started) > TIMESTAMP_TO_SEC(DATE_ADD(CURRENT_DATE(), -14, 'DAY'))
and job != 'ci-kubernetes-coverage-unit'"
gsutil rm gs://k8s-gubernator/triage_tests-go/shard_*.json.gz || true
bq extract --compression GZIP --destination_format NEWLINE_DELIMITED_JSON 'k8s-gubernator:temp.triagego' gs://k8s-gubernator/triage_tests-go/shard_*.json.gz
mkdir -p triage_tests
gsutil cp -r gs://k8s-gubernator/triage_tests-go/* triage_tests/
gzip -df triage_tests/*.gz
# gsutil cp gs://k8s-gubernator/triage/failure_data.json failure_data_previous.json
mkdir -p slices
/triage \
--builds triage_builds.json \
--previous triage_tests/*.json \
--output failure_data.json \
--output_slices slices/failure_data_PREFIX.json
gsutil_cp() {
gsutil -h 'Cache-Control: no-store, must-revalidate' -m cp -Z -a public-read "$@"
}
gsutil_cp failure_data.json gs://k8s-gubernator/triage-go/
gsutil_cp slices/*.json gs://k8s-gubernator/triage-go/slices/
gsutil_cp failure_data.json "gs://k8s-gubernator/triage-go/history/$(date -u +%Y%m%d).json"
stop=$(date +%s)
elapsed=$(( ${stop} - ${start} ))
echo "Finished in $(( ${elapsed} / 60))m$(( ${elapsed} % 60))s"