diff --git a/tools/dockerfile/grpc_ruby/Dockerfile b/tools/dockerfile/grpc_ruby/Dockerfile index c84548c88028924c1309d574035d6a06750e1e44..47972e7effaa40f5c816a85e9309c09796283d4d 100644 --- a/tools/dockerfile/grpc_ruby/Dockerfile +++ b/tools/dockerfile/grpc_ruby/Dockerfile @@ -6,17 +6,19 @@ RUN cd /var/local/git/grpc \ && git pull --recurse-submodules \ && git submodule update --init --recursive -# TODO: remove this, once make install is fixed -RUN touch /var/local/git/grpc/include/grpc/support/string.h - # Build the C core. RUN make install_c -C /var/local/git/grpc # Build ruby gRPC and run its tests RUN /bin/bash -l -c 'cd /var/local/git/grpc/src/ruby && bundle && rake' -# Add a cacerts directory containing the Google root pem file, allowing the ruby client to access the production test instance +# Add a cacerts directory containing the Google root pem file, allowing the +# ruby client to access the production test instance ADD cacerts cacerts -# Specify the default command such that the interop server runs on its known testing port +# Add a service_account directory containing the auth creds file +ADD service_account service_account + +# Specify the default command such that the interop server runs on its known +# testing port CMD ["/bin/bash", "-l", "-c", "ruby /var/local/git/grpc/src/ruby/bin/interop/interop_server.rb --use_tls --port 8060"] diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh index 09c28558a902b1bfed94fb2d5b805fdf0ace97e9..2ac75f3cc59056bf3e542deb60aaffe6f0955bc7 100755 --- a/tools/gce_setup/grpc_docker.sh +++ b/tools/gce_setup/grpc_docker.sh @@ -869,7 +869,6 @@ grpc_interop_gen_ruby_cmd() { echo $the_cmd } - # constructs the full dockerized java interop test cmd. # # call-seq: @@ -879,12 +878,43 @@ grpc_cloud_prod_gen_ruby_cmd() { local cmd_prefix="sudo docker run grpc/ruby bin/bash -l -c" local test_script="/var/local/git/grpc/src/ruby/bin/interop/interop_client.rb" local test_script+=" --use_tls" - local gfe_flags=" --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com" + local gfe_flags=$(_grpc_prod_gfe_flags) local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" local the_cmd="$cmd_prefix '$env_prefix ruby $test_script $gfe_flags $@'" echo $the_cmd } +# constructs the full dockerized ruby service_account auth interop test cmd. +# +# call-seq: +# flags= .... # generic flags to include the command +# cmd=$($grpc_gen_test_cmd $flags) +grpc_cloud_prod_auth_service_account_creds_gen_ruby_cmd() { + local cmd_prefix="sudo docker run grpc/ruby bin/bash -l -c"; + local test_script="/var/local/git/grpc/src/ruby/bin/interop/interop_client.rb" + local test_script+=" --use_tls" + local gfe_flags=$(_grpc_prod_gfe_flags) + local added_gfe_flags=$(_grpc_svc_acc_test_flags) + local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" + local the_cmd="$cmd_prefix '$env_prefix ruby $test_script $gfe_flags $added_gfe_flag $@'" + echo $the_cmd +} + +# constructs the full dockerized ruby gce auth interop test cmd. +# +# call-seq: +# flags= .... # generic flags to include the command +# cmd=$($grpc_gen_test_cmd $flags) +grpc_cloud_prod_auth_compute_engine_creds_gen_ruby_cmd() { + local cmd_prefix="sudo docker run grpc/ruby bin/bash -l -c"; + local test_script="/var/local/git/grpc/src/ruby/bin/interop/interop_client.rb" + local test_script+=" --use_tls" + local gfe_flags=$(_grpc_prod_gfe_flags) + local added_gfe_flags=$(_grpc_gce_test_flags) + local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" + local the_cmd="$cmd_prefix '$env_prefix ruby $test_script $gfe_flags $added_gfe_flag $@'" + echo $the_cmd +} # constructs the full dockerized Go interop test cmd. # @@ -935,7 +965,7 @@ grpc_cloud_prod_gen_java_cmd() { local cmd_prefix="sudo docker run grpc/java"; local test_script="/var/local/git/grpc-java/run-test-client.sh"; local test_script+=" --use_tls=true" - local gfe_flags=" --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com" + local gfe_flags=$(_grpc_prod_gfe_flags) local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; echo $the_cmd } @@ -956,19 +986,11 @@ grpc_interop_gen_php_cmd() { echo $the_cmd } -# constructs the full dockerized cpp interop test cmd. -# +# constructs the full dockerized node interop test cmd. # # call-seq: # flags= .... # generic flags to include the command # cmd=$($grpc_gen_test_cmd $flags) -grpc_interop_gen_cxx_cmd() { - local cmd_prefix="sudo docker run grpc/cxx"; - local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl"; - local the_cmd="$cmd_prefix $test_script $@"; - echo $the_cmd -} - grpc_interop_gen_node_cmd() { local cmd_prefix="sudo docker run grpc/node"; local test_script="/usr/bin/nodejs /var/local/git/grpc/src/node/interop/interop_client.js --use_tls=true"; @@ -978,46 +1000,70 @@ grpc_interop_gen_node_cmd() { # constructs the full dockerized cpp interop test cmd. # +# call-seq: +# flags= .... # generic flags to include the command +# cmd=$($grpc_gen_test_cmd $flags) +grpc_interop_gen_cxx_cmd() { + local cmd_prefix="sudo docker run grpc/cxx"; + local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl"; + local the_cmd="$cmd_prefix $test_script $@"; + echo $the_cmd +} + +# constructs the full dockerized cpp gce=>prod interop test cmd. # # call-seq: # flags= .... # generic flags to include the command # cmd=$($grpc_gen_test_cmd $flags) grpc_cloud_prod_gen_cxx_cmd() { local cmd_prefix="sudo docker run grpc/cxx"; - local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl"; - local gfe_flags=" --use_prod_roots --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com" + local test_script="/var/local/git/grpc/bins/opt/interop_client --enable_ssl --use_prod_roots"; + local gfe_flags=$(_grpc_prod_gfe_flags) local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; echo $the_cmd } -# constructs the full dockerized cpp interop test cmd. -# +# constructs the full dockerized cpp service_account auth interop test cmd. # # call-seq: # flags= .... # generic flags to include the command # cmd=$($grpc_gen_test_cmd $flags) grpc_cloud_prod_auth_service_account_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"; - local gfe_flags=" --use_prod_roots --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com" - local added_gfe_flags=" --service_account_key_file=/service_account/stubbyCloudTestingTest-7dd63462c60c.json --oauth_scope=https://www.googleapis.com/auth/xapi.zoo" + 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_svc_acc_test_flags) local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; echo $the_cmd } -# constructs the full dockerized cpp interop test cmd. -# +# constructs the full dockerized cpp gce auth interop test cmd. # # call-seq: # flags= .... # generic flags to include the command # cmd=$($grpc_gen_test_cmd $flags) grpc_cloud_prod_auth_compute_engine_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"; - local gfe_flags=" --use_prod_roots --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com" - local added_gfe_flags=" --default_service_account=155450119199-r5aaqa2vqoa9g5mv2m6s3m1l293rlmel@developer.gserviceaccount.com --oauth_scope=https://www.googleapis.com/auth/xapi.zoo" + 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_gce_test_flags) local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; echo $the_cmd } -# TODO(grpc-team): add grpc_interop_gen_xxx_cmd for python|nodejs +# outputs the flags passed to gfe tests +_grpc_prod_gfe_flags() { + echo " --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com" +} + +# outputs the flags passed to the service account auth tests +_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 gcloud auth tests +_grpc_gce_test_flags() { + echo " --default_service_account=155450119199-r5aaqa2vqoa9g5mv2m6s3m1l293rlmel@developer.gserviceaccount.com --oauth_scope=https://www.googleapis.com/auth/xapi.zoo" +} + +# TODO(grpc-team): add grpc_interop_gen_xxx_cmd for python diff --git a/tools/gce_setup/shared_startup_funcs.sh b/tools/gce_setup/shared_startup_funcs.sh index 3410a2a2c8aea0b401d715303d676c88ea897e08..eea940864da23295532426a4c363ce975cd68f83 100755 --- a/tools/gce_setup/shared_startup_funcs.sh +++ b/tools/gce_setup/shared_startup_funcs.sh @@ -372,7 +372,9 @@ grpc_dockerfile_install() { [[ -d $dockerfile_dir ]] || { echo "$FUNCNAME: not a valid dir: $dockerfile_dir"; return 1; } - # For specific base images, sync the ssh key into the .ssh dir in the dockerfile context + # For specific base images, sync private files. + # + # - the ssh key, ssh certs and/or service account info. [[ $image_label == "grpc/base" ]] && { grpc_docker_sync_github_key $dockerfile_dir/.ssh 'base_ssh_key' || return 1; } @@ -384,6 +386,7 @@ grpc_dockerfile_install() { } [[ $image_label == "grpc/ruby" ]] && { grpc_docker_sync_roots_pem $dockerfile_dir/cacerts || return 1; + grpc_docker_sync_service_account $dockerfile_dir/service_account || return 1; } [[ $image_label == "grpc/cxx" ]] && { grpc_docker_sync_service_account $dockerfile_dir/service_account || return 1;