diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 458e6abd..52773a2e 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -77,7 +77,7 @@ jobs: run: yes | m stable && dirname $(readlink $(which mongod)) > .metapath - name: Build - run: go build main/migration_verifier.go + run: ./build.sh - name: Start clusters run: |- diff --git a/README.md b/README.md index 0564af17..02296882 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,9 @@ _This Repository is NOT an officially supported MongoDB product. This tool reduc ``` -go build main/migration_verifier.go +./build.sh ``` - - # Operational UX Once Running _Assumes no port set, default port for operation webserver is 27020_ diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..a8a2e2ca --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +commit=$(git show --no-patch --format='%H') + +go build -ldflags="-X 'main.Revision=$commit'" main/migration_verifier.go diff --git a/main/migration_verifier.go b/main/migration_verifier.go index f9209b46..a0640163 100644 --- a/main/migration_verifier.go +++ b/main/migration_verifier.go @@ -43,6 +43,9 @@ const ( pprofInterval = "pprofInterval" ) +// This gets set at build time. +var Revision = "Unknown; build with build.sh." + func main() { zerolog.ErrorStackMarshaler = pkgerrors.MarshalStack @@ -154,9 +157,10 @@ func main() { } app := &cli.App{ - Name: "migration-verifier", - Usage: "verify migration correctness", - Flags: flags, + Name: "migration-verifier", + Usage: "verify migration correctness", + Version: Revision, + Flags: flags, Before: func(cCtx *cli.Context) error { confFile := cCtx.String(configFileFlag) @@ -203,6 +207,10 @@ func handleArgs(ctx context.Context, cCtx *cli.Context) (*verifier.Verifier, err v := verifier.NewVerifier(verifierSettings, logPath) + v.GetLogger().Info(). + Str("revision", Revision). + Msg("migration-verifier started.") + err := v.SetSrcURI(ctx, cCtx.String(srcURI)) if err != nil { return nil, err