Fix host reuse for e2e tests

This will now filter the hosts in gcloud by project, instance name and
zone, to make sure we only reuse the correct hosts. Previously it would
try to reuse images outside the selected zone, resulting in a crash.

The resulting command will look like this:
$ gcloud compute instances list --project="my-project-123" --filter="name:'test-cos-beta-78-12499-16-0' AND zone:'europe-west6-b'"
This commit is contained in:
Odin Ugedal
2019-09-29 11:10:08 +02:00
parent 29f23e6647
commit d17dc136a0

View File

@@ -117,7 +117,7 @@ if [ "${remote}" = true ] ; then
IFS=',' read -ra IM <<< "${images}"
images=""
for i in "${IM[@]}"; do
if gcloud compute instances list "${instance_prefix}-${i}" | grep "${i}"; then
if gcloud compute instances list --project="${project}" --filter="name:'${instance_prefix}-${i}' AND zone:'${zone}'" | grep "${i}"; then
if [[ "${hosts}" != "" ]]; then
hosts="${hosts},"
fi