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"