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: clean up build args (#15550)
Danny Xu4e3267edc72e
diff --git a/.github/workflows/build-push-release-image.yml b/.github/workflows/build-push-release-image.ymlindex 24d9195cdb..fb09251a98 100644--- a/.github/workflows/build-push-release-image.yml+++ b/.github/workflows/build-push-release-image.yml@@ -16,9 +16,10 @@ jobs:- uses: actions/checkout@v4- name: Extract build args# Extract version from branch name- # Example: branch name `release/1.0.0` sets up env.RELEASE_VERSION=1.0.0+ # Example: branch name `release/1.0.0` sets up env.IMAGE_VERSION=1.0.0run: |- echo "RELEASE_VERSION=${GITHUB_REF_NAME#release/}" >> $GITHUB_ENV+ echo "IMAGE_VERSION=${GITHUB_REF_NAME#release/}" >> $GITHUB_ENV+ echo "VERSION=$(cat ./scripts/VERSION)" >> $GITHUB_ENVecho "GIT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV- uses: pnpm/action-setup@v4with:@@ -28,8 +29,6 @@ jobs:node-version: '22.14.0'cache: pnpmcache-dependency-path: "frontend/pnpm-lock.yaml"- - run: pnpm install --frozen-lockfile- working-directory: frontend- name: Run pnpm release buildrun: |cp backend/enterprise/api/plan.yaml frontend/src/types@@ -52,9 +51,9 @@ jobs:platforms: linux/amd64,linux/arm64push: truetags: |- bytebase/bytebase:${{ env.RELEASE_VERSION }}+ bytebase/bytebase:${{ env.IMAGE_VERSION }}build-args: |- VERSION=${{ env.RELEASE_VERSION }}+ VERSION=${{ env.VERSION }}GIT_COMMIT=${{ env.GIT_COMMIT }}- uses: actions/checkout@v4- name: Login to DockerHub@@ -74,9 +73,7 @@ jobs:platforms: linux/amd64push: truetags: |- dbytebase/chatgpt:${{ env.RELEASE_VERSION }}+ dbytebase/chatgpt:${{ env.IMAGE_VERSION }}build-args: |- VERSION=${{ env.RELEASE_VERSION }}+ VERSION=${{ env.VERSION }}GIT_COMMIT=${{ env.GIT_COMMIT }}- - name: Image digest- run: echo "Successfully pushed bytebase/bytebase:${{ env.RELEASE_VERSION }} ${{ steps.bytebase_build.outputs.digest }}"diff --git a/README.md b/README.mdindex 3a653f4e37..ecb4b732a5 100644--- a/README.md+++ b/README.md@@ -282,7 +282,7 @@ Below diagram describes a typical mapping between an engineering org and the cor1. Start frontend (with live reload).```bash- cd frontend && pnpm i && pnpm dev+ pnpm --dir frontend i && pnpm --dir frontend dev```Bytebase should now be running at http://localhost:3000 and change either frontend or backend code would trigger live reload.diff --git a/backend/resources/postgres/meta_instance.go b/backend/resources/postgres/meta_instance.goindex 465bf01e48..0b6b298e6b 100644--- a/backend/resources/postgres/meta_instance.go+++ b/backend/resources/postgres/meta_instance.go@@ -28,7 +28,7 @@ func StartMetadataInstance(ctx context.Context, pgBinDir, pgDataDir string, portdefer db.Close()var ok bool- if err := db.QueryRowContext(ctx, "SELECT EXISTS (SELECT 1 FROM pg_database WHERE datname = bb)").Scan(&ok); err != nil {+ if err := db.QueryRowContext(ctx, "SELECT EXISTS (SELECT 1 FROM pg_database WHERE datname = 'bb');").Scan(&ok); err != nil {return nil, err}if !ok {diff --git a/scripts/Dockerfile b/scripts/Dockerfileindex 63c7128a5f..948d83e7ac 100644--- a/scripts/Dockerfile+++ b/scripts/Dockerfile@@ -14,8 +14,8 @@ ADD go.mod go.sum /RUN go mod downloadARG TARGETARCH-ARG VERSION="development"-ARG GIT_COMMIT="unknown"+ARG VERSION+ARG GIT_COMMITRUN if [ "$TARGETARCH" = "arm64" ]; then \apt-get install -y gcc-aarch64-linux-gnu; \@@ -35,7 +35,7 @@ COPY ./scripts/VERSION .# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug informationRUN if [ "$TARGETARCH" = "arm64" ]; then CC=aarch64-linux-gnu-gcc && CC_FOR_TARGET=gcc-aarch64-linux-gnu; fi && \- VERSION=`cat ./scripts/VERSION` && GOOS=linux GOARCH=$TARGETARCH CC=$CC CC_FOR_TARGET=$CC_FOR_TARGET go build \+ GOARCH=$TARGETARCH CC=$CC CC_FOR_TARGET=$CC_FOR_TARGET go build \--tags "release,embed_frontend,docker" \-ldflags="-w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=${GIT_COMMIT}'" \-o bytebase ./backend/bin/server/main.go@@ -59,8 +59,8 @@ RUN tar -Jxf /tmp/bytebase/resources/postgres/postgres-linux-${TARGETARCH}.txz -FROM debian:bookworm-slim as monolithicARG TARGETARCH-ARG VERSION="development"-ARG GIT_COMMIT="unknown"+ARG VERSION+ARG GIT_COMMIT# See https://github.com/opencontainers/image-spec/blob/master/annotations.mdLABEL org.opencontainers.image.version=${VERSION}diff --git a/scripts/Dockerfile.aws b/scripts/Dockerfile.awsindex f627453c43..1d55f95fcf 100644--- a/scripts/Dockerfile.aws+++ b/scripts/Dockerfile.aws@@ -14,9 +14,8 @@ ADD go.mod go.sum /RUN go mod downloadARG TARGETARCH-ARG VERSION="development"-ARG GIT_COMMIT="unknown"-ARG PRODUCT_ID="prod-n4dmmye4e6hjo"+ARG VERSION+ARG GIT_COMMITRUN if [ "$TARGETARCH" = "arm64" ]; then \apt-get install -y gcc-aarch64-linux-gnu; \@@ -36,7 +35,7 @@ COPY ./scripts/VERSION .# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug informationRUN if [ "$TARGETARCH" = "arm64" ]; then CC=aarch64-linux-gnu-gcc && CC_FOR_TARGET=gcc-aarch64-linux-gnu; fi && \- VERSION=`cat ./scripts/VERSION` && GOOS=linux GOARCH=$TARGETARCH CC=$CC CC_FOR_TARGET=$CC_FOR_TARGET go build \+ GOARCH=$TARGETARCH CC=$CC CC_FOR_TARGET=$CC_FOR_TARGET go build \--tags "release,embed_frontend,aws" \-ldflags="-w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=${GIT_COMMIT}'" \-o bytebase \@@ -61,8 +60,8 @@ RUN tar -Jxf /tmp/bytebase/resources/postgres/postgres-linux-${TARGETARCH}.txz -FROM debian:bookworm-slim as monolithicARG TARGETARCH-ARG VERSION="development"-ARG GIT_COMMIT="unknown"+ARG VERSION+ARG GIT_COMMI# See https://github.com/opencontainers/image-spec/blob/master/annotations.mdLABEL org.opencontainers.image.version=${VERSION}@@ -93,7 +92,7 @@ COPY --from=backend /etc/ssl/certs /etc/ssl/certsCOPY --from=decompressor /var/opt/bytebase/resources /bytebase/resourcesENV OPENSSL_CONF /etc/ssl/-ENV AWS_PRODUCT_ID=$PRODUCT_ID+ENV AWS_PRODUCT_ID="prod-n4dmmye4e6hjo"CMD ["--port", "8080", "--data", "/var/opt/bytebase"]diff --git a/scripts/Dockerfile.demo b/scripts/Dockerfile.demoindex 32e356e36e..1aafbdf588 100644--- a/scripts/Dockerfile.demo+++ b/scripts/Dockerfile.demo@@ -9,7 +9,7 @@ WORKDIR /frontend-buildCOPY . .ENV GIT_COMMIT="${GIT_COMMIT}"-RUN cd frontend && pnpm install --frozen-lockfile && pnpm release-docker+RUN pnpm --dir frontend release-dockerFROM golang:1.24.1 as backendADD go.mod go.sum /@@ -54,8 +54,8 @@ RUN tar -Jxf /tmp/bytebase/resources/postgres/postgres-linux-${TARGETARCH}.txz -# Use debian because mysql requires glibc.FROM debian:bookworm-slim as monolithic-ARG VERSION="development"-ARG GIT_COMMIT="unknown"+ARG VERSION+ARG GIT_COMMIT# See https://github.com/opencontainers/image-spec/blob/master/annotations.mdLABEL org.opencontainers.image.version=${VERSION}diff --git a/scripts/Dockerfile.depot b/scripts/Dockerfile.depotindex 41b871c967..07a9ddd205 100644--- a/scripts/Dockerfile.depot+++ b/scripts/Dockerfile.depot@@ -2,8 +2,8 @@ FROM golang:1.24.1 as backendADD go.mod go.sum /RUN go mod download-ARG VERSION="development"-ARG GIT_COMMIT="unknown"+ARG VERSION+ARG GIT_COMMITRUN if [ "$TARGETARCH" = "arm64" ]; then \apt-get install -y gcc-aarch64-linux-gnu; \@@ -18,7 +18,7 @@ COPY . .# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug informationRUN if [ "$TARGETARCH" = "arm64" ]; then CC=aarch64-linux-gnu-gcc && CC_FOR_TARGET=gcc-aarch64-linux-gnu; fi && \- VERSION=`cat ./scripts/VERSION` && GOOS=linux GOARCH=$TARGETARCH CC=$CC CC_FOR_TARGET=$CC_FOR_TARGET go build \+ GOARCH=$TARGETARCH CC=$CC CC_FOR_TARGET=$CC_FOR_TARGET go build \--tags "release,embed_frontend,docker" \-ldflags="-w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=${GIT_COMMIT}'" \-o bytebase ./backend/bin/server/main.go@@ -43,8 +43,8 @@ RUN tar -Jxf /tmp/bytebase/resources/postgres/postgres-linux-${TARGETARCH}.txz -FROM debian:bookworm-slim as monolithicARG TARGETARCH-ARG VERSION="development"-ARG GIT_COMMIT="unknown"+ARG VERSION+ARG GIT_COMMIT# See https://github.com/opencontainers/image-spec/blob/master/annotations.mdLABEL org.opencontainers.image.version=${VERSION}diff --git a/scripts/build_bytebase.sh b/scripts/build_bytebase.shindex 3982bfd7d7..5f4421ca13 100755--- a/scripts/build_bytebase.sh+++ b/scripts/build_bytebase.sh@@ -11,25 +11,6 @@ cd "$(dirname "$0")/../". ./scripts/build_init.shOUTPUT_DIR=$(mkdir_output "$1")-OUTPUT_BINARY=$OUTPUT_DIR/bytebase--TARGET_GO_VERSION="1.24.0"-GO_VERSION=`go version | { read _ _ v _; echo ${v#go}; }`-if [ "$(version ${GO_VERSION})" -lt "$(version $TARGET_GO_VERSION)" ];-then- echo "${RED}Precheck failed.${NC} Require go version >= $TARGET_GO_VERSION. Current version ${GO_VERSION}."; exit 1;-fi--NODE_VERSION=`node -v | { read v; echo ${v#v}; }`-if [ "$(version ${NODE_VERSION})" -lt "$(version 22.13.0)" ];-then- echo "${RED}Precheck failed.${NC} Require node.js version >= 22.13.0. Current version ${NODE_VERSION}."; exit 1;-fi--if ! command -v npm > /dev/null-then- echo "${RED}Precheck failed.${NC} npm is not installed."; exit 1;-fi# Step 1 - Build the frontend release version into the backend/server/dist folder# Step 2 - Build the monolithic app by building backend release version together with the backend/server/dist.@@ -40,7 +21,6 @@ echo "Step 1 - building Bytebase frontend..."rm -rf ./backend/server/dist-export GIT_COMMIT=$(git rev-parse HEAD)pnpm --dir ./frontend i && pnpm --dir ./frontend releaseecho "Completed building Bytebase frontend."@@ -48,7 +28,8 @@ echo "Completed building Bytebase frontend."echo ""echo "Step 2 - building Bytebase backend..."-go build -p=8 --tags "release,embed_frontend" -ldflags "-w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=$(git rev-parse HEAD)'" -o ${OUTPUT_BINARY} ./backend/bin/server/main.go+OUTPUT_BINARY=$OUTPUT_DIR/bytebase+go build -p=8 --tags "release,embed_frontend" -ldflags "-w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=${GIT_COMMIT}'" -o ${OUTPUT_BINARY} ./backend/bin/server/main.goecho ""echo "${GREEN}Completed building Bytebase ${VERSION}.${NC}"diff --git a/scripts/build_bytebase_aws.sh b/scripts/build_bytebase_aws.shindex 9524d78886..1571fbc367 100755--- a/scripts/build_bytebase_aws.sh+++ b/scripts/build_bytebase_aws.sh@@ -14,7 +14,7 @@ echo "Start building Bytebase docker image ${VERSION}..."docker build -f ./scripts/Dockerfile.aws \--build-arg VERSION="${VERSION}" \- --build-arg GIT_COMMIT="$(git rev-parse HEAD)" \+ --build-arg GIT_COMMIT=${GIT_COMMIT}" \-t bytebase/bytebase .echo "${GREEN}Completed building Bytebase docker image ${VERSION}.${NC}"diff --git a/scripts/build_bytebase_docker.sh b/scripts/build_bytebase_docker.shindex 1c0df91513..4dc5a6f59e 100755--- a/scripts/build_bytebase_docker.sh+++ b/scripts/build_bytebase_docker.sh@@ -14,7 +14,7 @@ echo "Start building Bytebase docker image ${VERSION}..."docker build -f ./scripts/Dockerfile \--build-arg VERSION="${VERSION}" \- --build-arg GIT_COMMIT="$(git rev-parse HEAD)"\+ --build-arg GIT_COMMIT="${GIT_COMMIT}"\-t bytebase/bytebase .echo "${GREEN}Completed building Bytebase docker image ${VERSION}.${NC}"diff --git a/scripts/build_init.sh b/scripts/build_init.shindex 915892ccaf..6a98a1eaf0 100644--- a/scripts/build_init.sh+++ b/scripts/build_init.sh@@ -13,6 +13,7 @@ NC='\033[0m' # No Color# Invoke from project rootVERSION=$(cat ./scripts/VERSION)+GIT_COMMIT=$(git rev-parse HEAD)# Version function used for version string comparisonversion() { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }@@ -26,4 +27,23 @@ mkdir_output() {OUTPUT_DIR="$1"fiecho "$OUTPUT_DIR"-}\ No newline at end of file+}++# Go and node version checks.+TARGET_GO_VERSION="1.24.0"+GO_VERSION=`go version | { read _ _ v _; echo ${v#go}; }`+if [ "$(version ${GO_VERSION})" -lt "$(version $TARGET_GO_VERSION)" ];+then+ echo "${RED}Precheck failed.${NC} Require go version >= $TARGET_GO_VERSION. Current version ${GO_VERSION}."; exit 1;+fi++NODE_VERSION=`node -v | { read v; echo ${v#v}; }`+if [ "$(version ${NODE_VERSION})" -lt "$(version 22.13.0)" ];+then+ echo "${RED}Precheck failed.${NC} Require node.js version >= 22.13.0. Current version ${NODE_VERSION}."; exit 1;+fi++if ! command -v npm > /dev/null+then+ echo "${RED}Precheck failed.${NC} npm is not installed."; exit 1;+fi\ No newline at end of file