Jan Tattermusch | 3fdf18c | 2016-03-25 20:13:28 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 2 | # Copyright 2015 gRPC authors. |
Jan Tattermusch | 3fdf18c | 2016-03-25 20:13:28 -0700 | [diff] [blame] | 3 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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 |
Jan Tattermusch | 3fdf18c | 2016-03-25 20:13:28 -0700 | [diff] [blame] | 7 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
Jan Tattermusch | 3fdf18c | 2016-03-25 20:13:28 -0700 | [diff] [blame] | 9 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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. |
Jan Tattermusch | 3fdf18c | 2016-03-25 20:13:28 -0700 | [diff] [blame] | 15 | |
| 16 | # Creates an interop worker on GCE. |
Jan Tattermusch | 2a4d478 | 2016-03-30 11:17:23 -0700 | [diff] [blame] | 17 | # IMPORTANT: After this script finishes, there are still some manual |
| 18 | # steps needed there are hard to automatize. |
| 19 | # See go/grpc-jenkins-setup for followup instructions. |
Jan Tattermusch | 3fdf18c | 2016-03-25 20:13:28 -0700 | [diff] [blame] | 20 | |
| 21 | set -ex |
| 22 | |
| 23 | cd $(dirname $0) |
| 24 | |
| 25 | CLOUD_PROJECT=grpc-testing |
| 26 | ZONE=us-east1-a # canary gateway is reachable from this zone |
| 27 | |
| 28 | INSTANCE_NAME="${1:-grpc-canary-interop2}" |
| 29 | |
| 30 | gcloud compute instances create $INSTANCE_NAME \ |
| 31 | --project="$CLOUD_PROJECT" \ |
| 32 | --zone "$ZONE" \ |
| 33 | --machine-type n1-standard-16 \ |
| 34 | --image ubuntu-15-10 \ |
| 35 | --boot-disk-size 1000 \ |
| 36 | --scopes https://www.googleapis.com/auth/xapi.zoo |
| 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 | jenkins_master.pub linux_worker_init.sh ${INSTANCE_NAME}:~ |
| 45 | |
| 46 | gcloud compute ssh \ |
| 47 | --project="$CLOUD_PROJECT" \ |
| 48 | --zone "$ZONE" \ |
| 49 | $INSTANCE_NAME --command "./linux_worker_init.sh" |