File tree Expand file tree Collapse file tree
tools/cloud-build/daily-tests/ansible_playbooks/tasks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,6 +60,10 @@ FINISH_LINE="startup-script exit status"
6060# Match string for failures on the new guest agent
6161FINISH_LINE_ERR=" Script.*failed with error:"
6262
63+ # NEW: Accept also these finish lines as success.
64+ STARTUP_SCRIPT_SUCCEEDED_LINE=" google-startup-scripts.service: Succeeded."
65+ STARTUP_SCRIPT_FINISHED_LINE=" Finished Google Compute Engine Startup Scripts."
66+
6367NON_FATAL_ERRORS=(
6468 " Internal error"
6569)
@@ -68,7 +72,7 @@ until [[ now -gt deadline ]]; do
6872 ser_log=$(
6973 set -o pipefail
7074 ${fetch_cmd} 2> " ${error_file} " |
71- c1grep " ${FINISH_LINE} \|${FINISH_LINE_ERR} "
75+ c1grep " ${FINISH_LINE} \|${FINISH_LINE_ERR} \| ${STARTUP_SCRIPT_SUCCEEDED_LINE} \| ${STARTUP_SCRIPT_FINISHED_LINE} "
7276 ) || {
7377 err=$( cat " ${error_file} " )
7478 echo " $err "
@@ -100,6 +104,12 @@ if [[ "${STATUS}" == 0 ]]; then
100104elif [[ " ${STATUS} " == 1 ]]; then
101105 echo " startup-script finished with errors, ${INSPECT_OUTPUT_TEXT} "
102106 echo " ${fetch_cmd} "
107+ elif echo " ${ser_log} " | grep -qE " ${STARTUP_SCRIPT_SUCCEEDED_LINE} " ; then
108+ echo " startup-script finished successfully (startup script succeeded line detected)"
109+ exit 0
110+ elif echo " ${ser_log} " | grep -qE " ${STARTUP_SCRIPT_FINISHED_LINE} " ; then
111+ echo " startup-script finished successfully (startup script finished line detected)"
112+ exit 0
103113elif [[ now -ge deadline ]]; then
104114 echo " startup-script timed out after ${TIMEOUT} seconds"
105115 echo " ${INSPECT_OUTPUT_TEXT} "
Original file line number Diff line number Diff line change 1919
2020- name : Wait for startup script to complete
2121 become : true
22- ansible.builtin.shell : journalctl -u google-startup-scripts.service -b | grep "Started Google Compute Engine Startup Scripts."
22+ ansible.builtin.shell : journalctl -u google-startup-scripts.service -b | grep -E "Started Google Compute Engine Startup Scripts\.|Finished Google Compute Engine Startup Scripts\.|Finished google-startup-scripts.service - Google Compute Engine Startup Scripts\ ."
2323 register : result
2424 until : result.rc == 0
2525 retries : " {{ (timeout_seconds/5)|int }}"
You can’t perform that action at this time.
0 commit comments