#!/bin/bash # This scripts iterates over a base-artifact BRANCH and for each base-artifact : # - recreates the dashboard directory if necessary # - push the results to squad # # Example to push a base-artifacts branch : # dashboard-push-one-branch.sh --top_artifacts base-artifacts --baseline_branch linaro-local/ci/tcwg_bmk_gnu_apm/gnu-master-aarch64-spec2k6-Os_LTO # # This required the squad project to exist set -e dryrun=false # shellcheck source=jenkins-helpers.sh . "$(dirname $0)/jenkins-helpers.sh" # shellcheck source=round-robin.sh . "$(dirname $0)/round-robin.sh" convert_args_to_variables "$@" obligatory_variables top_artifacts baseline_branch declare top_artifacts baseline_branch # rebuild component list from the artifacts state. get_components() { ( local components="" manifest="" [ -f "$top_artifacts/manifest.sh" ] && manifest=manifest.sh [ -f "$top_artifacts/jenkins/manifest.sh" ] && manifest=jenkins/manifest.sh [ x"$manifest" == x"" ] && error "Manifest not found" # shellcheck disable=SC1090 source $top_artifacts/$manifest for c in binutils gcc glibc llvm linux; do if [ -f $top_artifacts/git/${c}_rev ] || [ -v rr[${c}_rev] ] ; then components="$components $c" fi done echo $components ) } # --------------------------- MAIN PROCEDURE -------------------------------- gitserver=https://git-us.linaro.org/toolchain/ci/base-artifacts.git top_artifacts=base-artifacts baseline_branch=${baseline_branch#refs/heads/} if [ ! -d $top_artifacts ]; then git clone --single-branch --branch empty $gitserver $top_artifacts fi echo "# base_artifact : fetch $baseline_branch" git -C $top_artifacts reset -q --hard git -C $top_artifacts fetch -q origin $baseline_branch git -C $top_artifacts clean -d -f git -C $top_artifacts checkout -q FETCH_HEAD git -C $top_artifacts branch -f $baseline_branch FETCH_HEAD for sha1 in $(git -C $top_artifacts log FETCH_HEAD --pretty=%H | tac); do ( echo "# base-artifact : rev=$sha1 ($baseline_branch)" git -C $top_artifacts reset -q --hard git -C $top_artifacts checkout -q -f $sha1 if [ -f $top_artifacts/dashboard/dashboard-generate.sh ] && [ -f $top_artifacts/dashboard/dashboard-push.sh ]; then # If dashboard-generate.sh already exists : just run it. $top_artifacts/dashboard/dashboard-generate.sh $top_artifacts/dashboard/dashboard-push.sh else # Otherwise, create dashboard-generate.sh & dashboard-push.sh # and run them declare -A rr rr[top_artifacts]=$top_artifacts rr[baseline_branch]=$baseline_branch rr[components]=$(get_components) rr[start_date]=$(git -C $top_artifacts show --no-patch --pretty="%ct" HEAD) # create dashboard-generate.sh & dashboard-push.sh, # run dashboard-generate.sh create_dashboard_dir # run dashboard-push.sh if ! $dryrun; then $top_artifacts/dashboard/dashboard-push.sh fi fi # clean artifacts dir git -C $top_artifacts clean -d -f ) done