101
101
# BRANCH_NAME Git branch name.
102
102
# Default is determined by calling 'git branch'.
103
103
#
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
105
105
# the k8s cluster that indicates that no other
106
106
# run.sh should attempt to use the cluster, and (B)
107
107
# delete this lease when run.sh completes.
108
108
# If "true" the caller must previously
109
109
# 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
111
111
# to a process that's expected to continue
112
112
# throughout the run (typically the parent
113
- # process).
113
+ # process) or some uuid potentially generated by uuidgen
114
+ # command or some-such..
114
115
#
115
116
# The following additional overrides are currently only used when
116
117
# WERCKER=true:
205
206
}
206
207
207
208
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
209
210
# 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
211
212
# how to obtain the lease prior to calling run.sh.
212
213
function renewLease {
213
- if [ ! " $LEASE_PID " = " " ]; then
214
+ if [ ! " $LEASE_ID " = " " ]; then
214
215
# RESULT_DIR may not have been created yet, so use /tmp
215
216
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
217
218
if [ $? -ne 0 ]; then
218
219
trace " Lease renew error:"
219
220
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
222
223
echo " Some of the potential reasons for this failure are that another run" >> $outfile
223
224
echo " may have obtained the lease, the lease may have been externally " >> $outfile
224
225
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
226
227
echo " To force delete a lease no matter who owns the lease," >> $outfile
227
228
echo " call 'lease.sh -f' or 'kubernetes delete cm acceptance-test-lease'" >> $outfile
228
229
echo " (this should only be done when sure there's no current run.sh " >> $outfile
229
230
echo " that owns the lease). To view the current lease holder," >> $outfile
230
231
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
233
234
echo " " >> $outfile
234
235
cat $outfile
235
236
fail " Could not renew lease on k8s cluster"
@@ -383,7 +384,7 @@ function state_dump {
383
384
local PV_ROOT=" ` cat /tmp/test_suite.pv_root` "
384
385
local PROJECT_ROOT=" ` cat /tmp/test_suite.project_root` "
385
386
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 ` "
387
388
388
389
if [ ! -d " $RESULT_DIR " ]; then
389
390
trace State dump exiting early. RESULT_DIR \" $RESULT_DIR \" does not exist or is not a directory.
@@ -439,9 +440,9 @@ function state_dump {
439
440
trace Job failed. See ${outfile} .
440
441
fi
441
442
442
- if [ ! " $LEASE_PID " = " " ]; then
443
+ if [ ! " $LEASE_ID " = " " ]; then
443
444
# 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
445
446
if [ " $? " = " 0" ]; then
446
447
trace Lease released.
447
448
else
@@ -2448,7 +2449,7 @@ function test_suite_init {
2448
2449
WEBLOGIC_IMAGE_PULL_SECRET_NAME \
2449
2450
WERCKER \
2450
2451
JENKINS \
2451
- LEASE_PID ;
2452
+ LEASE_ID ;
2452
2453
do
2453
2454
trace " Customizable env var before: $varname =${! varname} "
2454
2455
done
@@ -2464,7 +2465,7 @@ function test_suite_init {
2464
2465
[ ! " $? " = " 0" ] && fail " Error: Could not determine branch. Run script from within a git repo" .
2465
2466
fi
2466
2467
2467
- export LEASE_PID= ${LEASE_PID}
2468
+ export LEASE_ID= " ${LEASE_ID} "
2468
2469
2469
2470
# The following customizable exports are currently only customized by WERCKER
2470
2471
export IMAGE_TAG_OPERATOR=${IMAGE_TAG_OPERATOR:- `echo " test_${BRANCH_NAME} " | sed " s#/#_#g" `}
@@ -2490,7 +2491,7 @@ function test_suite_init {
2490
2491
WEBLOGIC_IMAGE_PULL_SECRET_NAME \
2491
2492
WERCKER \
2492
2493
JENKINS \
2493
- LEASE_PID ;
2494
+ LEASE_ID ;
2494
2495
do
2495
2496
trace " Customizable env var after: $varname =${! varname} "
2496
2497
done
@@ -2513,7 +2514,7 @@ function test_suite_init {
2513
2514
echo " ${RESULT_ROOT} " > /tmp/test_suite.result_root
2514
2515
echo " ${PV_ROOT} " > /tmp/test_suite.pv_root
2515
2516
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
2517
2518
2518
2519
# Declare we're in a test. We did not declare at the start
2519
2520
# of the function to ensure that any env vars that might
0 commit comments