From 695307d710ed2f1c133488e850d737ee5996156e Mon Sep 17 00:00:00 2001 From: Ricky Stewart Date: Thu, 12 Dec 2024 16:43:23 -0600 Subject: [PATCH] [WIP] teamcity: add build to run PGO script and upload profile Part of: CRDB-44692 Epic: CRDB-41952 Release note: None --- .../build/ci/generate-profile-impl.sh | 27 +++++++++++++++++++ .../cockroach/build/ci/generate-profile.sh | 16 +++++++++++ 2 files changed, 43 insertions(+) create mode 100755 build/teamcity/internal/cockroach/build/ci/generate-profile-impl.sh create mode 100755 build/teamcity/internal/cockroach/build/ci/generate-profile.sh diff --git a/build/teamcity/internal/cockroach/build/ci/generate-profile-impl.sh b/build/teamcity/internal/cockroach/build/ci/generate-profile-impl.sh new file mode 100755 index 000000000000..325edd7aaafb --- /dev/null +++ b/build/teamcity/internal/cockroach/build/ci/generate-profile-impl.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Copyright 2024 The Cockroach Authors. +# +# Use of this software is governed by the CockroachDB Software License +# included in the /LICENSE file. + +set -xeuo pipefail + +dir="$(dirname $(dirname $(dirname $(dirname $(dirname $(dirname "${0}"))))))" + +cleanup() { + rm -f ~/.config/gcloud/application_default_credentials.json +} +trap cleanup EXIT + +source "$dir/teamcity-support.sh" +google_credentials="$GOOGLE_CREDENTIALS" +log_into_gcloud + +filename=$(date +"%Y%m%d%H%M%S").pprof + +bazel build --config ci //pkg/cmd/run-pgo-build +_bazel/bin/pkg/cmd/run-pgo-build/run-pgo-build_/run-pgo-build -out "$filename" + +gsutil cp "$filename" "gs://cockroach-profiles/$filename" +rm "$filename" diff --git a/build/teamcity/internal/cockroach/build/ci/generate-profile.sh b/build/teamcity/internal/cockroach/build/ci/generate-profile.sh new file mode 100755 index 000000000000..7e2791c239d6 --- /dev/null +++ b/build/teamcity/internal/cockroach/build/ci/generate-profile.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# Copyright 2024 The Cockroach Authors. +# +# Use of this software is governed by the CockroachDB Software License +# included in the /LICENSE file. + +set -xeuo pipefail + +dir="$(dirname $(dirname $(dirname $(dirname $(dirname $(dirname "${0}"))))))" + +source "$dir/teamcity-support.sh" # For $root +source "$dir/teamcity-bazel-support.sh" # For run_bazel + +BAZEL_SUPPORT_EXTRA_DOCKER_ARGS="-e GOOGLE_CREDENTIALS -e TC_API_PASSWORD -e TC_API_USER -e TC_BUILD_BRANCH -e TC_SERVER_URL" \ + run_bazel build/teamcity/internal/cockroach/build/ci/generate-profile-impl.sh