Skip to content

Commit

Permalink
teamcity: add build configuration to wrap run-pgo-build
Browse files Browse the repository at this point in the history
This build configuration wraps `run-pgo-build` to run a roachtest
with profiling enabled. The result profile is then uploaded to a GCS
bucket.

Part of: CRDB-44692
Epic: CRDB-41952
Release note: None
  • Loading branch information
rickystewart committed Dec 13, 2024
1 parent ce53018 commit b4d5aff
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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"
16 changes: 16 additions & 0 deletions build/teamcity/internal/cockroach/build/ci/generate-profile.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b4d5aff

Please sign in to comment.