Matt Kwong | b95aa40 | 2017-10-13 13:25:23 -0700 | [diff] [blame] | 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 | |
| 16 | # Creates a performance worker on GCE to be used on Kokoro. |
| 17 | |
| 18 | set -ex |
| 19 | |
| 20 | cd $(dirname $0) |
| 21 | |
| 22 | CLOUD_PROJECT=grpc-testing |
| 23 | ZONE=us-central1-b # this zone allows 32core machines |
| 24 | |
| 25 | INSTANCE_NAME="${1:-grpc-kokoro-performance-server1}" |
| 26 | MACHINE_TYPE=n1-standard-32 |
| 27 | |
| 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-1704 \ |
| 34 | --boot-disk-size 300 \ |
| 35 | --scopes https://www.googleapis.com/auth/bigquery \ |
| 36 | --tags=allow-ssh |
| 37 | |
| 38 | echo 'Created GCE instance, waiting 60 seconds for it to come online.' |
| 39 | sleep 60 |
| 40 | |
| 41 | gcloud compute copy-files \ |
| 42 | --project="$CLOUD_PROJECT" \ |
| 43 | --zone "$ZONE" \ |
| 44 | kokoro_performance.pub linux_kokoro_performance_worker_init.sh kbuilder@${INSTANCE_NAME}:~ |
| 45 | |
| 46 | gcloud compute ssh \ |
| 47 | --project="$CLOUD_PROJECT" \ |
| 48 | --zone "$ZONE" \ |
| 49 | kbuilder@${INSTANCE_NAME} --command "./linux_kokoro_performance_worker_init.sh" |