diff options
Diffstat (limited to 'jenkins-helpers.sh')
-rw-r--r-- | jenkins-helpers.sh | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh index 8a66b2a9..9c0b7ff6 100644 --- a/jenkins-helpers.sh +++ b/jenkins-helpers.sh @@ -1,5 +1,16 @@ #!/bin/bash +# Print absolute path to a file or directory +# $1: Path (must exist) +abs_path () +{ + ( + set -euf -o pipefail + + echo "$(cd $(dirname "$1") && pwd)/$(basename "$1")" + ) +} + # Assert that $@ returns success. assert () { @@ -216,9 +227,12 @@ print_tester_label_for_target () # doesn't support KVM. Test on APM builders for now. echo "tcwg-apm_64-build" ;; - aarch64-linux*) echo "tcwg-tx1_64-test" ;; - armv8l-linux*) echo "tcwg-tx1_32-test" ;; - arm-linux*) echo "tcwg-tk1_32-test" ;; + # We allocate all TK1/TX1 boards to benchmarking, so use APMs + # for cross-testing. This means we no longer test on armv7 + # hardware. + aarch64-linux*) echo "tcwg-apm_64-test" ;; + armv8l-linux*) echo "tcwg-apm_32-test" ;; + arm-linux*) echo "tcwg-apm_32-test" ;; esac ) } @@ -405,6 +419,9 @@ clone_or_update_repo_no_checkout () # Also, prune all loose objects to avoid "git gc --auto" failing # and creating .git/gc.log, which will stop future "git gc --auto" runs. git -C "$dir" gc --auto --force --prune=all + # Delete stale locks -- especially .git/refs/remotes/REMOTE/BRANCH.lock + # These occur when builds are aborted during "git remote update" or similar. + find "$dir/.git" -name "*.lock" -delete fi ( @@ -739,6 +756,8 @@ manifest_out () # variables and arrays. # "--var value" defines shell variable "$var" to "value". # "++arr elem" defines shell array "$arr[@]" and adds "elem" to it. +# "==arr[key] value" defines shell associative array "$arr[@]" and sets +# "${arr[key]}" to "value". # "@@ file" sources file. # "%% file" starts manifest in file. Also see "^^ true". # "^^ true/false %% manifest" whether to reproduce the build using manifest. @@ -1025,18 +1044,13 @@ git_push () # $1: Step to start execution at (or "" to start at the very first step) # $2: Step to finish execution at (or "" to run till the very end) # $3: Top artifact directory -# $4: Top baseline artifact directory (see Note 1) -# $5: Whether to enable "set -x" verbosity for execution steps. -# -# Note 1: Artifacts for steps before $run_step_start_at/$1 will be copied over -# from $base_artifacts/$4 +# $4: Whether to enable "set -x" verbosity for execution steps. run_step_init () { run_step_start_at="$1" run_step_finish_at="$2" run_step_top_artifacts="$3" - run_step_base_artifacts="$4" - run_step_verbose="$5" + run_step_verbose="$4" run_step_count="0" run_step_prev_step="" @@ -1044,12 +1058,6 @@ run_step_init () run_step_status=0 run_step_artifacts="" - if [ x"$run_step_base_artifacts" != x"" ]; then - run_step_use_baseline=true - else - 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" @@ -1066,9 +1074,8 @@ run_step_init () # 2. artifact handling -- create/clean artifact directories per step. # Also, copy baseline artifacts for steps before START_AT to simulate # skipped steps. -# Step commands have $run_step_artifacts and $run_step_prev_artifacts -# pointing to artifact directories for current and previous step -# respectively. +# Step commands have $run_step_artifacts pointing to artifact directory +# for current step. # 3. logging -- dump stdout and and stderr output of step commands # into per-step console.log files, and, also, into the top-level # console.log file. @@ -1105,10 +1112,8 @@ run_step () if [ x"$pretty_step" = x"$run_step_start_at" \ -o x"$run_step_start_at" = x"" -a x"$run_step_prev_step" = x"" ]; then run_step_active=true - run_step_use_baseline=false fi - run_step_prev_artifacts=$run_step_artifacts run_step_artifacts=$run_step_top_artifacts/$run_step_count-$pretty_step rm -rf "$run_step_artifacts" @@ -1152,13 +1157,6 @@ run_step () assert false esac fi - elif $run_step_use_baseline; then - echo "COPYING BASE-ARTIFACTS for ${step[@]}" - local base_artifacts - base_artifacts="$run_step_base_artifacts/$(basename $run_step_artifacts)" - if [ -d "$base_artifacts" ]; then - rsync -a --del "$base_artifacts/" "$run_step_artifacts/" - fi else echo "SKIPPING ${step[@]}" fi |