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
This commit is contained in:
Preston Van Loon 2023-05-10 07:30:40 -05:00 committed by GitHub
parent 4b4e213a24
commit 07db0dc448
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 7 deletions

View File

@ -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

8
hack/latest_version_tag.sh Executable file
View File

@ -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

View File

@ -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"