summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-07-20 17:56:41 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-07-21 14:14:02 +0000
commit3922f589ab98b50295674d01287ed7fc693bbb47 (patch)
tree9e38e71ae0ec10eee1acd3441f42ff24b66f6bfe
parent8b5d081995cc6e048c5794ccd0ba2bf3c42d2e1b (diff)
downloadjenkins-scripts-3922f589ab98b50295674d01287ed7fc693bbb47.tar.gz
round-robin scripts: Merge <foo>_url and <foo>_branch into <foo>_git
Merge git "_url" and "_branch" specification into a single "_git" argument that's constructed from "URL#BRANCH". This argument also has a special value "baseline", which before was a special value of "branch". This rework makes handling of git references simpler and cleaner, especially on the jenkins side. Change-Id: I1c1c07629728c693b8350dfa1b61fe767d5b0a0b
-rwxr-xr-xround-robin-bisect.sh51
-rw-r--r--round-robin.sh26
-rwxr-xr-xtcwg_bmk-build.sh5
-rwxr-xr-xtcwg_gnu-build.sh5
-rwxr-xr-xtcwg_kernel-build.sh5
5 files changed, 37 insertions, 55 deletions
diff --git a/round-robin-bisect.sh b/round-robin-bisect.sh
index 2328da64..8ded4ea6 100755
--- a/round-robin-bisect.sh
+++ b/round-robin-bisect.sh
@@ -17,8 +17,8 @@ fresh_dir $artifacts "$artifacts/manifests/*" "$artifacts/jenkins/*"
convert_args_to_variables "$@"
shift "$SHIFT_CONVERTED_ARGS"
-obligatory_variables bad_url bad_branch build_script current_project
-declare bad_url bad_branch build_script current_project
+obligatory_variables bad_git build_script current_project
+declare bad_git build_script current_project
BUILD_URL="${BUILD_URL:-$(pwd)}"
replay_log="${replay_log-}"
@@ -42,6 +42,9 @@ touch $artifacts/jenkins/build-name
trap print_traceback EXIT
+bad_url="${bad_git%#*}"
+bad_branch="${bad_git#*#}"
+
rebase_workaround=false
rebase_workaround_opts=()
@@ -51,7 +54,7 @@ case "${rr[ci_project]}/${rr[ci_config]}:$current_project" in
# Search for regressions against linux-mainline:master (aka linux-next:stable).
clone_or_update_repo $current_project stable $bad_url
# Just in case linux-next:stable has advanced between the build and bisect jobs,
- # use merge base between linux-next:stable and $bad_branch.
+ # use merge base between linux-next:stable and $bad_git.
bad_rev="${bad_rev-$(git_rev_parse_long $current_project $bad_branch)}"
linux_next_stable="${linux_next_stable-$(git -C $current_project merge-base HEAD $bad_rev)}"
cat <<EOF | manifest_out
@@ -59,8 +62,8 @@ declare -g linux_next_stable=$linux_next_stable
EOF
echo "Rebase workaround: forcing linux baseline to $linux_next_stable"
rebase_workaround=true
- rebase_workaround_opts+=("==rr[linux_url]" "$bad_url")
- rebase_workaround_opts+=("==rr[linux_branch]" "$linux_next_stable")
+ rebase_workaround_opts+=("==rr[linux_git]"
+ "$bad_url#$linux_next_stable")
;;
esac
@@ -192,8 +195,7 @@ $build_script \
%% $rel_artifacts/manifests/build-\$rev.sh \
@@ $rel_artifacts/manifests/build-parameters.sh \
==rr[mode] bisect \
- ==rr[${current_project}_url] "$bad_url" \
- ==rr[${current_project}_branch] \$rev \
+ ==rr[${current_project}_git] "$bad_url#\$rev" \
==rr[top_artifacts] $rel_artifacts/build-\$rev \
--verbose "$verbose" &
res=0 && wait \$! || res=\$?
@@ -243,20 +245,19 @@ if [ x"$res" = x"0" ]; then
case $project_name in
tcwg_kernel/llvm-*-next-*:linux)
cat > $artifacts/trigger-build-rebase <<EOF
-llvm_branch=baseline
+llvm_git=baseline
EOF
;;
tcwg_kernel/gnu-*-next-*:linux)
cat > $artifacts/trigger-build-rebase <<EOF
-binutils_branch=baseline
-gcc_branch=baseline
+binutils_git=baseline
+gcc_git=baseline
EOF
;;
*) assert_with_msg "Unknown project name: $project_name" false ;;
esac
cat >> $artifacts/trigger-build-rebase <<EOF
-linux_url=$bad_url
-linux_branch=$baseline_rev
+linux_git=$bad_url#$baseline_rev
update_baseline=reset
EOF
else
@@ -268,18 +269,18 @@ EOF
case "${rr[ci_project]}/${rr[ci_config]}" in
tcwg_bmk*/gnu*-O[23]*)
cat > $artifacts/trigger-build-reset <<EOF
-binutils_branch=baseline
-gcc_branch=baseline
-glibc_branch=baseline
+binutils_git=baseline
+gcc_git=baseline
+glibc_git=baseline
update_baseline=reset
EOF
;;
tcwg_bmk*/llvm-*-O[23]*)
cat > $artifacts/trigger-build-reset <<EOF
-binutils_branch=baseline
-gcc_branch=baseline
-glibc_branch=baseline
-llvm_branch=baseline
+binutils_git=baseline
+gcc_git=baseline
+glibc_git=baseline
+llvm_git=baseline
update_baseline=reset
EOF
;;
@@ -517,8 +518,7 @@ if [ x"$first_bad" != x"" ]; then
# a reduced bisection range.
cat > $artifacts/trigger-bisect <<EOF
current_project=$current_project
-bad_url=$bad_url
-bad_branch=$bad_last_good
+bad_git=$bad_url#$bad_last_good
EOF
sed -i -e "s/\$/-retry-bisect/" $artifacts/jenkins/build-name
# Don't send any emails.
@@ -559,8 +559,7 @@ else
if [ x"$last_good" != x"$baseline_rev" ]; then
# $reset_rev=="" due to $first_bad==""
cat > $artifacts/trigger-build-1-advance <<EOF
-${current_project}_url=$bad_url
-${current_project}_branch=$last_good
+${current_project}_git=$bad_url#$last_good
EOF
sed -i -e "s/\$/-advance-baseline/" $artifacts/jenkins/build-name
else
@@ -582,7 +581,7 @@ if ! [ -f $artifacts/build-$bad_rev/trigger-build-$current_project ]; then
assert_with_msg "No bad build during this bisect" [ x"$bad_build" != x"" ]
mkdir -p $artifacts/build-$bad_rev
cp $bad_build $artifacts/build-$bad_rev/trigger-build-$current_project
- sed -i -e "s/^${current_project}_branch=.*\$/${current_project}_branch=$bad_rev/" \
+ sed -i -e "s/^\(${current_project}_git=.*\)#.*\$/\1#$bad_rev/" \
$artifacts/build-$bad_rev/trigger-build-$current_project
fi
@@ -593,7 +592,7 @@ if [ x"$reset_rev" != x"" ]; then \
mkdir -p $artifacts/build-$reset_rev
cp $artifacts/build-$bad_rev/trigger-build-$current_project \
$artifacts/build-$reset_rev/trigger-build-$current_project
- sed -i -e "s/^${current_project}_branch=$bad_rev\$/${current_project}_branch=$reset_rev/" \
+ sed -i -e "s/^\(${current_project}_git=.*\)#$bad_rev\$/\1#$reset_rev/" \
$artifacts/build-$reset_rev/trigger-build-$current_project
fi
@@ -742,7 +741,7 @@ cat >> $artifacts/jenkins/mail-body.txt <<EOF
Build top page/logs: ${BUILD_URL}
Configuration details:
-$(cat $artifacts/manifests/build-baseline.sh | grep '_url]\|_branch]' | grep -v '="no_')
+$(cat $artifacts/manifests/build-baseline.sh | grep '_git]' | grep -v '="no_')
Reproduce builds:
<cut>
diff --git a/round-robin.sh b/round-robin.sh
index a0e7d21d..feeafae3 100644
--- a/round-robin.sh
+++ b/round-robin.sh
@@ -6,19 +6,13 @@
# Round-Robin associative array.
declare -gA rr
-# Pretty name for PROJECT's version
-#rr[PROJECT_version]
-
-# PROJECT's git url
-#rr[PROJECT_url]
-
-# PROJECT's git branch or SHA1 revision parsable by git rev-parse.
+# PROJECT's git url#branch or url#SHA1 revision parsable by git rev-parse.
# A special value "baseline" means that PROJECT is not being updated
# in this build, and its baseline branch should be used.
# In a successful build "update_baseline" step will update baseline
# branches of all PROJECTs to the current values, thus setting
# a baseline for the next build.
-#rr[PROJECT_branch]
+#rr[PROJECT_git]
# PROJECT's git SHA1 revision. These are mostly used in manifests.
#rr[PROJECT_rev]
@@ -72,7 +66,7 @@ print_updated_components ()
local delim=""
local c
for c in ${rr[components]}; do
- if [ x"${rr[${c}_branch]}" != x"baseline" ]; then
+ if [ x"${rr[${c}_git]}" != x"baseline" ]; then
echo -ne "$delim$c"
delim=${1- }
fi
@@ -156,10 +150,10 @@ clone_repo ()
local url branch
- if [ x"${rr[${project}_branch]}" != x"baseline" ]; then
+ if [ x"${rr[${project}_git]}" != x"baseline" ]; then
# Fetch and checkout from the specified repo.
- url="${rr[${project}_url]}"
- branch="${rr[${project}_branch]}"
+ url="${rr[${project}_git]%#*}"
+ branch="${rr[${project}_git]#*#}"
else
# Fetch and checkout from baseline repo.
url=$(print_baseline_repo "$project" true)
@@ -633,10 +627,9 @@ No reason to rebase base-artifacts."
for c in ${rr[components]}; do
if echo "${update_components[@]}" | tr ' ' '\n' | grep -q "^$c\$"; then
- echo "${c}_url=${rr[${c}_url]}"
- echo "${c}_branch=${rr[${c}_branch]}"
+ echo "${c}_git=${rr[${c}_git]}"
else
- echo "${c}_branch=baseline"
+ echo "${c}_git=baseline"
fi
done > $trigger_dest/trigger-build-$update_components2
done < <(${rr[breakup_updated_components]})
@@ -647,8 +640,7 @@ No reason to rebase base-artifacts."
cat > $trigger_dest/trigger-bisect <<EOF
current_project=$single_component
-bad_url=${rr[${single_component}_url]}
-bad_branch=$cur_rev
+bad_git=${rr[${single_component}_git]%#*}#$cur_rev
EOF
if [ -f $run_step_artifacts/extra-bisect-params ]; then
cat $run_step_artifacts/extra-bisect-params >> $trigger_dest/trigger-bisect
diff --git a/tcwg_bmk-build.sh b/tcwg_bmk-build.sh
index b58e3fc2..87263a59 100755
--- a/tcwg_bmk-build.sh
+++ b/tcwg_bmk-build.sh
@@ -128,10 +128,7 @@ esac
# Use baseline branches by default.
for c in ${rr[components]}; do
- rr[${c}_branch]=${rr[${c}_branch]-baseline}
- if [ x"${rr[${c}_branch]}" != x"baseline" ]; then
- obligatory_variables rr[${c}_url]
- fi
+ rr[${c}_git]=${rr[${c}_git]-baseline}
done
start_at="${start_at-default}"
diff --git a/tcwg_gnu-build.sh b/tcwg_gnu-build.sh
index 88106d0a..421f06e5 100755
--- a/tcwg_gnu-build.sh
+++ b/tcwg_gnu-build.sh
@@ -64,10 +64,7 @@ fi
# Use baseline branches by default.
for c in ${rr[components]}; do
- rr[${c}_branch]=${rr[${c}_branch]-baseline}
- if [ x"${rr[${c}_branch]}" != x"baseline" ]; then
- obligatory_variables rr[${c}_url]
- fi
+ rr[${c}_git]=${rr[${c}_git]-baseline}
done
start_at="${start_at-default}"
diff --git a/tcwg_kernel-build.sh b/tcwg_kernel-build.sh
index 2d5fc933..bb923767 100755
--- a/tcwg_kernel-build.sh
+++ b/tcwg_kernel-build.sh
@@ -51,10 +51,7 @@ esac
# Use baseline branches by default.
for c in ${rr[components]}; do
- rr[${c}_branch]=${rr[${c}_branch]-baseline}
- if [ x"${rr[${c}_branch]}" != x"baseline" ]; then
- obligatory_variables rr[${c}_url]
- fi
+ rr[${c}_git]=${rr[${c}_git]-baseline}
done
start_at="${start_at-default}"