diff options
Diffstat (limited to 'tools/gce_setup/grpc_docker.sh')
-rwxr-xr-x | tools/gce_setup/grpc_docker.sh | 85 |
1 files changed, 78 insertions, 7 deletions
diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh index 3deef05ef3..497112ce39 100755 --- a/tools/gce_setup/grpc_docker.sh +++ b/tools/gce_setup/grpc_docker.sh @@ -560,7 +560,7 @@ grpc_sync_scripts() { _grpc_ensure_gcloud_ssh || return 1; # declare vars local so that they don't pollute the shell environment - # where they this func is used. + # where this func is used. local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone local grpc_hosts grpc_gce_script_root @@ -600,7 +600,7 @@ grpc_sync_images() { _grpc_ensure_gcloud_ssh || return 1; # declare vars local so that they don't pollute the shell environment - # where they this func is used. + # where this func is used. local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone local grpc_hosts @@ -645,7 +645,7 @@ _grpc_show_servers_args() { # Shows the grpc servers on the GCE instance <server_name> grpc_show_servers() { # declare vars local so that they don't pollute the shell environment - # where they this func is used. + # where this func is used. local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone # set by _grpc_show_servers local host @@ -663,6 +663,58 @@ grpc_show_servers() { gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" } +_grpc_build_proto_bins_args() { + [[ -n $1 ]] && { # host + host=$1 + shift + } || { + host='grpc-docker-builder' + } +} + +# grpc_build_proto_bins +# +# - rebuilds the dist_proto docker image +# * doing this builds the protoc and the ruby, python and cpp bins statically +# +# - runs a docker command that copies the built protos to the GCE host +# - copies the built protos to the local machine +grpc_build_proto_bins() { + _grpc_ensure_gcloud_ssh || return 1; + + # declare vars local so that they don't pollute the shell environment + # where this func is used. + local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone + # set by _grpc_build_proto_bins_args + local host + + # set the project zone and check that all necessary args are provided + _grpc_set_project_and_zone -f _grpc_build_proto_bins_args "$@" || return 1 + gce_has_instance $grpc_project $host || return 1; + local project_opt="--project $grpc_project" + local zone_opt="--zone $grpc_zone" + + # rebuild the dist_proto image + local label='dist_proto' + grpc_update_image -- -h $host $label || return 1 + + # run a command to copy the generated archive to the docker host + local docker_prefix='sudo docker run -v /tmp:/tmp/proto_bins_out' + local tar_name='proto-bins*.tar.gz' + local cp_cmd="/bin/bash -c 'cp -v /tmp/$tar_name /tmp/proto_bins_out'" + local cmd="$docker_prefix grpc/$label $cp_cmd" + local ssh_cmd="bash -l -c \"$cmd\"" + echo "will run:" + echo " $ssh_cmd" + echo "on $host" + gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" || return 1 + + # copy the tar.gz locally + local rmt_tar="$host:/tmp/$tar_name" + local local_copy="$(pwd)" + gcloud compute copy-files $rmt_tar $local_copy $project_opt $zone_opt || return 1 +} + _grpc_launch_servers_args() { [[ -n $1 ]] && { # host host=$1 @@ -690,7 +742,7 @@ _grpc_launch_servers_args() { # If no servers are specified, it launches all known servers grpc_launch_servers() { # declare vars local so that they don't pollute the shell environment - # where they this func is used. + # where this func is used. local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone # set by _grpc_launch_servers_args local host servers @@ -811,7 +863,7 @@ test_runner() { grpc_interop_test() { _grpc_ensure_gcloud_ssh || return 1; # declare vars local so that they don't pollute the shell environment - # where they this func is used. + # where this func is used. local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone # grpc_interop_test_args @@ -853,7 +905,7 @@ grpc_interop_test() { grpc_cloud_prod_test() { _grpc_ensure_gcloud_ssh || return 1; # declare vars local so that they don't pollute the shell environment - # where they this func is used. + # where this func is used. local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone # grpc_cloud_prod_test_args @@ -892,7 +944,7 @@ grpc_cloud_prod_test() { grpc_cloud_prod_auth_test() { _grpc_ensure_gcloud_ssh || return 1; # declare vars local so that they don't pollute the shell environment - # where they this func is used. + # where this func is used. local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone # grpc_cloud_prod_test_args @@ -1192,6 +1244,20 @@ grpc_cloud_prod_auth_compute_engine_creds_gen_cxx_cmd() { echo $the_cmd } +# constructs the full dockerized cpp jwt_token auth interop test cmd. +# +# call-seq: +# flags= .... # generic flags to include the command +# cmd=$($grpc_gen_test_cmd $flags) +grpc_cloud_prod_auth_jwt_token_creds_gen_cxx_cmd() { + local cmd_prefix="sudo docker run grpc/cxx"; + local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl --use_prod_roots"; + local gfe_flags=$(_grpc_prod_gfe_flags) + local added_gfe_flags=$(_grpc_jwt_token_test_flags) + local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; + echo $the_cmd +} + # constructs the full dockerized csharp-mono interop test cmd. # # call-seq: @@ -1230,6 +1296,11 @@ _grpc_svc_acc_test_flags() { echo " --service_account_key_file=/service_account/stubbyCloudTestingTest-7dd63462c60c.json --oauth_scope=https://www.googleapis.com/auth/xapi.zoo" } +# outputs the flags passed to the service account auth tests +_grpc_jwt_token_test_flags() { + echo " --service_account_key_file=/service_account/stubbyCloudTestingTest-7dd63462c60c.json" +} + # default credentials test flag _grpc_default_creds_test_flags() { echo " --oauth_scope=https://www.googleapis.com/auth/xapi.zoo" |