push_bins.sh #4

  • //
  • p4-sdp/
  • dev_rebrand/
  • test/
  • bsw/
  • push_bins.sh
  • View
  • Commits
  • Open Download .zip Download (1 KB)
#!/bin/bash
set -u

#------------------------------------------------------------------------------
# Version ID Block. Relies on +k filetype modifier.
# VersionID='$Id: //p4-sdp/dev_rebrand/test/bsw/push_bins.sh#4 $ $Change: 31800 $'

declare -i ErrorCount=0
declare -i Debug=0
declare -i HostCount=0
declare Timeout=5s
declare Host=
declare -i HostFailCount=0
declare -a HostFailList
declare RsyncCmd=

function msg () { echo -e "$*"; }
function dbg () { [[ "$Debug" -eq 0 ]] || msg "DEBUG: $*"; }
function errmsg () { msg "\\nError: ${1:-Unknown Error}\\n"; ErrorCount+=1; }
function bail () { errmsg "${1:-Unkown Error}"; exit "${2:-1}"; }

for Host in p4-0{2..5}; do
   echo Host=$Host
   for Dir in /p4/sdp/p4_binaries; do
      RsyncCmd="rsync -e \"ssh -q\" -av \"$Dir/\" \"$Host:$Dir\""
      msg "Running: $RsyncCmd"
      if ! eval timeout $Timeout $RsyncCmd; then
         errmsg "Could not do: $RsyncCmd"
         HostFailList[HostFailCount]="$Host"
         HostFailCount+=1
      fi
   done
   HostCount+=1
done

if [[ "$ErrorCount" -eq 0 ]]; then

   msg "\\nSuccess: Push Bins completed OK to $HostCount hosts."
else
   msg "\\nPush Bins attempted to $HostCount hosts; $ErrorCount errors encountered for these hosts: ${HostFailList[@]}."
fi
# Change User Description Committed
#4 31800 C. Thomas Tyler Adapted push_bins.sh and push_sdp.sh utility scripts for use with Battle
School to BSW Gen7 topology host names.
#3 31617 C. Thomas Tyler Merged work from dev_c2s (development) stream to sibling dev_rebrand (sparsedev) stream.
#2 31615 C. Thomas Tyler First pass at rebranding changes, including:
* Changes to remove 'swarm.' from Workshop URLS, so swarm.workshop -> workshop.
* Changed URL for Copyright.
* Renamed get_helix_binaries.sh -> get_p4_binaries.sh, with associated directory and doc changes.
* Accounted for rename of HAS -> P4AS.
* Changed HMS references to P4MS.
* Replaced "Helix" and "Helix Core" references.
* Renamed variables to reduce tech debt buildup induced by rebranding.
* Changed default mount points:
/hxdepots[-1,N] -> /p4depots[-1,N]
/hxmetadata[1,2] -> /p4db[-1,2]
/hxlogs -> /p4logs

Also made some changes related to rebranding going out with r25.1.
#1 31590 C. Thomas Tyler Populate stream //p4-sdp/dev_rebrand from //p4-sdp/dev.
//p4-sdp/dev/test/bsw/push_bins.sh
#1 31397 C. Thomas Tyler Populate -b SDP_Classic_to_Streams -s //guest/perforce_software/sdp/...@31368.
//guest/perforce_software/sdp/dev/test/bsw/push_bins.sh
#3 30641 C. Thomas Tyler Fixed issue reporting list of missed pushes.
#2 30633 C. Thomas Tyler Improved error messages.
#1 30624 C. Thomas Tyler Added scripts to support testing in BSW Lab Environment.