Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if [[ "$1" == "fix_format" || "$1" == "check_format" ]]; then
build_setup_args="-nofetch"
fi

. "$(dirname "$0")"/setup_gcs_cache.sh
. "$(dirname "$0")"/build_setup.sh $build_setup_args

echo "building using ${NUM_CPUS} CPUs"
Expand Down
2 changes: 2 additions & 0 deletions ci/do_circle_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export NUM_CPUS=8
# (see https://circleci.com/docs/2.0/executor-types/#using-machine)
export BAZEL_EXTRA_TEST_OPTIONS="--test_env=ENVOY_IP_TEST_VERSIONS=v4only"

export BAZEL_REMOTE_CACHE="${BAZEL_REMOTE_CACHE:-https://storage.googleapis.com/envoy-circleci-bazel-cache/}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be more appropriate to set this in .circleci/config.yml?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, can we make this end-user configurable and document how individual developers can also make use of it? Maybe in https://github.com/envoyproxy/envoy/blob/master/bazel/README.md.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Specifically for when working outside a Docker image)


function finish {
echo "disk space at end of build:"
df -h
Expand Down
3 changes: 3 additions & 0 deletions ci/do_circle_ci_ipv6_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export TEST_TYPE="bazel.ipv6_tests"

export BAZEL_EXTRA_TEST_OPTIONS="--test_env=ENVOY_IP_TEST_VERSIONS=v6only"

export BAZEL_REMOTE_CACHE="${BAZEL_REMOTE_CACHE:-https://storage.googleapis.com/envoy-circleci-bazel-cache/}"

function finish {
echo "disk space at end of build:"
df -h
Expand All @@ -22,5 +24,6 @@ echo "disk space at beginning of build:"
df -h

docker run -t -i -v "$ENVOY_BUILD_DIR":/build -v "$ENVOY_SRCDIR":/source \
--env GCP_SERVICE_ACCOUNT_KEY --env BAZEL_REMOTE_CACHE \
envoyproxy/envoy-build:"$ENVOY_BUILD_SHA" /bin/bash -c "cd /source && ci/do_ci.sh $TEST_TYPE"

6 changes: 5 additions & 1 deletion ci/mac_ci_steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

set -e

BAZEL_BUILD_OPTIONS="--curses=no --show_task_finish --verbose_failures"
export BAZEL_REMOTE_CACHE="${BAZEL_REMOTE_CACHE:-https://storage.googleapis.com/envoy-circleci-bazel-cache/}"

. "$(dirname "$0")"/setup_gcs_cache.sh

BAZEL_BUILD_OPTIONS="--curses=no --show_task_finish --verbose_failures ${BAZEL_BUILD_EXTRA_OPTIONS}"
# TODO(zuercher): remove --flaky_test_attempts when https://github.com/envoyproxy/envoy/issues/2428
# is resolved.
BAZEL_TEST_OPTIONS="${BAZEL_BUILD_OPTIONS} --test_output=all --flaky_test_attempts=integration@2"
Expand Down
27 changes: 27 additions & 0 deletions ci/setup_gcs_cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

set -e

gcp_service_account_cleanup() {
echo "Deleting service account key file..."
rm -rf /tmp/gcp_service_account.json

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use TMPDIR or something, probably bad to assume the existent of /tmp.

}

if [[ ! -z "${BAZEL_REMOTE_CACHE}" ]]; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: remove superfluous blank lines here and below.

if [[ ! -z "${GCP_SERVICE_ACCOUNT_KEY}" ]]; then
echo "${GCP_SERVICE_ACCOUNT_KEY}" | base64 --decode > /tmp/gcp_service_account.json

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mktemp

trap gcp_service_account_cleanup EXIT

export BAZEL_BUILD_EXTRA_OPTIONS="${BAZEL_BUILD_EXTRA_OPTIONS} \
--remote_http_cache=${BAZEL_REMOTE_CACHE} --google_credentials=/tmp/gcp_service_account.json"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to use filesystem? If so, best to make sure that the file perms are appropriately restricted.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, switched to using mktemp also addresses the permission.

echo "Set up bazel read/write HTTP cache at ${BAZEL_REMOTE_CACHE}."
else
export BAZEL_BUILD_EXTRA_OPTIONS="${BAZEL_BUILD_EXTRA_OPTIONS} \
--remote_http_cache=${BAZEL_REMOTE_CACHE} --noremote_upload_local_results"
echo "Set up bazel read only HTTP cache at ${BAZEL_REMOTE_CACHE}."
fi

else
echo "No remote cache bucket is set, skipping setup remote cache."
fi