From 87dd487d488e4cac85c8cfcfefa4780c22190826 Mon Sep 17 00:00:00 2001 From: nutcas3 Date: Wed, 29 Apr 2026 02:54:08 +0300 Subject: [PATCH] refactor: Replace custom migration runner with goose CLI tool in CI and deployment workflows - Install goose CLI tool using go install in CI and deploy workflows - Replace custom migration command (go run cmd/migrate/main.go --action=up) with goose postgres command - Remove working-directory specification from CI migration step - Update commented kubectl exec commands in deploy workflow to use goose instead of custom runner - Simplify migration execution by using standardized goose tool across all environments --- .github/workflows/ci.yml | 6 ++++-- .github/workflows/deploy.yml | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2a0e36..9bc6fc4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,11 +40,13 @@ jobs: working-directory: apps/api-server run: go mod download + - name: Install goose + run: go install github.com/pressly/goose/v3/cmd/goose@latest + - name: Run database migrations - working-directory: apps/api-server env: DATABASE_URL: postgresql://test_user:test_password@localhost:5432/test_db?sslmode=disable - run: go run cmd/migrate/main.go --action=up + run: goose postgres $DATABASE_URL up migrations - name: Run linter working-directory: apps/api-server diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index afe26c8..e789507 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -170,10 +170,13 @@ jobs: with: version: 'latest' + - name: Install goose + run: go install github.com/pressly/goose/v3/cmd/goose@latest + - name: Run database migrations run: | echo "Running database migrations for staging..." - # kubectl exec -it deployment/api-server -- go run cmd/migrate/main.go --action=up + # goose postgres $DATABASE_URL up migrations echo "Staging migrations complete" - name: Deploy to staging cluster @@ -197,10 +200,13 @@ jobs: with: version: 'latest' + - name: Install goose + run: go install github.com/pressly/goose/v3/cmd/goose@latest + - name: Run database migrations run: | echo "Running database migrations for production..." - # kubectl exec -it deployment/api-server -- go run cmd/migrate/main.go --action=up + # goose postgres $DATABASE_URL up migrations echo "Production migrations complete" - name: Deploy to production cluster