diff options
Diffstat (limited to 'scripts/benchmark.sh')
-rwxr-xr-x[-rw-r--r--] | scripts/benchmark.sh | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/scripts/benchmark.sh b/scripts/benchmark.sh index a0317db02..e0f6df438 100644..100755 --- a/scripts/benchmark.sh +++ b/scripts/benchmark.sh @@ -14,12 +14,32 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Run in the root of the repo. -cd "$(dirname "$0")" +source $(dirname $0)/common.sh -KEY_PATH=${KEY_PATH:-"${KOKORO_KEYSTORE_DIR}/${KOKORO_SERVICE_ACCOUNT}"} +# gcloud may be installed as a "snap". If it is, include it in PATH. +declare -r snap="/snap/bin" +if [[ -d "${snap}" ]]; then + export PATH="${PATH}:${snap}" +fi -gcloud auth activate-service-account --key-file "${KEY_PATH}" +# Make sure we can find gcloud and exit if not. +which gcloud -gcloud compute instances list +# Exporting for subprocesses as GCP APIs and tools check this environmental +# variable for authentication. +export GOOGLE_APPLICATION_CREDENTIALS="${KOKORO_KEYSTORE_DIR}/${GCLOUD_CREDENTIALS}" +gcloud auth activate-service-account \ + --key-file "${GOOGLE_APPLICATION_CREDENTIALS}" + +gcloud config set project ${PROJECT} +gcloud config set compute/zone ${ZONE} + +bazel run //benchmarks:benchmarks -- \ + --verbose \ + run-gcp \ + "(startup|absl)" \ + --internal \ + --runtime=runc \ + --runtime=runsc \ + --installers=head |