From 0bfdfa126d8793dde37f9ec741cb96fbb9f5a49e Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Fri, 3 Apr 2015 15:58:29 -0700 Subject: Simplifies the work needed to create a new deb - automates much of the workflow for building a deb package - adds a version.txt file that is used configure the version on the deb package * updates the Dockerfile to make use of this --- tools/dockerfile/grpc_build_deb/Dockerfile | 3 ++ tools/dockerfile/grpc_build_deb/version.txt | 1 + tools/gce_setup/grpc_docker.sh | 60 ++++++++++++++++++++++++++--- 3 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 tools/dockerfile/grpc_build_deb/version.txt (limited to 'tools') diff --git a/tools/dockerfile/grpc_build_deb/Dockerfile b/tools/dockerfile/grpc_build_deb/Dockerfile index 24ffc7379c..cf8da594e9 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 0000000000..4b9fcbec10 --- /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 497112ce39..0e82ac1d12 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 -- cgit v1.2.3