Home | History | Annotate | Download | only in gce
      1 #!/bin/bash
      2 # Copyright 2015 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 an interop worker on GCE.
     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.
     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     --tags=allow-ssh
     38 
     39 echo 'Created GCE instance, waiting 60 seconds for it to come online.'
     40 sleep 60
     41 
     42 gcloud compute copy-files \
     43     --project="$CLOUD_PROJECT" \
     44     --zone "$ZONE" \
     45     jenkins_master.pub linux_worker_init.sh "${INSTANCE_NAME}":~
     46 
     47 gcloud compute ssh \
     48     --project="$CLOUD_PROJECT" \
     49     --zone "$ZONE" \
     50     "$INSTANCE_NAME" --command "./linux_worker_init.sh"
     51