summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2024-04-25 13:00:47 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2024-04-26 13:53:10 +0000
commit72a72cea7ee162d2211c13106ec9345e9f3ba91f (patch)
tree93a361ef77b5764a3736c44ad3e1f3a9772d97ab
parent0da630f15560b214645a5557c7f15136fa0e65ff (diff)
tcwg-update-lnt-results.sh: Move data to $lntimport/ directory
... which will be shared with the LNT container. Change-Id: I4c8c02d47fc840141dcd6aa6a68cc5d556b3372b
-rw-r--r--jenkins-helpers.sh25
-rwxr-xr-xtcwg-update-lnt-results.sh15
2 files changed, 31 insertions, 9 deletions
diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh
index 3e5ad7cd..c6e23431 100644
--- a/jenkins-helpers.sh
+++ b/jenkins-helpers.sh
@@ -1289,6 +1289,9 @@ breakup_changed_components ()
# fetches of ${paths[@]}" from appropriate revisions.
# Once one of the paths is found in a given revision, we check it out and
# move on to the next revision.
+# Optional "--relative" option supplied as $3 will make get_git_history()
+# output path names relative to the output directory. This is useful when
+# output directory needs to be moved before processing.
get_git_history ()
{
(
@@ -1298,6 +1301,12 @@ get_git_history ()
local repo="$2"
shift 2
+ local relative=false
+ if [ "$1" = "--relative" ]; then
+ relative=true
+ shift 1
+ fi
+
local -a paths=()
while [ $# != 0 ]; do
if [ "$1" = "--" ]; then
@@ -1348,14 +1357,13 @@ get_git_history ()
echo "$tmp_root"
while read rev; do
- local tmp_dir found path
- tmp_dir="$tmp_root/$rev"
- mkdir "$tmp_dir"
+ local found path
+ mkdir "$tmp_root/$rev"
found=false
for path in "${paths[@]}"; do
"${git_archive[@]}" "$rev" -- "$path" "${extra_paths[@]}" \
- | tar -x -C "$tmp_dir" &
+ | tar -x -C "$tmp_root/$rev" &
# "git archive" fails when $path was deleted in $rev.
if wait $!; then
found=true
@@ -1364,13 +1372,18 @@ get_git_history ()
done
if $found; then
- echo "$tmp_dir/$path"
+ if $relative; then
+ echo "$rev/$path"
+ else
+ echo "$tmp_root/$rev/$path"
+ fi
n_revs=$(($n_revs-1))
if [ $n_revs = 0 ]; then
break
fi
else
- rm -r "$tmp_dir"
+ # shellcheck disable=SC2115
+ rm -r "$tmp_root/$rev"
fi
done < <("${git_rev_list[@]}")
)
diff --git a/tcwg-update-lnt-results.sh b/tcwg-update-lnt-results.sh
index 2fc8ce45..71791c83 100755
--- a/tcwg-update-lnt-results.sh
+++ b/tcwg-update-lnt-results.sh
@@ -18,6 +18,7 @@ verbose="${verbose-false}"
gitbaseurl="ssh://bkp.tcwglab/home/tcwg-buildslave/base-artifacts"
lntserver="${lntserver-/home/tcwg-buildslave/$lnt_config/lntserver}"
lntdb="$lntserver/lnt-database"
+lntimport="$lntserver/import-tmp"
. $lntserver/sandbox/bin/activate
@@ -46,8 +47,10 @@ update_one_lnt_results_project()
branch="linaro-local/ci/$project/$config"
# push each one on LNT server
+ local -a lnt_reports=()
readarray -t lnt_reports < \
<(get_git_history -0 "$gitbaseurl/$project/$config.git#$branch" \
+ --relative \
notify/lnt_report.json -- manifest.sh)
# get_git_history always returns a first line with the created tmpdir, and each
@@ -63,14 +66,14 @@ update_one_lnt_results_project()
# whether we are in the middle of rewriting history. If "yes", then
# skip updating the dashboard to avoid inconsistent results.
local manifest
- manifest="$(dirname "$(dirname "${lnt_reports[1]}")")/manifest.sh"
+ manifest="$(dirname "$(dirname "${lnt_reports[0]}/${lnt_reports[1]}")")/manifest.sh"
local rr_major1 rr_minor1 i=1 rr_major2 rr_minor2
rr_major1=$(get_manifest "$manifest" "{rr[major]-0}")
rr_minor1=$(get_manifest "$manifest" "{rr[minor]-0}")
while [ $i != ${#lnt_reports[@]} ]; do
- json="${lnt_reports[$i]}"
- manifest="$(dirname "$(dirname "${lnt_reports[$i]}")")/manifest.sh"
+ json="${lnt_reports[0]}/${lnt_reports[$i]}"
+ manifest="$(dirname "$(dirname "${lnt_reports[0]}/${lnt_reports[$i]}")")/manifest.sh"
rr_major2=$(get_manifest "$manifest" "{rr[major]-0}")
rr_minor2=$(get_manifest "$manifest" "{rr[minor]-0}")
@@ -83,9 +86,15 @@ update_one_lnt_results_project()
jq -f $scripts/tcwg-lnt/$lnt_config/$lnt_model.jq $json > $json.tmp
mv $json.tmp $json
+ # Update the path to what it will be after rsync below.
+ lnt_reports[$i]="$lntimport/${lnt_reports[$i]}"
i=$((i + 1))
done
+ # Move data into $lntimport/ directory, which is shared with
+ # the LNT container.
+ rsync -a --del "${lnt_reports[0]}/" "$lntimport/"
+
echo "Deleting previous reports"
# "Machine" $config may not exist, so ignore failures.
lnt updatedb --testsuite "$project" "$lntdb" --delete-machine "$config" \