Skip to content

Commit 9b8ab9b

Browse files
committed
updating startup script wait message to fix build failures.
1 parent ccdf225 commit 9b8ab9b

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

community/modules/scripts/wait-for-startup/scripts/wait-for-startup-status.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ FINISH_LINE="startup-script exit status"
6060
# Match string for failures on the new guest agent
6161
FINISH_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+
6367
NON_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
100104
elif [[ "${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
103113
elif [[ now -ge deadline ]]; then
104114
echo "startup-script timed out after ${TIMEOUT} seconds"
105115
echo "${INSPECT_OUTPUT_TEXT}"

tools/cloud-build/daily-tests/ansible_playbooks/tasks/wait-for-startup-script.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
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 }}"

0 commit comments

Comments
 (0)