Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base.GIT_VERSION_INFO: record the Buildkite commit that was used to build Julia #43073

Merged
merged 3 commits into from
Nov 22, 2021
Merged
Changes from all commits
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
16 changes: 15 additions & 1 deletion base/version_git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ echo " date_string::String"
echo " tagged_commit::Bool"
echo " fork_master_distance::Int"
echo " fork_master_timestamp::Float64"
echo " build_system_commit::String"
echo " build_system_commit_short::String"
echo "end"
echo ""

Expand Down Expand Up @@ -82,6 +84,16 @@ if [ -z "$fork_master_timestamp" ]; then
fork_master_timestamp="0"
fi

build_system_directory="../.buildkite"
if [[ -d "${build_system_directory}/.git" ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

This is a /bin/sh script so this errors.

Copy link
Member Author

Choose a reason for hiding this comment

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

Which part errors? I just ran the following locally inside /bin/sh, and it seemed to work fine for me.

build_system_directory="../.buildkite"
if [[ -d "${build_system_directory}/.git" ]]; then
    echo "foo"
else
    echo "bar"
fi

Copy link
Member

Choose a reason for hiding this comment

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

Probably /bin/sh is bash for you then. On Ubuntu, at least, /bin/sh is dash by default, and there you get

.../version_git.sh: 88: [[: not found

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

[[ is a bashism

build_system_commit=$(git -C "${build_system_directory}" rev-parse HEAD)
build_system_commit_short=$(git -C "${build_system_directory}" rev-parse --short HEAD)
else
echo "Warning: The build system directory does not exist or is not a Git repo: ${build_system_directory}" >&2
Copy link
Member

Choose a reason for hiding this comment

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

Remove this?

build_system_commit=""
build_system_commit_short=""
fi

echo "const GIT_VERSION_INFO = GitVersionInfo("
echo " \"$commit\","
echo " \"$commit_short\","
Expand All @@ -90,5 +102,7 @@ echo " $build_number,"
echo " \"$date_string\","
echo " $tagged_commit,"
echo " $fork_master_distance,"
echo " $fork_master_timestamp."
echo " $fork_master_timestamp.,"
echo " \"$build_system_commit\","
echo " \"$build_system_commit_short\","
echo ")"