Skip to content

Commit

Permalink
Re-use old status
Browse files Browse the repository at this point in the history
  • Loading branch information
j-woz committed Dec 10, 2024
1 parent 58a6349 commit fc9ae2b
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions dev/jenkins/build-mpich.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ set -eu
# if on the correct compute server!
# just set environment variable WORKSPACE
# -> Uses hard-coded dependencies from other Jenkins projects
# May SKIP running if git hash does not change,
# which re-returns prior exit code.

setopt PUSHD_SILENT
setopt PIPE_FAIL
Expand All @@ -29,6 +31,16 @@ renice --priority 19 --pid $$ >& /dev/null

source dev/helpers.sh

# Assume failure in prior runs and this run until proven otherwise
if [[ -f status-old.txt ]] {
read STATUS_OLD < status-old.txt
print "prior STATUS_OLD=$STATUS_OLD"
} else {
STATUS_OLD=-1
}

if (( $STATUS_OLD != 1 )) echo 1 > status-old.txt

# Look at timestamps left by previous runs and see if git has changed
GIT_CHANGED=1
print "New timestamp:"
Expand All @@ -41,10 +53,12 @@ if [[ -r timestamp-old.txt ]] {
GIT_CHANGED=0
fi
}
print GIT_CHANGED=$GIT_CHANGED
print "GIT_CHANGED=$GIT_CHANGED"
if (( ! GIT_CHANGED )) {
print "Git did not change - exit."
exit
print
print "SKIP: Git did not change - exit STATUS_OLD=$STATUS_OLD"
print
exit $STATUS_OLD
}
print

Expand Down Expand Up @@ -91,6 +105,9 @@ set -x
swift-t -v
swift-t -E 'trace(42);'

# SUCCESS: Store success exit code for future SKIP cases
echo 0 > status-old.txt

# Prevent future rebuild until Git changes
# or someone deletes timestamp-old.txt
cp -v timestamp-{new,old}.txt
cp -v --backup=numbered timestamp-{new,old}.txt

0 comments on commit fc9ae2b

Please sign in to comment.