From 07db0dc4481d835c8509b493053d2818ca10b4fd Mon Sep 17 00:00:00 2001 From: Preston Van Loon Date: Wed, 10 May 2023 07:30:40 -0500 Subject: [PATCH] CI: Add support for buildbuddy uploads (#12378) * Add build metadata * Add buildbuddy flags * more metadata * fix latest tag * fix branch * revert branch change * touch a file to trigger build * remove unknown command * fix script * Update latest_version_tag.sh --- .buildkite-bazelrc | 10 +++++++++- hack/latest_version_tag.sh | 8 ++++++++ hack/workspace_status_ci.sh | 23 +++++++++++++++++------ 3 files changed, 34 insertions(+), 7 deletions(-) create mode 100755 hack/latest_version_tag.sh diff --git a/.buildkite-bazelrc b/.buildkite-bazelrc index 056d337fc..240afe826 100644 --- a/.buildkite-bazelrc +++ b/.buildkite-bazelrc @@ -43,4 +43,12 @@ build --flaky_test_attempts=5 # Better caching build:nostamp --nostamp -build:nostamp --workspace_status_command=./hack/workspace_status_ci.sh + +# Build metadata +build --build_metadata=ROLE=CI +build --build_metadata=REPO_URL=https://github.com/prysmaticlabs/prysm.git +build --workspace_status_command=./hack/workspace_status_ci.sh + +# Buildbuddy +build --bes_results_url=https://app.buildbuddy.io/invocation/ +build --bes_backend=grpcs://remote.buildbuddy.io diff --git a/hack/latest_version_tag.sh b/hack/latest_version_tag.sh new file mode 100755 index 000000000..f5d4a2c84 --- /dev/null +++ b/hack/latest_version_tag.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -e + +# Prints the latest git version tag, like "v2.12.8" +git tag -l 'v*' --sort=creatordate | + perl -nle 'if (/^v\d+\.\d+\.\d+$/) { print $_ }' | + tail -n1 + diff --git a/hack/workspace_status_ci.sh b/hack/workspace_status_ci.sh index 79d6029d2..e118d3492 100755 --- a/hack/workspace_status_ci.sh +++ b/hack/workspace_status_ci.sh @@ -1,9 +1,20 @@ #!/bin/bash -# Note: The STABLE_ prefix will force a relink when the value changes when using rules_go x_defs. +repo_url=$(git config --get remote.origin.url) +echo "REPO_URL $repo_url" -echo STABLE_GIT_COMMIT "continuous-integration" -echo DATE "now" -echo DATE_UNIX "0" -echo DOCKER_TAG "ci-foo" -echo STABLE_GIT_TAG "c1000deadbeef" +commit_sha=$(git rev-parse HEAD) +echo "COMMIT_SHA $commit_sha" + +echo "GIT_BRANCH $git_branch" + +git_tree_status=$(git diff-index --quiet HEAD -- && echo 'Clean' || echo 'Modified') +echo "GIT_TREE_STATUS $git_tree_status" + +# Note: the "STABLE_" suffix causes these to be part of the "stable" workspace +# status, which may trigger rebuilds of certain targets if these values change +# and you're building with the "--stamp" flag. +latest_version_tag=$(./hack/latest_version_tag.sh) +echo "STABLE_VERSION_TAG $latest_version_tag" +echo "STABLE_COMMIT_SHA $commit_sha" +echo "STABLE_GIT_TAG $latest_version_tag"