Repository navigation
Expand file tree
/
Copy pathreplayBuildHistory.sh
More file actions
executable file
·87 lines (75 loc) · 2.04 KB
/
Copy pathreplayBuildHistory.sh
File metadata and controls
executable file
·87 lines (75 loc) · 2.04 KB
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
set -e
function usage() {
echo "Usage: $0 <buildId> <target> [<numBuilds>]"
echo "Fetches the build number log for <buildId> <target> and reruns the last <numBuilds> of that target that happened on the corresponding server"
exit 1
}
buildId="$1"
target="$2"
if [ "$buildId" == "" ]; then
usage
fi
if [ "$target" == "" ]; then
usage
fi
numBuilds="$3"
if [ "$numBuilds" == "" ]; then
numBuilds="2"
fi
cd "$(dirname $0)/.."
function cleanup() {
./gradlew --stop || true
rm ../../out -rf
mkdir -p ../../out
}
cleanup
function echoAndDo() {
echo "$*"
eval "$*"
}
function fetch_artifact() {
fetchBuildId="$1"
remotePath="$2"
localDir="$3"
cd "$localDir"
echoAndDo /google/data/ro/projects/android/fetch_artifact --bid "$fetchBuildId" --target "$target" "$remotePath"
cd -
}
function downloadBuildNumberLog() {
if [ "$target" == "androidx_incremental" ]; then
buildNumberLog=incremental/build_number.log
else
buildNumberLog=build_number.log
fi
echo Downloading build number history for build $buildId
fetch_artifact "$buildId" "$buildNumberLog" ../../out
}
downloadBuildNumberLog
buildNumberHistory="$(cat ../../out/build_number.log | tail -n "$numBuilds")"
echo Will run $target for sources from these builds: $buildNumberHistory .
function checkoutSources() {
checkoutBuildId="$1"
echo checking out sources for build $checkoutBuildId
fetch_artifact "$checkoutBuildId" BUILD_INFO ../../out/
superprojectRevision="$(jq -r ".parsed_manifest.superproject.revision" ../../out/BUILD_INFO)"
echo checking out superproject revision $superprojectRevision
cd ../../
git fetch origin "$superprojectRevision"
git checkout "$superprojectRevision"
git submodule update
cd -
echo done checking out sources for build $checkoutBuildId
}
function runBuild() {
bash "./busytown/$target.sh"
}
for previousBuildId in $buildNumberHistory; do
checkoutSources $previousBuildId
if runBuild; then
echo build of $previousBuildId succeeded
else
echo build of $previousBuildId failed
exit 1
fi
done