diff --git a/tools/dockerfile/grpc_build_deb/Dockerfile b/tools/dockerfile/grpc_build_deb/Dockerfile index 24ffc7379cf..cf8da594e9e 100644 --- a/tools/dockerfile/grpc_build_deb/Dockerfile +++ b/tools/dockerfile/grpc_build_deb/Dockerfile @@ -30,6 +30,9 @@ # Dockerfile to build Debian packages for gRPC C core. FROM grpc/base +# Add the file containing the gRPC version +ADD version.txt version.txt + # Install dependencies RUN apt-get update && apt-get install -y lintian diff --git a/tools/dockerfile/grpc_build_deb/version.txt b/tools/dockerfile/grpc_build_deb/version.txt new file mode 100644 index 00000000000..4b9fcbec101 --- /dev/null +++ b/tools/dockerfile/grpc_build_deb/version.txt @@ -0,0 +1 @@ +0.5.1 diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh index 497112ce399..0e82ac1d120 100755 --- a/tools/gce_setup/grpc_docker.sh +++ b/tools/gce_setup/grpc_docker.sh @@ -673,7 +673,7 @@ _grpc_build_proto_bins_args() { } # grpc_build_proto_bins -# +# # - rebuilds the dist_proto docker image # * doing this builds the protoc and the ruby, python and cpp bins statically # @@ -693,11 +693,11 @@ grpc_build_proto_bins() { 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' @@ -715,6 +715,58 @@ grpc_build_proto_bins() { gcloud compute copy-files $rmt_tar $local_copy $project_opt $zone_opt || return 1 } +_grpc_build_debs_args() { + [[ -n $1 ]] && { # host + host=$1 + shift + } || { + host='grpc-docker-builder' + } +} + +# grpc_build_debs +# +# - rebuilds the build_debs +# * doing this builds a deb package for release debs +# +# - runs a docker command that copies the debs from the docker instance to its +# host +# - copies the debs from the host to the local machine +grpc_build_debs() { + _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_debs_args + local host + + # set the project zone and check that all necessary args are provided + _grpc_set_project_and_zone -f _grpc_build_debs_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 build_deb image + local label='build_deb' + grpc_update_image -- -h $host $label || return 1 + + # run a command to copy the debs from the docker instance to the host. + local docker_prefix='sudo docker run -v /tmp:/tmp/host_deb_out' + local cp_cmd="/bin/bash -c 'cp -v /tmp/deb_out/*.deb /tmp/host_deb_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 debs from host machine to the local one. + local rmt_debs="$host:/tmp/*.deb" + local local_copy="$(pwd)" + gcloud compute copy-files $rmt_debs $local_copy $project_opt $zone_opt || return 1 +} + _grpc_launch_servers_args() { [[ -n $1 ]] && { # host host=$1 @@ -1310,5 +1362,3 @@ _grpc_default_creds_test_flags() { _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