create_linux_kokoro_performance_worker.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. # Copyright 2017 gRPC authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # Creates a performance worker on GCE to be used on Kokoro.
  16. # IMPORTANT: Instructions for updating
  17. # If the VM configuration / installed software is updated,
  18. # - all existing performance worker VMs need to be updated to reflect the changes
  19. # - a new GCE image named "grpc-performance-kokoro-v1" needs to be created,
  20. # incrementing the version number.
  21. # - kokoro jobs need to be reconfigured to use the new image version
  22. set -ex
  23. cd "$(dirname "$0")"
  24. CLOUD_PROJECT=grpc-testing
  25. ZONE=us-central1-b # this zone allows 32core machines
  26. INSTANCE_NAME="${1:-grpc-kokoro-performance-server1}"
  27. MACHINE_TYPE=e2-standard-32
  28. gcloud compute instances create "$INSTANCE_NAME" \
  29. --project="$CLOUD_PROJECT" \
  30. --zone "$ZONE" \
  31. --machine-type $MACHINE_TYPE \
  32. --image-project ubuntu-os-cloud \
  33. --image-family ubuntu-1804-lts \
  34. --boot-disk-size 300 \
  35. --scopes https://www.googleapis.com/auth/bigquery \
  36. --tags=allow-ssh
  37. echo 'Created GCE instance, waiting 60 seconds for it to come online.'
  38. sleep 60
  39. gcloud compute copy-files \
  40. --project="$CLOUD_PROJECT" \
  41. --zone "$ZONE" \
  42. kokoro_performance.pub linux_kokoro_performance_worker_init.sh "kbuilder@${INSTANCE_NAME}":~
  43. gcloud compute ssh \
  44. --project="$CLOUD_PROJECT" \
  45. --zone "$ZONE" \
  46. "kbuilder@${INSTANCE_NAME}" --command "./linux_kokoro_performance_worker_init.sh"