Skip to content

Commit

Permalink
Excavator: Update godel to latest version (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
svc-excavator-bot authored Apr 26, 2021
1 parent d039f1e commit 51830f5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
4 changes: 2 additions & 2 deletions godel/config/godel.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
distributionURL=https://github.com/palantir/godel/releases/download/v2.36.0/godel-2.36.0.tgz
distributionSHA256=91137f4fb9e1b4491d6dd821edf6ed39eb66f21410bf645a062f687049c45492
distributionURL=https://github.com/palantir/godel/releases/download/v2.38.0/godel-2.38.0.tgz
distributionSHA256=bc63a8d69e2b927b947ca87a565985c5298ed068acd0c3a1432c055df73c2aca
41 changes: 28 additions & 13 deletions godelw
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
set -euo pipefail

# Version and checksums for godel. Values are populated by the godel "dist" task.
VERSION=2.36.0
DARWIN_CHECKSUM=ac46bc231177ddd78343ef66fab222de7a91d9e691f8480f1d644561a08e92d0
LINUX_CHECKSUM=604db3bba458be15360c0a9669119b6797cebf013d839de88d0a7eca59adf03e
VERSION=2.38.0
DARWIN_AMD64_CHECKSUM=d794d8632afd466c67e995b26ecaa8ef17ea762d0bd429627e81daf312432c20
DARWIN_ARM64_CHECKSUM=fc343917830dccf9bb7e744c0d9ad0f024217e6cd0275825ef55b51a12b0a738
LINUX_AMD64_CHECKSUM=ff3790b8efb59c7648ed669db34315dd24822b356f6f380598d6ed57ae1651f8
LINUX_ARM64_CHECKSUM=8fa94380bffd3dfdad8f3a13c494718a1aa04ccfcc2a04159675a7171304149e

# Downloads file at URL to destination path using wget or curl. Prints an error and exits if wget or curl is not present.
function download {
Expand Down Expand Up @@ -108,7 +110,7 @@ function verify_dist_tgz_valid {
local tgz_path=$1
local version=$2

local expected_paths=("godel-$version/" "godel-$version/bin/darwin-amd64/godel" "godel-$version/bin/linux-amd64/godel" "godel-$version/wrapper/godelw" "godel-$version/wrapper/godel/config/")
local expected_paths=("godel-$version/" "godel-$version/bin/darwin-amd64/godel" "godel-$version/bin/darwin-arm64/godel" "godel-$version/bin/linux-amd64/godel" "godel-$version/bin/linux-arm64/godel" "godel-$version/wrapper/godelw" "godel-$version/wrapper/godel/config/")
local files=($(tar -tf "$tgz_path"))

# this is a double-for loop, but fine since $expected_paths is small and bash doesn't have good primitives for set/map/list manipulation
Expand Down Expand Up @@ -142,9 +144,10 @@ function verify_godel_version {
local base_dir=$1
local version=$2
local os=$3
local arch=$4

local expected_output="godel version $version"
local version_output=$($base_dir/godel-$version/bin/$os-amd64/godel version)
local version_output=$($base_dir/godel-$version/bin/$os-$arch/godel version)

if [ "$expected_output" != "$version_output" ]; then
echo "Version reported by godel executable did not match expected version: expected \"$expected_output\", was \"$version_output\""
Expand All @@ -161,23 +164,35 @@ GODEL_BASE_DIR=${GODEL_HOME:-$HOME/.godel}
# determine OS
OS=""
EXPECTED_CHECKSUM=""
case "$(uname)" in
Darwin*)
case "$(uname)-$(uname -m)" in
Darwin-x86_64)
OS=darwin
EXPECTED_CHECKSUM=$DARWIN_CHECKSUM
ARCH=amd64
EXPECTED_CHECKSUM=$DARWIN_AMD64_CHECKSUM
;;
Linux*)
Darwin-arm64)
OS=darwin
ARCH=arm64
EXPECTED_CHECKSUM=$DARWIN_ARM64_CHECKSUM
;;
Linux-x86_64)
OS=linux
ARCH=amd64
EXPECTED_CHECKSUM=$LINUX_AMD64_CHECKSUM
;;
Linux-aarch64)
OS=linux
EXPECTED_CHECKSUM=$LINUX_CHECKSUM
ARCH=arm64
EXPECTED_CHECKSUM=$LINUX_ARM64_CHECKSUM
;;
*)
echo "Unsupported operating system: $(uname)"
echo "Unsupported operating system-architecture: $(uname)-$(uname -m)"
exit 1
;;
esac

# path to godel binary
CMD=$GODEL_BASE_DIR/dists/godel-$VERSION/bin/$OS-amd64/godel
CMD=$GODEL_BASE_DIR/dists/godel-$VERSION/bin/$OS-$ARCH/godel

# godel binary is not present -- download distribution
if [ ! -f "$CMD" ]; then
Expand Down Expand Up @@ -212,7 +227,7 @@ if [ ! -f "$CMD" ]; then
TMP_DIST_DIR=$(mktemp -d "$GODEL_BASE_DIR/tmp_XXXXXX" 2>/dev/null || mktemp -d -t "$GODEL_BASE_DIR/tmp_XXXXXX")
trap 'rm -rf "$TMP_DIST_DIR"' EXIT
tar zxvf "$DOWNLOAD_DST" -C "$TMP_DIST_DIR" >/dev/null 2>&1
verify_godel_version "$TMP_DIST_DIR" "$VERSION" "$OS"
verify_godel_version "$TMP_DIST_DIR" "$VERSION" "$OS" "$ARCH"

# rename downloaded file to remove PID portion
mv "$DOWNLOAD_DST" "$GODEL_BASE_DIR/downloads/godel-$VERSION.tgz"
Expand Down

0 comments on commit 51830f5

Please sign in to comment.