Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions auron-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,8 @@ mkdir -p "$(dirname "$BUILD_INFO_FILE")"
JAVA_VERSION=$(java -version 2>&1 | head -n 1 | awk '{print $3}' | tr -d '"')
PROJECT_VERSION=$(./build/mvn help:evaluate -N -Dexpression=project.version -Pspark-${SPARK_VER} -q -DforceStdout 2>/dev/null)
RUST_VERSION=$(rustc --version | awk '{print $2}')
BUILD_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! In the release workflows, actions/checkout checks out ${{ github.event.pull_request.head.sha }}, which leaves the repository in detached HEAD state. In that case, git rev-parse --abbrev-ref HEAD records HEAD rather than the actual source branch, so the branch metadata will not be useful for CI-built artifacts. Could we support an explicit build-branch environment variable, populated from github.head_ref/github.ref_name, and fall back to Git only for local builds? Please also make sure the value is forwarded into Docker builds.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks for reviewing! @slfan1989

BUILD_REVISION=$(git rev-parse HEAD 2>/dev/null)

get_build_info() {
case "$1" in
Expand All @@ -543,6 +545,8 @@ get_build_info() {
"flink.version") echo "${FLINK_VER}" ;;
"iceberg.version") echo "${ICEBERG_VER}" ;;
"hudi.version") echo "${HUDI_VER}" ;;
"build.branch") echo "${BUILD_BRANCH}" ;;
"build.revision") echo "${BUILD_REVISION}" ;;
"build.timestamp") echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" ;;
*) echo "" ;;
esac
Expand All @@ -560,6 +564,8 @@ for key in \
"paimon.version" \
"flink.version" \
"iceberg.version" \
"build.branch" \
"build.revision" \
"build.timestamp"; do
value="$(get_build_info "$key")"
if [[ -n "$value" ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ object AuronBuildInfo {
val UNIFFLE_VERSION_STRING: String = "Uniffle Version"
val PAIMON_VERSION_STRING: String = "Paimon Version"
val ICEBERG_VERSION_STRING: String = "Iceberg Version"
val BUILD_BRANCH_STRING: String = "Build Branch"
val BUILD_REVISION_STRING: String = "Build Revision"
val BUILD_DATE_STRING: String = "Build Timestamp"

val VERSION: String = props.getProperty("project.version", unknown)
Expand All @@ -62,5 +64,7 @@ object AuronBuildInfo {
val PAIMON_VERSION: String = props.getProperty("paimon.version", unknown)
val ICEBERG_VERSION: String = props.getProperty("iceberg.version", unknown)
val FLINK_VERSION: String = props.getProperty("flink.version", unknown)
val BUILD_BRANCH: String = props.getProperty("build.branch", unknown)
val BUILD_REVISION: String = props.getProperty("build.revision", unknown)
val BUILD_DATE: String = props.getProperty("build.timestamp", unknown)
}
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ class ShimsImpl extends Shims with Logging {
auronBuildInfo.put(AuronBuildInfo.PAIMON_VERSION_STRING, AuronBuildInfo.PAIMON_VERSION)
auronBuildInfo.put(AuronBuildInfo.ICEBERG_VERSION_STRING, AuronBuildInfo.ICEBERG_VERSION)
auronBuildInfo.put(AuronBuildInfo.FLINK_VERSION_STRING, AuronBuildInfo.FLINK_VERSION)
auronBuildInfo.put(AuronBuildInfo.BUILD_BRANCH_STRING, AuronBuildInfo.BUILD_BRANCH)
auronBuildInfo.put(AuronBuildInfo.BUILD_REVISION_STRING, AuronBuildInfo.BUILD_REVISION)
auronBuildInfo.put(AuronBuildInfo.BUILD_DATE_STRING, AuronBuildInfo.BUILD_DATE)
auronBuildInfo.retain { case (_, v) => v != null && v.nonEmpty }
val event = AuronBuildInfoEvent(auronBuildInfo)
Expand Down
Loading