forked from kubernetes/test-infra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runlocal
executable file
·82 lines (72 loc) · 2.35 KB
/
runlocal
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
#!/usr/bin/env bash
# Copyright 2017 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 -o errexit
set -o nounset
set -o pipefail
if [[ "${1:-}" == '--help' ]]; then
echo "Usage: [NO_DOCKER=yes] $(basename "$0") [--skip-pregenerated|HOST] [--skip-typescript]" >&2
echo >&2
echo " --skip-pregenerated: do not fetch pregenerated cluster data from a prod instance" >&2
echo " HOST: fetch pregenerated cluster data from a prod instance, eg https://prow.k8s.io" >&2
echo " --skip-typescript: do not compile typescript" >&2
echo >&2
echo " NO_DOCKER=yes: Run Makefile commands on host machine, rather than a container" >&2
exit 1
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "${DIR}"
fetch() {
echo "* $@" >&2
curl -s "$@"
}
update-pregenerated() {
local readonly HOST=$1
echo "Updating pregenerated data from ${HOST}: " >&2
cd localdata
fetch "${HOST}/plugin-help.js?var=allHelp" > plugin-help.js
fetch "${HOST}/pr-data.js" > pr-data.js
fetch "${HOST}/prowjobs.js" > prowjobs.json
fetch "${HOST}/tide-history.js?var=tideHistory" > tide-history.js
fetch "${HOST}/tide.js?var=tideData" > tide.js
cd ..
echo "DONE"
}
if [[ "${1:-}" != '--skip-pregenerated' ]]; then
HOST=${1:-"https://prow.k8s.io"}
if [[ "${1:-}" == "openshift" ]]; then
HOST="https://prow.ci.openshift.org"
fi
update-pregenerated "$HOST"
shift || true
else
shift
fi
compile-typescript() {
echo "Compiling typescript..." >&2
./gather-static.sh
}
if [[ "${1:-}" != '--skip-typescript' ]]; then
compile-typescript
fi
(
set -o xtrace
go run . \
--pregenerated-data=${DIR}/localdata \
--static-files-location="$DIR/kodata/static" \
--template-files-location="$DIR/kodata/template" \
--spyglass-files-location="$DIR/kodata/lenses" \
--config-path "${DIR}/../../../config/prow/config.yaml" \
--spyglass
)