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: use alpine build tags otherwise use file suffix build tags since linux is a reserved tag (#811)
Danny Xu06c686ee2ad8
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex ab3720de9c..bdbb8684e5 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -3,7 +3,7 @@ name: buildon:push:branches:- - 'main'+ - "main"pull_request:jobs:@@ -21,7 +21,7 @@ jobs:- uses: actions/checkout@v2- uses: actions/setup-go@v2with:- go-version: 1.17+ go-version: 1.17- name: Verify tidyrun: |go mod tidydiff --git a/resources/README.md b/resources/README.mdindex f947eade12..a93489e003 100644--- a/resources/README.md+++ b/resources/README.md@@ -2,10 +2,10 @@## Postgresql-We will embed Postgres binaries to serve and store backend data. We will extract the binary to a binary path and use embedded-postgres to a Postgres server.+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. However, we will also use build tag `alpine` to differentiate builds on Linux and alpine Linux. We have to include alpine Linux because its underlying libc is different from regular Linux, and we use alpine Linux for our docker images.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-linux/amd64 used for Docker image (MD5 2f7e10b17683bcbcba264057d7c4215d): https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-linux-amd64-alpine/14.2.0/embedded-postgres-binaries-linux-amd64-alpine-14.2.0.jar+linux/amd64 used for Alpine Linux - Docker image (MD5 2f7e10b17683bcbcba264057d7c4215d): https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-linux-amd64-alpine/14.2.0/embedded-postgres-binaries-linux-amd64-alpine-14.2.0.jardarwin/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.jardiff --git a/resources/postgres/postgres.go b/resources/postgres/postgres.goindex 344669ca5d..29aca1d009 100644--- a/resources/postgres/postgres.go+++ b/resources/postgres/postgres.go@@ -90,7 +90,7 @@ func Install(resourceDir, pgDataDir, pgUser string) (*Instance, error) {log.Printf("Installing Postgres OS %q Arch %q txz %q\n", runtime.GOOS, runtime.GOARCH, tarName)f, err := resources.Open(tarName)if err != nil {- return nil, err+ return nil, fmt.Errorf("failed to find %q in embedded resources, error: %v", tarName, err)}defer f.Close()version := strings.TrimRight(tarName, ".txz")diff --git a/resources/postgres/resources_alpine.go b/resources/postgres/resources_alpine_linux.gosimilarity index 100%rename from resources/postgres/resources_alpine.gorename to resources/postgres/resources_alpine_linux.godiff --git a/resources/postgres/resources_darwin.go b/resources/postgres/resources_darwin.goindex 2c001c3f17..0bf39d2d7f 100644--- a/resources/postgres/resources_darwin.go+++ b/resources/postgres/resources_darwin.go@@ -1,6 +1,3 @@-//go:build darwin-// +build darwin-package postgresimport "embed"diff --git a/resources/postgres/resources_linux.go b/resources/postgres/resources_linux.goindex 5d56016085..d02d2eccae 100644--- a/resources/postgres/resources_linux.go+++ b/resources/postgres/resources_linux.go@@ -1,5 +1,5 @@-//go:build linux-// +build linux+//go:build !alpine+// +build !alpinepackage postgresdiff --git a/scripts/.air.toml b/scripts/.air.tomlindex 4f345c3477..dcf6f31a8e 100644--- a/scripts/.air.toml+++ b/scripts/.air.toml@@ -3,7 +3,7 @@ tmp_dir = ".air"[build]bin = "./.air/bytebase --port 8080 --frontend-port 3000 --data ."- cmd = "go build --tags \"darwin\" -o ./.air/bytebase ./bin/server/main.go"+ cmd = "go build -o ./.air/bytebase ./bin/server/main.go"delay = 1000exclude_dir = [".air", "vendor", "frontend", "docs"]exclude_file = []diff --git a/scripts/.air_demo.toml b/scripts/.air_demo.tomlindex ca94cc62be..628d5415c2 100644--- a/scripts/.air_demo.toml+++ b/scripts/.air_demo.toml@@ -3,7 +3,7 @@ tmp_dir = ".air"[build]bin = "./.air/bytebase --demo --port 8080 --frontend-port 3000 --data ."- cmd = "go build --tags \"darwin\" -o ./.air/bytebase ./bin/server/main.go"+ cmd = "go build -o ./.air/bytebase ./bin/server/main.go"delay = 1000exclude_dir = [".air", "vendor", "frontend", "docs"]exclude_file = []diff --git a/scripts/build.sh b/scripts/build.shindex 9395e2ab1f..2566f0f8b8 100755--- a/scripts/build.sh+++ b/scripts/build.sh@@ -66,7 +66,7 @@ flags="-X 'github.com/bytebase/bytebase/bin/server/cmd.version=${VERSION}'-X 'github.com/bytebase/bytebase/bin/server/cmd.builduser=$(id -u -n)'"# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug information-go build --tags "release linux" -ldflags "-w -s $flags" -o ${OUTPUT_BINARY} ./bin/server/main.go+go build --tags "release" -ldflags "-w -s $flags" -o ${OUTPUT_BINARY} ./bin/server/main.goecho "Completed building bytebase backend."