Skip to content

Commit

Permalink
release-binary skip build if file exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienvas committed Feb 10, 2017
1 parent 17af079 commit 4960b6d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions script/release-binary
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,29 @@
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
BUCKET_NAME="istio-build/proxy"
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 binary
bazel build --config=release //src/envoy/mixer:envoy_tar
BAZEL_TARGET="bazel-bin/src/envoy/mixer/envoy_tar.tar.gz"
ln "${BAZEL_TARGET}" "${BINARY_NAME}"
sha256sum "${BINARY_NAME}" > "${SHA256_NAME}"
DST="gs://${BUCKET_NAME}/"

# Copy it to the bucket.
echo "Copying ${BINARY_NAME} ${SHA256_NAME} to ${DST}"
gsutil cp "${BINARY_NAME}" "${SHA256_NAME}" "${DST}"

echo "Copying ${BINARY_NAME} ${SHA256_NAME} to ${DST}/"
gsutil cp "${BINARY_NAME}" "${SHA256_NAME}" "${DST}/"

0 comments on commit 4960b6d

Please sign in to comment.