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 a standard jenkins worker on GCE. 17 18 set -ex 19 20 cd "$(dirname "$0")" 21 22 CLOUD_PROJECT=grpc-testing 23 ZONE=us-central1-a 24 25 INSTANCE_NAME="${1:-grpc-jenkins-worker1}" 26 27 gcloud compute instances create "$INSTANCE_NAME" \ 28 --project="$CLOUD_PROJECT" \ 29 --zone "$ZONE" \ 30 --machine-type n1-standard-16 \ 31 --image=ubuntu-1510 \ 32 --image-project=grpc-testing \ 33 --boot-disk-size 1000 \ 34 --scopes https://www.googleapis.com/auth/bigquery \ 35 --tags=allow-ssh 36 37 echo 'Created GCE instance, waiting 60 seconds for it to come online.' 38 sleep 60 39 40 gcloud compute copy-files \ 41 --project="$CLOUD_PROJECT" \ 42 --zone "$ZONE" \ 43 jenkins_master.pub linux_worker_init.sh "${INSTANCE_NAME}":~ 44 45 gcloud compute ssh \ 46 --project="$CLOUD_PROJECT" \ 47 --zone "$ZONE" \ 48 "$INSTANCE_NAME" --command "./linux_worker_init.sh" 49