Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: postgres arm64 resource (#7177)
Danny Xu70deb2ae971b
diff --git a/backend/resources/README.md b/backend/resources/README.mdindex 9bd7f99e4d..0589c93b63 100644--- a/backend/resources/README.md+++ b/backend/resources/README.md@@ -4,13 +4,18 @@ You need to run `go generate -tags mysql ./...` to download some resources manua## Postgresql-We will embed Postgres binaries to serve and store backend data. We will extract the binary to a binary path and install Postgres. We will use Go file suffix build tags to include the embedded file only for the build platform. For example, resources_darwin.go will only be included for building Bytebase on darwin platform.+We will embed Postgres binaries to serve and store backend data. We will extract the binary to a binary path and install Postgres. We will use Go file suffix build tags to include the embedded file only for the build platform. For example, resources_darwin_amd64.go will only be included for building Bytebase on darwin/amd64 platform.-linux/amd64 used for Linux (MD5 3b5b460450f09543f1055e7ffd1cf773): https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-linux-amd64/14.2.0/embedded-postgres-binaries-linux-amd64-14.2.0.jar+Compressing command: tar c . | xz > ../postgres-darwin-arm64.txz-linux/arm64 used for Linux arm64 (MD5 db2d840c9a35d9cfb661a0fd9a690829): https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-linux-arm64v8/14.2.0/embedded-postgres-binaries-linux-arm64v8-14.2.0.jar+linux/amd64 used for Linux: https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-linux-amd64/14.2.0/embedded-postgres-binaries-linux-amd64-14.2.0.jar++linux/arm64 used for Linux arm64: https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-linux-arm64v8/14.2.0/embedded-postgres-binaries-linux-arm64v8-14.2.0.jar++darwin/amd64 used for MacOS amd64: https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-darwin-amd64/14.2.0/embedded-postgres-binaries-darwin-amd64-14.2.0.jar++darwin/arm64v8 used for MacOS arm64v8: https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-darwin-arm64v8/14.2.0/embedded-postgres-binaries-darwin-arm64v8-14.2.0.jar-darwin/amd64 used for MacOS development (MD5 d95d5c5fccc1e1ef45de6533fd8e6d0a): https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-darwin-amd64/14.2.0/embedded-postgres-binaries-darwin-amd64-14.2.0.jar## MySQLdiff --git a/backend/resources/postgres/postgres.go b/backend/resources/postgres/postgres.goindex 8454959a44..be687f0ee6 100644--- a/backend/resources/postgres/postgres.go+++ b/backend/resources/postgres/postgres.go@@ -65,14 +65,19 @@ func isPgDump15(pgDumpPath string) (bool, error) {// Returns the bin directory on success.func Install(resourceDir string) (string, error) {var tarName string- switch runtime.GOOS {- case "darwin":- tarName = "postgres-darwin-x86_64.txz"- case "linux":- tarName = "postgres-linux-x86_64.txz"+ switch {+ case runtime.GOOS == "darwin" && runtime.GOARCH == "amd64":+ tarName = "postgres-darwin-amd64.txz"+ case runtime.GOOS == "darwin" && runtime.GOARCH == "arm64":+ tarName = "postgres-darwin-arm64.txz"+ case runtime.GOOS == "linux" && runtime.GOARCH == "amd64":+ tarName = "postgres-linux-amd64.txz"+ case runtime.GOOS == "linux" && runtime.GOARCH == "arm64":+ tarName = "postgres-linux-arm64.txz"default:- return "", errors.Errorf("OS %q is not supported", runtime.GOOS)+ return "", errors.Errorf("unsupported combination of OS %q and ARCH %q", runtime.GOOS, runtime.GOARCH)}+version := strings.TrimSuffix(tarName, ".txz")pgBaseDir := path.Join(resourceDir, version)pgBinDir := path.Join(pgBaseDir, "bin")diff --git a/backend/resources/postgres/resources_darwin_amd64.go b/backend/resources/postgres/resources_darwin_amd64.gonew file mode 100644index 0000000000..3f84347ca5--- /dev/null+++ b/backend/resources/postgres/resources_darwin_amd64.go@@ -0,0 +1,8 @@+package postgres++import "embed"++// HACK: tmp hack to use darwin/amd64 plaform binaries, assumed Rosetta2 has been installed+//+//go:embed postgres-darwin-amd64.txz+var resources embed.FSdiff --git a/backend/resources/postgres/resources_darwin.go b/backend/resources/postgres/resources_darwin_arm64.gosimilarity index 60%rename from backend/resources/postgres/resources_darwin.gorename to backend/resources/postgres/resources_darwin_arm64.goindex 0bf39d2d7f..2b68a493b8 100644--- a/backend/resources/postgres/resources_darwin.go+++ b/backend/resources/postgres/resources_darwin_arm64.go@@ -2,5 +2,5 @@ package postgresimport "embed"-//go:embed postgres-darwin-x86_64.txz+//go:embed postgres-darwin-arm64.txzvar resources embed.FSdiff --git a/backend/resources/postgres/resources_linux_amd64.go b/backend/resources/postgres/resources_linux_amd64.goindex 2fa2d5cee9..d273f09797 100644--- a/backend/resources/postgres/resources_linux_amd64.go+++ b/backend/resources/postgres/resources_linux_amd64.go@@ -2,5 +2,5 @@ package postgresimport "embed"-//go:embed postgres-linux-x86_64.txz+//go:embed postgres-linux-amd64.txzvar resources embed.FSdiff --git a/backend/resources/postgres/resources_linux_arm64.go b/backend/resources/postgres/resources_linux_arm64.goindex 10a538a415..a729bf234b 100644--- a/backend/resources/postgres/resources_linux_arm64.go+++ b/backend/resources/postgres/resources_linux_arm64.go@@ -2,5 +2,5 @@ package postgresimport "embed"-//go:embed postgres-linux-arm_64.txz+//go:embed postgres-linux-arm64.txzvar resources embed.FS