Skip to content

Commit

Permalink
[RTI-15453] Add a hacky workaround to pin the DynamoDBLocal test-only…
Browse files Browse the repository at this point in the history
… dep used by the kinesis adapter (#83)
  • Loading branch information
pablocostass authored Nov 14, 2023
1 parent 59b6196 commit d317c22
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions priv/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,42 @@ msg () {
echo "$@" >&2
}

maybe_fix_dynamodblocal_dep_in_pom () {
POM_PATH="$1"
PKG_NAME="$2"
PKG_VSN="$3"

# "dynamodb-streams-kinesis-adapter" includes in its POM a test-ONLY dependency
# called "DynamoDBLocal". At the moment of writing (2023-10-27), the adapter
# release we are using (1.5.3), which was released in May 11, 2021, states that
# the test dependency should be downloaded in a version matching "[1.12,2.0)"
# (i.e., 1.12 <= version < 2.0), and AWS did some recent releases of this testing
# libary in 2023, with the latest version (1.24.0) having being published on
# October 26, 2023, as per what its release history says.
# However, this release is missing in the Maven repository, with the latest
# version meeting the release requirement being 1.23.0. The fun thing is that nonetheless,
# we have seen in our CI maven try and install the latest yet-to-be-uploaded 1.24.0 release.
# This means that the download will fail, and for now the fix we have come up with is
# changing the version constraints for "DynamoDBLocal" from a range to a pinned 1.23.0 release.
#
# References:
# - https://mvnrepository.com/artifact/com.amazonaws/dynamodb-streams-kinesis-adapter/1.5.3
# - https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocalHistory.html
# - https://mvnrepository.com/artifact/com.amazonaws/DynamoDBLocal
if [[ $PKG_NAME == $DYNAMO_PKG ]] && [[ $PKG_VSN == $DYNAMO_VERSION ]]; then
msg "sed'ing the pom for $PKG_NAME ($PKG_VSN) found in $POM_PATH"

UNAME_SYS=$(uname -s)
if [[ $UNAME_SYS == "Darwin" ]]; then
# macOS sed syntax
sed -i '' 's/<aws.dynamodblocal.version>\[1.12,2.0)/<aws.dynamodblocal.version>1.23.0/' $POM_PATH
else
# Linux sed syntax
sed -i 's/<aws.dynamodblocal.version>\[1.12,2.0)/<aws.dynamodblocal.version>1.23.0/' $POM_PATH
fi
fi
}

download () {
DESTDIR="$1"
PKG="$2"
Expand All @@ -42,6 +78,7 @@ download () {
fi
done
POM="$DESTDIR/$PKG-$VERSION.pom"
maybe_fix_dynamodblocal_dep_in_pom "$POM" "$DYNAMO_PKG" "$DYNAMO_VERSION"
mvn -B -f "$POM" dependency:copy-dependencies -DoutputDirectory="$DESTDIR" -DincludeScope=runtime
}

Expand Down

0 comments on commit d317c22

Please sign in to comment.