Skip to content

Commit

Permalink
Fixed instance creation error when name too long (#28)
Browse files Browse the repository at this point in the history
* Fixed instance creation error when name too long

* Update scripts/run-tests.sh

Co-Authored-By: wgrzelak <[email protected]>

* Changed instance label to use hyphens
  • Loading branch information
jmsully authored and wgrzelak committed Aug 28, 2019
1 parent 196ab22 commit 2c62c48
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export USER="${USER:-imagebuilder}"
# Multiple arguments can be passed and has to be separated by a comma.
readonly TESTS_CUSTOM_METADATA="${TESTS_CUSTOM_METADATA:-}"

readonly INSTANCE="imagebuilder-tests-${PRE_IMAGE}-${RANDOM}"
readonly INSTANCE=$(echo "imagebuilder-tests-${PRE_IMAGE}-${RANDOM}" | md5sum | awk '{ print $1 }')
# $IMAGEBUILDER_TEST_DIR: temporary dir on vm.
readonly IMAGEBUILDER_TEST_DIR=$(mktemp --dry-run /tmp/imagebuilder-tests.XXXXXX)

Expand All @@ -55,10 +55,10 @@ echo "--> Creating a temporary instance (${INSTANCE}) ..."
gcloud_output="$(gcloud compute instances create "${INSTANCE}" \
--image="${PRE_IMAGE}" \
--zone="${ZONE}" \
--description="New instance created by imagebuilder tests" \
--description="New instance created by VM Imagebuilder tests" \
--metadata=block-project-ssh-keys=true,ssh-keys="${USER}:$(cat "${PUBLIC_SSH_KEY}")","${TESTS_CUSTOM_METADATA}" \
--machine-type=n1-standard-1 \
--labels=auto=test \
--labels=auto=test,image=${PRE_IMAGE},instance=vm-imagebuilder-tests \
--tags=imagebuilder-workers \
--format=text)"

Expand Down

0 comments on commit 2c62c48

Please sign in to comment.