101101# BRANCH_NAME Git branch name.
102102# Default is determined by calling 'git branch'.
103103#
104- # LEASE_PID Set to a PID to (A) periodically renew a lease on
104+ # LEASE_ID Set to a unique value to (A) periodically renew a lease on
105105# the k8s cluster that indicates that no other
106106# run.sh should attempt to use the cluster, and (B)
107107# delete this lease when run.sh completes.
108108# If "true" the caller must previously
109109# obtain the lease external to the run.sh
110- # using "lease.sh -o $LEASE_PID ", where PID corresponds
110+ # using "lease.sh -o $LEASE_ID ", where ID corresponds
111111# to a process that's expected to continue
112112# throughout the run (typically the parent
113- # process).
113+ # process) or some uuid potentially generated by uuidgen
114+ # command or some-such..
114115#
115116# The following additional overrides are currently only used when
116117# WERCKER=true:
205206}
206207
207208
208- # Attempt to renew the k8s lease if $LEASE_PID is set. This should be called
209+ # Attempt to renew the k8s lease if $LEASE_ID is set. This should be called
209210# every few minutes throughout the run, and is currently called at the start
210- # of each test. See LEASE_PID instructions above for instructions about
211+ # of each test. See LEASE_ID instructions above for instructions about
211212# how to obtain the lease prior to calling run.sh.
212213function renewLease {
213- if [ ! " $LEASE_PID " = " " ]; then
214+ if [ ! " $LEASE_ID " = " " ]; then
214215 # RESULT_DIR may not have been created yet, so use /tmp
215216 local outfile=/tmp/acc_test_renew_lease.out
216- $SCRIPTPATH /lease.sh -r $LEASE_PID > $outfile 2>&1
217+ $SCRIPTPATH /lease.sh -r " $LEASE_ID " > $outfile 2>&1
217218 if [ $? -ne 0 ]; then
218219 trace " Lease renew error:"
219220 echo " " >> $outfile
220- echo " ERROR: Could not renew lease on k8s cluster for LEASE_PID= $LEASE_PID ." >> $outfile
221- echo " Used '$SCRIPTPATH /lease.sh -r $LEASE_PID ' to try renew the lease." >> $outfile
221+ echo " ERROR: Could not renew lease on k8s cluster for LEASE_ID= \" $LEASE_ID \" ." >> $outfile
222+ echo " Used '$SCRIPTPATH /lease.sh -r \" $LEASE_ID \" ' to try renew the lease." >> $outfile
222223 echo " Some of the potential reasons for this failure are that another run" >> $outfile
223224 echo " may have obtained the lease, the lease may have been externally " >> $outfile
224225 echo " deleted, or the caller of run.sh may have forgotten to obtain the" >> $outfile
225- echo " lease before calling run.sh (using 'lease.sh -o $LEASE_PID '). " >> $outfile
226+ echo " lease before calling run.sh (using 'lease.sh -o \" $LEASE_ID \" '). " >> $outfile
226227 echo " To force delete a lease no matter who owns the lease," >> $outfile
227228 echo " call 'lease.sh -f' or 'kubernetes delete cm acceptance-test-lease'" >> $outfile
228229 echo " (this should only be done when sure there's no current run.sh " >> $outfile
229230 echo " that owns the lease). To view the current lease holder," >> $outfile
230231 echo " use 'lease.sh -s'. To disable this lease check, do not set" >> $outfile
231- echo " the LEASE_PID environment variable. For more information, see" >> $outfile
232- echo " LEASE_PID in the instructions embedded at the top of run.sh." >> $outfile
232+ echo " the LEASE_ID environment variable. For more information, see" >> $outfile
233+ echo " LEASE_ID in the instructions embedded at the top of run.sh." >> $outfile
233234 echo " " >> $outfile
234235 cat $outfile
235236 fail " Could not renew lease on k8s cluster"
@@ -383,7 +384,7 @@ function state_dump {
383384 local PV_ROOT=" ` cat /tmp/test_suite.pv_root` "
384385 local PROJECT_ROOT=" ` cat /tmp/test_suite.project_root` "
385386 local SCRIPTPATH=" $PROJECT_ROOT /src/integration-tests/bash"
386- local LEASE_PID =" ` cat /tmp/test_suite.lease_pid ` "
387+ local LEASE_ID =" ` cat /tmp/test_suite.lease_id ` "
387388
388389 if [ ! -d " $RESULT_DIR " ]; then
389390 trace State dump exiting early. RESULT_DIR \" $RESULT_DIR \" does not exist or is not a directory.
@@ -439,9 +440,9 @@ function state_dump {
439440 trace Job failed. See ${outfile} .
440441 fi
441442
442- if [ ! " $LEASE_PID " = " " ]; then
443+ if [ ! " $LEASE_ID " = " " ]; then
443444 # release the lease if we own it
444- ${SCRIPTPATH} /lease.sh -d $LEASE_PID > ${RESULT_DIR} /release_lease.out 2>&1
445+ ${SCRIPTPATH} /lease.sh -d " $LEASE_ID " > ${RESULT_DIR} /release_lease.out 2>&1
445446 if [ " $? " = " 0" ]; then
446447 trace Lease released.
447448 else
@@ -2448,7 +2449,7 @@ function test_suite_init {
24482449 WEBLOGIC_IMAGE_PULL_SECRET_NAME \
24492450 WERCKER \
24502451 JENKINS \
2451- LEASE_PID ;
2452+ LEASE_ID ;
24522453 do
24532454 trace " Customizable env var before: $varname =${! varname} "
24542455 done
@@ -2464,7 +2465,7 @@ function test_suite_init {
24642465 [ ! " $? " = " 0" ] && fail " Error: Could not determine branch. Run script from within a git repo" .
24652466 fi
24662467
2467- export LEASE_PID= ${LEASE_PID}
2468+ export LEASE_ID= " ${LEASE_ID} "
24682469
24692470 # The following customizable exports are currently only customized by WERCKER
24702471 export IMAGE_TAG_OPERATOR=${IMAGE_TAG_OPERATOR:- `echo " test_${BRANCH_NAME} " | sed " s#/#_#g" `}
@@ -2490,7 +2491,7 @@ function test_suite_init {
24902491 WEBLOGIC_IMAGE_PULL_SECRET_NAME \
24912492 WERCKER \
24922493 JENKINS \
2493- LEASE_PID ;
2494+ LEASE_ID ;
24942495 do
24952496 trace " Customizable env var after: $varname =${! varname} "
24962497 done
@@ -2513,7 +2514,7 @@ function test_suite_init {
25132514 echo " ${RESULT_ROOT} " > /tmp/test_suite.result_root
25142515 echo " ${PV_ROOT} " > /tmp/test_suite.pv_root
25152516 echo " ${PROJECT_ROOT} " > /tmp/test_suite.project_root
2516- echo " ${LEASE_PID } " > /tmp/test_suite.lease_pid
2517+ echo " ${LEASE_ID } " > /tmp/test_suite.lease_id
25172518
25182519 # Declare we're in a test. We did not declare at the start
25192520 # of the function to ensure that any env vars that might
0 commit comments