mirror of https://github.com/istio/proxy.git
59 lines
2.0 KiB
Bash
Executable File
59 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Copyright 2016 Google Inc. All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
################################################################################
|
|
#
|
|
set -ex
|
|
|
|
# Make sure to this script on x86_64 Ubuntu Xenial
|
|
UBUNTU_RELEASE="$(lsb_release -c -s)"
|
|
[[ "${UBUNTU_RELEASE}" == 'xenial' ]] || { echo 'must run on Ubuntu Xenial'; exit 1; }
|
|
|
|
# The bucket name to store proxy binary
|
|
DST="gs://istio-build/proxy"
|
|
|
|
# The proxy binary name.
|
|
SHA="$(git rev-parse --verify HEAD)"
|
|
BINARY_NAME="envoy-alpha-${SHA}.tar.gz"
|
|
SHA256_NAME="envoy-alpha-${SHA}.sha256"
|
|
|
|
# If binary already exists skip.
|
|
gsutil stat "${DST}/${BINARY_NAME}" \
|
|
&& { echo 'Binary already exists'; exit 0; } \
|
|
|| echo 'Building a new binary.'
|
|
|
|
# Build the release binary
|
|
bazel build --config=release //src/envoy/mixer:envoy_tar
|
|
BAZEL_TARGET="bazel-bin/src/envoy/mixer/envoy_tar.tar.gz"
|
|
cp -f "${BAZEL_TARGET}" "${BINARY_NAME}"
|
|
sha256sum "${BINARY_NAME}" > "${SHA256_NAME}"
|
|
|
|
# Copy it to the bucket.
|
|
echo "Copying ${BINARY_NAME} ${SHA256_NAME} to ${DST}/"
|
|
gsutil cp "${BINARY_NAME}" "${SHA256_NAME}" "${DST}/"
|
|
|
|
# Build the debug binary
|
|
BINARY_NAME="envoy-debug-${SHA}.tar.gz"
|
|
SHA256_NAME="envoy-debug-${SHA}.sha256"
|
|
bazel build -c dbg //src/envoy/mixer:envoy_tar
|
|
BAZEL_TARGET="bazel-bin/src/envoy/mixer/envoy_tar.tar.gz"
|
|
cp -f "${BAZEL_TARGET}" "${BINARY_NAME}"
|
|
sha256sum "${BINARY_NAME}" > "${SHA256_NAME}"
|
|
|
|
# Copy it to the bucket.
|
|
echo "Copying ${BINARY_NAME} ${SHA256_NAME} to ${DST}/"
|
|
gsutil cp "${BINARY_NAME}" "${SHA256_NAME}" "${DST}/"
|