From d317c22b2e026891594da19f00db7510c45ac1da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Costas=20S=C3=A1nchez?= Date: Tue, 14 Nov 2023 16:52:32 +0100 Subject: [PATCH] [RTI-15453] Add a hacky workaround to pin the DynamoDBLocal test-only dep used by the kinesis adapter (#83) --- priv/download.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/priv/download.sh b/priv/download.sh index 70416b6..8f10763 100755 --- a/priv/download.sh +++ b/priv/download.sh @@ -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/\[1.12,2.0)/1.23.0/' $POM_PATH + else + # Linux sed syntax + sed -i 's/\[1.12,2.0)/1.23.0/' $POM_PATH + fi + fi +} + download () { DESTDIR="$1" PKG="$2" @@ -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 }