#!/bin/bash
# Get Job Header
# Usage: gjh.sh <job>
# where <job> can be specifie as the job name, like SDP-570 or simply 570.
#------------------------------------------------------------------------------
# Version ID Block. Relies on +k filetype modifier.
# VersionID='$Id: //p4-sdp/dev_c2s/tools/gjh.sh#2 $ $Change: 31472 $'
declare ThisScript="${0##*/}"
declare JobBaseURL="https://swarm.workshop.perforce.com/jobs"
declare Job=
declare JobURL=
declare JobHeader=
declare JobKey="SDP"
declare JobType=
declare TmpDir=
if [[ $# -lt 1 ]]; then
echo -e "\\nUsage: $ThisScript <Job>\\n\\ne.g.\\n\\t$ThisScript ${JobKey}-570\\n\\n${JobKey}-570 can be shortened to just 570."
exit 1
fi
TmpDir=$(mktemp -d)
cd "$TmpDir"
for Job in $*; do
[[ "$Job" =~ ^[0-9]+$ ]] && Job="${JobKey}-$Job"
JobURL="$JobBaseURL/$Job"
curl -s -k -O "$JobURL"
JobHeader=$(grep 'first-line' $Job|head -1|sed -E -e 's/^.*first-line">//g' -e 's#</span.*$##g' -e 's#<a href=".*">##g' -e 's#</a>##g' -e "s:':':g" -e "s:":\":g" -e "s:<:<:g" -e "s:>:>:g")
JobType=$(grep -E -A1 'Type.*</dt>' $Job | tail -1 | sed -E -e 's/^.*first-line">//g' -e 's#<.*$##g')
echo -e "$Job ($JobType): $JobHeader\\n$JobURL\\n"
done
cd "$OLDPWD" || exit 1
rm -rf "$TmpDir"
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #2 | 31472 | C. Thomas Tyler |
Updated bash scripts and bash template to new file versioning scheme. Modernized template bash script. |
||
| #1 | 31399 | C. Thomas Tyler | Populate -r -S //p4-sdp/dev_c2s. | ||
| //p4-sdp/dev/tools/gjh.sh | |||||
| #1 | 31397 | C. Thomas Tyler | Populate -b SDP_Classic_to_Streams -s //guest/perforce_software/sdp/...@31368. | ||
| //guest/perforce_software/sdp/tools/gjh.sh | |||||
| #5 | 28885 | C. Thomas Tyler | Refined gjs.sh "Get Job Summary" script. | ||
| #4 | 28170 | C. Thomas Tyler |
Added job type to the job header as reported by gjh.sh. Fixed issue with hyperlinks in header. |
||
| #3 | 27550 | C. Thomas Tyler | More translations. | ||
| #2 | 27546 | C. Thomas Tyler | Added fix for handling single and double quotes. | ||
| #1 | 27456 | C. Thomas Tyler | Added simple tool for getting the job header. | ||