Skip to content

Commit

Permalink
add a non-numeric prefix before the unstable version to avoid getting…
Browse files Browse the repository at this point in the history
… parsed and truncated as a number (#7400)

### Problem

See #7399. The commit 0672383 experienced CI failures, because our current method of generating the "unstable" pants version to build wheels puts the hexadecimal sha as its own version component: if the sha happens to be completely numeric and begins with any zeroes, `packaging.version.Version()` will helpfully truncate it -- but our `release.sh` script wasn't aware of that.

### Solution

- Add a non-numeric prefix before the sha to generate `PANTS_UNSTABLE_VERSION` in `release.sh` to avoid possible truncation.
  - The prefix chosen was `git`.

### Result

Commit shas starting with zero and containing only numbers for the first 8 characters will no longer fail in CI.
  • Loading branch information
cosmicexplorer authored Mar 19, 2019
1 parent 532dd95 commit cd8d75a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions build-support/bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ function run_local_pants() {
readonly VERSION_FILE="${ROOT}/src/python/pants/VERSION"
PANTS_STABLE_VERSION="$(cat "${VERSION_FILE}")"
HEAD_SHA=$(git rev-parse --verify HEAD)
readonly PANTS_UNSTABLE_VERSION="${PANTS_STABLE_VERSION}+${HEAD_SHA:0:8}"
# We add a non-numeric prefix 'git' before the sha in order to avoid a hex sha which happens to
# contain only [0-9] being parsed as a number -- see #7399.
# TODO(#7399): mix in the timestamp before the sha instead of 'git' to get monotonic ordering!
readonly PANTS_UNSTABLE_VERSION="${PANTS_STABLE_VERSION}+git${HEAD_SHA:0:8}"

readonly DEPLOY_DIR="${ROOT}/dist/deploy"
readonly DEPLOY_3RDPARTY_WHEELS_PATH="wheels/3rdparty/${HEAD_SHA}"
Expand Down Expand Up @@ -123,7 +126,7 @@ function pkg_pants_install_test() {
execute_packaged_pants_with_internal_backends list src:: || \
die "'pants list src::' failed in venv!"
[[ "$(execute_packaged_pants_with_internal_backends --version 2>/dev/null)" \
== "${version}" ]] || die "Installed version of pants does match requested version!"
== "${version}" ]] || die "Installed version of pants does not match requested version!"
}

function pkg_testinfra_install_test() {
Expand Down

0 comments on commit cd8d75a

Please sign in to comment.