From aa12dd0de921f8f17bffb548554933c73503e016 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Thu, 4 Sep 2025 14:43:11 -0400 Subject: [PATCH 1/5] Add script to download latest verifier release. --- README.md | 9 ++++++--- download_latest.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 3 deletions(-) create mode 100755 download_latest.sh diff --git a/README.md b/README.md index 7a9ac20c..91e59e11 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,12 @@ _If verifying a migration done via [mongosync](https://www.mongodb.com/docs/cluster-to-cluster-sync/current/), please check if it is possible to use the [embedded verifier](https://www.mongodb.com/docs/cluster-to-cluster-sync/current/reference/verification/embedded/#std-label-c2c-embedded-verifier) as that is the preferred approach for verification._ -# To build - - +# Obtaining +To fetch the latest release: +``` +curl -L https://raw.githubusercontent.com/mongodb-labs/migration-verifier/refs/heads/main/download_latest.sh | sh +``` +… or, if you prefer to build locally, just do: ``` ./build.sh ``` diff --git a/download_latest.sh b/download_latest.sh new file mode 100755 index 00000000..b42b4197 --- /dev/null +++ b/download_latest.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +set -o errexit + +filename=migration_verifier + +RELEASE_URL="https://api.github.com/repos/mongodb-labs/migration-verifier/releases/latest" + +OS=$(uname -o | tr '[:upper:]' '[:lower:]') +ARCH=$(uname -m) +if [ "$ARCH" = "aarch64" ]; then + ARCH=arm64 +fi + +echo "Looks like you’re running $OS on $ARCH." + +MANIFEST=$(wget -qO- "$RELEASE_URL") + +VERSION=$(printf "%s" "$MANIFEST" | jq -r .name) + +echo "Latest release: $VERSION" + +ALL_URLS=$(printf "%s" "$MANIFEST" \ + | jq -r '.assets[] | .browser_download_url' \ +) + +DOWNLOAD_URL=$(echo "$ALL_URLS" \ + | grep "_${OS}_" | grep "_$ARCH" ||: \ +) + +if [ -z "$DOWNLOAD_URL" ]; then + echo >&2 "No download URL found for $OS/$ARCH:" + echo >&2 "$ALL_URLS" + exit 1 +fi + +echo "Downloading $DOWNLOAD_URL …" + +wget -O "$filename" "$DOWNLOAD_URL" + +chmod +x "$filename" + +echo "Migration Verifier $VERSION is now saved as $filename." From 0f19eca23f3adaa1fcd45688342ab513fa503c02 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Thu, 4 Sep 2025 14:45:36 -0400 Subject: [PATCH 2/5] utf-8 --- download_latest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/download_latest.sh b/download_latest.sh index b42b4197..bd9ca6e8 100755 --- a/download_latest.sh +++ b/download_latest.sh @@ -40,4 +40,4 @@ wget -O "$filename" "$DOWNLOAD_URL" chmod +x "$filename" -echo "Migration Verifier $VERSION is now saved as $filename." +echo "✅ Migration Verifier $VERSION is now saved as $filename." From e1e85007eb8cd80047859dc1bac407c1e7195c7f Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Thu, 4 Sep 2025 16:33:56 -0400 Subject: [PATCH 3/5] nicer curl command --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 91e59e11..7a77e121 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ _If verifying a migration done via [mongosync](https://www.mongodb.com/docs/clus # Obtaining To fetch the latest release: ``` -curl -L https://raw.githubusercontent.com/mongodb-labs/migration-verifier/refs/heads/main/download_latest.sh | sh +curl -sSL https://raw.githubusercontent.com/mongodb-labs/migration-verifier/refs/heads/main/download_latest.sh | sh ``` … or, if you prefer to build locally, just do: ``` From 25a5e7862b9cd23fd4bf2a3857e0094ca638b390 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Fri, 5 Sep 2025 09:54:15 -0400 Subject: [PATCH 4/5] updates --- download_latest.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/download_latest.sh b/download_latest.sh index bd9ca6e8..6e4bb67d 100755 --- a/download_latest.sh +++ b/download_latest.sh @@ -6,7 +6,7 @@ filename=migration_verifier RELEASE_URL="https://api.github.com/repos/mongodb-labs/migration-verifier/releases/latest" -OS=$(uname -o | tr '[:upper:]' '[:lower:]') +OS=$(uname -o | tr '[:upper:]' '[:lower:]' | sed 's|gnu/||') ARCH=$(uname -m) if [ "$ARCH" = "aarch64" ]; then ARCH=arm64 @@ -14,7 +14,7 @@ fi echo "Looks like you’re running $OS on $ARCH." -MANIFEST=$(wget -qO- "$RELEASE_URL") +MANIFEST=$(curl -sSL "$RELEASE_URL") VERSION=$(printf "%s" "$MANIFEST" | jq -r .name) @@ -36,7 +36,7 @@ fi echo "Downloading $DOWNLOAD_URL …" -wget -O "$filename" "$DOWNLOAD_URL" +curl -L "$DOWNLOAD_URL" > "$filename" chmod +x "$filename" From a8b1bfbb801e93124760e2047ab62fea92b98950 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Fri, 5 Sep 2025 09:54:43 -0400 Subject: [PATCH 5/5] sSL --- download_latest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/download_latest.sh b/download_latest.sh index 6e4bb67d..ab1b08f2 100755 --- a/download_latest.sh +++ b/download_latest.sh @@ -36,7 +36,7 @@ fi echo "Downloading $DOWNLOAD_URL …" -curl -L "$DOWNLOAD_URL" > "$filename" +curl -sSL "$DOWNLOAD_URL" > "$filename" chmod +x "$filename"