Skip to content

Commit

Permalink
Merge pull request GoogleCloudPlatform#502 from rallesiardo/master
Browse files Browse the repository at this point in the history
Moving cleanup trap before the retry loop
  • Loading branch information
codrienne authored Apr 30, 2021
2 parents 767eda5 + 0bfd5ac commit cd2afd0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions remote-builder/run-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ ${GCLOUD} compute instances create \
--metadata block-project-ssh-keys=TRUE \
--metadata-from-file ssh-keys=ssh-keys

trap cleanup EXIT

RETRY_COUNT=1
while [ "$(ssh 'printf pass')" != "pass" ]; do
echo "[Try $RETRY_COUNT of $RETRIES] Waiting for instance to start accepting SSH connections..."
Expand All @@ -49,8 +51,6 @@ while [ "$(ssh 'printf pass')" != "pass" ]; do
RETRY_COUNT=$(($RETRY_COUNT+1))
done

trap cleanup EXIT

${GCLOUD} compute scp --compress --recurse \
$(pwd) ${USERNAME}@${INSTANCE_NAME}:${REMOTE_WORKSPACE} \
--ssh-key-file=${KEYNAME}
Expand Down

0 comments on commit cd2afd0

Please sign in to comment.