From e0b5b8901c07ac7883f0487c54b03e80b640e3d6 Mon Sep 17 00:00:00 2001 From: Maxim Kuvyrkov Date: Mon, 21 Jan 2019 15:58:22 +0000 Subject: tcwg_kernel-bisect.sh: Avoid absolute paths in manifests ... and their use in reproduction instructions. Also - download build-parameter.sh in instructions that test.sh relies on - use curl instead of wget in instuctions - limit commit output to 1000 lines in the email body. Change-Id: Ib3b0cb94134a588e3a8c72fd7261b70d83935450 --- jenkins-helpers.sh | 9 ++++++-- round-robin.sh | 6 +++--- tcwg_kernel-bisect.sh | 58 +++++++++++++++++++++++++++++++-------------------- 3 files changed, 45 insertions(+), 28 deletions(-) diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh index b4b1b112..10b7081a 100644 --- a/jenkins-helpers.sh +++ b/jenkins-helpers.sh @@ -35,8 +35,8 @@ fresh_dir () break fi # This assert will trigger if one of keep_patterns doesn't start - # with "$dir". - assert [ "$keep_pattern" != "." ] + # with "$dir": eventually dirname will get to either "/" or ".". + assert [ "$keep_pattern" != "/" -a "$keep_pattern" != "." ] done done @@ -1040,6 +1040,11 @@ run_step_init () run_step_use_baseline=false fi + # We need absolute paths for $run_step_artifacts, which is constructed from + # $run_step_top_artifacts. + mkdir -p "$run_step_top_artifacts" + run_step_top_artifacts=$(cd "$run_step_top_artifacts"; pwd) + rm -f $run_step_top_artifacts/console.log rm -f $run_step_top_artifacts/results } diff --git a/round-robin.sh b/round-robin.sh index 8f4fdae2..a09ef49c 100644 --- a/round-robin.sh +++ b/round-robin.sh @@ -48,10 +48,10 @@ reset_artifacts () # - ${rr[top_artifacts]}/console.log and $run_step_artifacts/console.log, which # are being written to by run_step(). # - ${rr[top_artifacts]}/jenkins/*, which is cleaned by tcwg_kernel.yaml. - fresh_dir ${rr[top_artifacts]} \ - ${rr[top_artifacts]}/console.log \ + fresh_dir $run_step_top_artifacts \ + $run_step_top_artifacts/console.log \ $run_step_artifacts/console.log \ - "${rr[top_artifacts]}/jenkins/*" + "$run_step_top_artifacts/jenkins/*" local single_branch=${rr[baseline_branch]} diff --git a/tcwg_kernel-bisect.sh b/tcwg_kernel-bisect.sh index 265aa34d..61876313 100755 --- a/tcwg_kernel-bisect.sh +++ b/tcwg_kernel-bisect.sh @@ -5,7 +5,10 @@ set -ef -o pipefail scripts=$(dirname $0) . $scripts/jenkins-helpers.sh -artifacts=$(pwd)/artifacts +# Relative artifacts are used for generation of manifests and reproduction +# instructions. +rel_artifacts=artifacts +artifacts=$(pwd)/$rel_artifacts fresh_dir $artifacts "$artifacts/manifests/*" "$artifacts/jenkins/*" @@ -41,12 +44,12 @@ trap "eval \"echo ERROR at \${FUNCNAME[0]}:\${BASH_LINENO[0]}\" > $artifacts/fai echo "Testing baseline_rev $baseline_rev (should be success)" $build_script \ ^^ $reproduce_bisect \ - %% $artifacts/manifests/build-baseline.sh \ - @@ $artifacts/manifests/build-parameters.sh \ + %% $rel_artifacts/manifests/build-baseline.sh \ + @@ $rel_artifacts/manifests/build-parameters.sh \ --mode "baseline" \ --current_branch "$baseline_rev" \ --reset_baseline true \ - --top_artifacts "$artifacts/build-baseline" \ + --top_artifacts "$rel_artifacts/build-baseline" \ --verbose "$verbose" assert ! [ -f $artifacts/failures ] @@ -92,20 +95,20 @@ rev=\$(git rev-parse HEAD) cd .. $build_script \ ^^ $reproduce_bisect \ - %% $artifacts/manifests/build-\$rev.sh \ - @@ $artifacts/manifests/build-parameters.sh \ + %% $rel_artifacts/manifests/build-\$rev.sh \ + @@ $rel_artifacts/manifests/build-parameters.sh \ --mode bisect \ - --top_artifacts $artifacts/build-\$rev \ + --top_artifacts $rel_artifacts/build-\$rev \ --verbose "$verbose" & res=0 && wait \$! || res=\$? -if [ -f $artifacts/build-\$rev/failures ]; then - echo "\$rev" >> $artifacts/bad_revs +if [ -f $rel_artifacts/build-\$rev/failures ]; then + echo "\$rev" >> $rel_artifacts/bad_revs exit 1 elif [ x"\$res" != x"0" ]; then - echo "\$rev" >> $artifacts/skipped_revs + echo "\$rev" >> $rel_artifacts/skipped_revs exit 125 else - echo "\$rev" >> $artifacts/good_revs + echo "\$rev" >> $rel_artifacts/good_revs exit 0 fi EOF @@ -297,33 +300,42 @@ to (for $bad_name == $bad_sha1) $(cat $artifacts/build-$bad_sha1/results) -Artifacts of $good_name build: ${BUILD_URL}artifact/artifacts/build-$good_sha1/ -Artifacts of $bad_name build: ${BUILD_URL}artifact/artifacts/build-$bad_sha1/ +Artifacts of $good_name build: ${BUILD_URL}artifact/$rel_artifacts/build-$good_sha1/ +Artifacts of $bad_name build: ${BUILD_URL}artifact/$rel_artifacts/build-$bad_sha1/ Reproduce builds: mkdir investigate-$current_project-$bad_sha1 cd investigate-$current_project-$bad_sha1 + git clone https://git.linaro.org/toolchain/jenkins-scripts -wget ${BUILD_URL}artifact/artifacts/manifests/build-baseline.sh -$build_script @@ build-baseline.sh -wget ${BUILD_URL}artifact/artifacts/manifests/build-parameters.sh -wget ${BUILD_URL}artifact/artifacts/test.sh -chmod +x test.sh + +mkdir -p $rel_artifacts/manifests +curl -o $rel_artifacts/manifests/build-baseline.sh ${BUILD_URL}artifact/$rel_artifacts/manifests/build-baseline.sh +curl -o $rel_artifacts/manifests/build-parameters.sh ${BUILD_URL}artifact/$rel_artifacts/manifests/build-parameters.sh +curl -o $rel_artifacts/test.sh ${BUILD_URL}artifact/$rel_artifacts/test.sh +chmod +x $rel_artifacts/test.sh + +# Reproduce the baseline build (build all pre-requisites) +$build_script @@ $rel_artifacts/manifests/build-baseline.sh + cd $current_project + # Reproduce $bad_name build git checkout --detach $bad_sha1 -../test.sh +../$rel_artifacts/test.sh + # Reproduce $good_name build git checkout --detach $good_sha1 -../test.sh +../$rel_artifacts/test.sh + cd .. History of pending regressions and results: https://git.linaro.org/toolchain/ci/base-artifacts.git/log/?h=linaro-local/ci/$ci_project/$ci_config -Bisect log: ${BUILD_URL}artifact/artifacts/bisect.log/*view*/ -Artifacts: ${BUILD_URL}artifact/artifacts/ +Bisect log: ${BUILD_URL}artifact/$rel_artifacts/bisect.log/*view*/ +Artifacts: ${BUILD_URL}artifact/$rel_artifacts/ Build URL: $BUILD_URL Build log: ${BUILD_URL}consoleText EOF @@ -333,7 +345,7 @@ if [ -f $artifacts/first-bad ]; then Full commit: -$(git -C $current_project show $first_bad) +$(git -C $current_project show --stat --patch $first_bad | head -n 1000) EOF fi -- cgit v1.2.3