-
Notifications
You must be signed in to change notification settings - Fork 0
fix: index #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
fix: index #6
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ concurrency: | |
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| BYTEBASE_URL: http://host.docker.internal:8080 | ||
| BYTEBASE_URL: http://host.docker.internal:18080 | ||
| BYTEBASE_SERVICE_ACCOUNT: api@service.bytebase.com # set service account via environment variable | ||
| BYTEBASE_SERVICE_ACCOUNT_SECRET: ${{ secrets.BYTEBASE_SERVICE_ACCOUNT_SECRET }} # set service account secret via environment variable | ||
| BYTEBASE_PROJECT: "projects/project-test" | ||
|
|
@@ -56,6 +56,7 @@ jobs: | |
| -e BYTEBASE_SERVICE_ACCOUNT_SECRET="${{ env.BYTEBASE_SERVICE_ACCOUNT_SECRET }}" \ | ||
| -e BYTEBASE_PROJECT="${{ env.BYTEBASE_PROJECT }}" \ | ||
| -e BYTEBASE_TARGETS="${{ env.BYTEBASE_TARGETS }}" \ | ||
| -e GITHUB_ACTIONS=true \ | ||
| -w /workspace \ | ||
| bytebase/bytebase-action:3.13.1 \ | ||
| sh -c "ls -la /workspace/schema/ && bytebase-action rollout --url=${{ env.BYTEBASE_URL }} --project=${{ env.BYTEBASE_PROJECT }} --file-pattern=${{ env.FILE_PATTERN }} --targets=${{ env.BYTEBASE_TARGETS }} --declarative --output=/temp/bytebase-metadata.json" | ||
|
|
@@ -84,6 +85,7 @@ jobs: | |
| -e BYTEBASE_SERVICE_ACCOUNT_SECRET="${{ env.BYTEBASE_SERVICE_ACCOUNT_SECRET }}" \ | ||
| -e BYTEBASE_PROJECT="${{ env.BYTEBASE_PROJECT }}" \ | ||
| -e BYTEBASE_TARGET_STAGE="${{ env.BYTEBASE_TARGET_STAGE }}" \ | ||
| -e GITHUB_ACTIONS=true \ | ||
| -w /workspace \ | ||
| bytebase/bytebase-action:3.13.1 \ | ||
| bytebase-action rollout --url=${{ env.BYTEBASE_URL }} --project=${{ env.BYTEBASE_PROJECT }} --target-stage=${{ env.BYTEBASE_TARGET_STAGE }} --plan=${{ needs.create-rollout.outputs.bytebase-plan }} | ||
|
|
@@ -113,6 +115,7 @@ jobs: | |
| -e BYTEBASE_SERVICE_ACCOUNT_SECRET="${{ env.BYTEBASE_SERVICE_ACCOUNT_SECRET }}" \ | ||
| -e BYTEBASE_PROJECT="${{ env.BYTEBASE_PROJECT }}" \ | ||
| -e BYTEBASE_TARGET_STAGE="${{ env.BYTEBASE_TARGET_STAGE }}" \ | ||
| -e GITHUB_ACTIONS=true \ | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test comment |
||
| -w /workspace \ | ||
| bytebase/bytebase-action:3.13.1 \ | ||
| bytebase-action rollout --url=${{ env.BYTEBASE_URL }} --project=${{ env.BYTEBASE_PROJECT }} --target-stage=${{ env.BYTEBASE_TARGET_STAGE }} --plan=${{ needs.create-rollout.outputs.bytebase-plan }} | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| name: Migration rollout using bytebase-action image | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - "migrations/*.sql" | ||
|
|
||
| # cancel previous workflow run if a new workflow run is triggered | ||
| # to prevent multiple rollout | ||
| concurrency: | ||
| group: ${{ github.workflow }} | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| BYTEBASE_URL: http://host.docker.internal:18080 | ||
| BYTEBASE_SERVICE_ACCOUNT: api@service.bytebase.com # set service account via environment variable | ||
| BYTEBASE_SERVICE_ACCOUNT_SECRET: ${{ secrets.BYTEBASE_SERVICE_ACCOUNT_SECRET }} # set service account secret via environment variable | ||
| BYTEBASE_PROJECT: "projects/project-sample" | ||
| BYTEBASE_VERSION: "3.14.0" | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: self-hosted | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Build app and upload | ||
| run: | | ||
| echo "Building..." | ||
| echo "Build done!" | ||
| echo "Uploading..." | ||
| echo "Upload done!" | ||
| create-rollout: | ||
| needs: build | ||
| # runs-on: ubuntu-latest # use self-hosted machines if your Bytebase runs in internal networks. | ||
| runs-on: self-hosted | ||
| outputs: | ||
| bytebase-plan: ${{ steps.set-output.outputs.plan }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Roll out database change | ||
| env: | ||
| BYTEBASE_TARGETS: "instances/test-sample-instance/databases/hr_test,instances/prod-sample-instance/databases/hr_prod" | ||
| FILE_PATTERN: "migrations/*.sql" | ||
| BYTEBASE_OUTPUT: ${{ runner.temp }}/bytebase-metadata.json | ||
| run: | | ||
| ls -la migrations/ | ||
| docker run --rm \ | ||
| --add-host=host.docker.internal:host-gateway \ | ||
| -v "${{ github.workspace }}":/workspace \ | ||
| -v "${{ runner.temp }}":/temp \ | ||
| -e BYTEBASE_URL="${{ env.BYTEBASE_URL }}" \ | ||
| -e BYTEBASE_SERVICE_ACCOUNT="${{ env.BYTEBASE_SERVICE_ACCOUNT }}" \ | ||
| -e BYTEBASE_SERVICE_ACCOUNT_SECRET="${{ env.BYTEBASE_SERVICE_ACCOUNT_SECRET }}" \ | ||
| -e BYTEBASE_PROJECT="${{ env.BYTEBASE_PROJECT }}" \ | ||
| -e BYTEBASE_TARGETS="${{ env.BYTEBASE_TARGETS }}" \ | ||
| -e GITHUB_ACTIONS=true \ | ||
| -w /workspace \ | ||
| bytebase/bytebase-action:"${{ env.BYTEBASE_VERSION }}" \ | ||
| sh -c "ls -la /workspace/migrations/ && bytebase-action rollout --url=${{ env.BYTEBASE_URL }} --project=${{ env.BYTEBASE_PROJECT }} --file-pattern=${{ env.FILE_PATTERN }} --targets=${{ env.BYTEBASE_TARGETS }} --output=/temp/bytebase-metadata.json" | ||
| - name: Set output | ||
| id: set-output | ||
| run: | | ||
| PLAN=$(jq -r .plan ${{ runner.temp }}/bytebase-metadata.json) | ||
| echo "plan=$PLAN" >> $GITHUB_OUTPUT | ||
| deploy-to-test: | ||
| needs: create-rollout | ||
| # runs-on: ubuntu-latest # use self-hosted machines if your Bytebase runs in internal networks. | ||
| runs-on: self-hosted | ||
| environment: test | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Roll out database change | ||
| env: | ||
| BYTEBASE_TARGET_STAGE: environments/test | ||
| run: | | ||
| docker run --rm \ | ||
| --add-host=host.docker.internal:host-gateway \ | ||
| -v "${{ github.workspace }}":/workspace \ | ||
| -e BYTEBASE_URL="${{ env.BYTEBASE_URL }}" \ | ||
| -e BYTEBASE_SERVICE_ACCOUNT="${{ env.BYTEBASE_SERVICE_ACCOUNT }}" \ | ||
| -e BYTEBASE_SERVICE_ACCOUNT_SECRET="${{ env.BYTEBASE_SERVICE_ACCOUNT_SECRET }}" \ | ||
| -e BYTEBASE_PROJECT="${{ env.BYTEBASE_PROJECT }}" \ | ||
| -e BYTEBASE_TARGET_STAGE="${{ env.BYTEBASE_TARGET_STAGE }}" \ | ||
| -e GITHUB_ACTIONS=true \ | ||
| -w /workspace \ | ||
| bytebase/bytebase-action:"${{ env.BYTEBASE_VERSION }}" \ | ||
| bytebase-action rollout --url=${{ env.BYTEBASE_URL }} --project=${{ env.BYTEBASE_PROJECT }} --target-stage=${{ env.BYTEBASE_TARGET_STAGE }} --plan=${{ needs.create-rollout.outputs.bytebase-plan }} | ||
| - name: Deploy app | ||
| run: | | ||
| echo "Deploying app to test environment..." | ||
| echo "Deploy app to test environment done!" | ||
| deploy-to-prod: | ||
| needs: | ||
| - deploy-to-test | ||
| - create-rollout | ||
| # runs-on: ubuntu-latest | ||
| runs-on: self-hosted | ||
| environment: prod | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: rollout | ||
| env: | ||
| BYTEBASE_TARGET_STAGE: environments/prod | ||
| run: | | ||
| docker run --rm \ | ||
| --add-host=host.docker.internal:host-gateway \ | ||
| -v "${{ github.workspace }}":/workspace \ | ||
| -e BYTEBASE_URL="${{ env.BYTEBASE_URL }}" \ | ||
| -e BYTEBASE_SERVICE_ACCOUNT="${{ env.BYTEBASE_SERVICE_ACCOUNT }}" \ | ||
| -e BYTEBASE_SERVICE_ACCOUNT_SECRET="${{ env.BYTEBASE_SERVICE_ACCOUNT_SECRET }}" \ | ||
| -e BYTEBASE_PROJECT="${{ env.BYTEBASE_PROJECT }}" \ | ||
| -e BYTEBASE_TARGET_STAGE="${{ env.BYTEBASE_TARGET_STAGE }}" \ | ||
| -e GITHUB_ACTIONS=true \ | ||
| -w /workspace \ | ||
| bytebase/bytebase-action:"${{ env.BYTEBASE_VERSION }}" \ | ||
| bytebase-action rollout --url=${{ env.BYTEBASE_URL }} --project=${{ env.BYTEBASE_PROJECT }} --target-stage=${{ env.BYTEBASE_TARGET_STAGE }} --plan=${{ needs.create-rollout.outputs.bytebase-plan }} | ||
| - name: Deploy app | ||
| run: | | ||
| echo "Deploying app to prod environment..." | ||
| echo "Deploy app to prod environment done!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| name: Migration SQL review on pull request using bytebase-action image | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - "migrations/*.sql" | ||
|
|
||
| jobs: | ||
| check-release-on-prod: | ||
| permissions: | ||
| pull-requests: write # write permission required to allow the action writes the check results to the comment. | ||
| # runs-on: ubuntu-latest # use self-hosted machines if your Bytebase runs in internal networks. | ||
| runs-on: self-hosted | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Check release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # set GITHUB_TOKEN because the 'Check release' step needs it to comment the pull request with check results. | ||
| BYTEBASE_URL: http://host.docker.internal:18080 | ||
| BYTEBASE_SERVICE_ACCOUNT: api@service.bytebase.com # set service account via environment variable | ||
| BYTEBASE_SERVICE_ACCOUNT_SECRET: ${{ secrets.BYTEBASE_SERVICE_ACCOUNT_SECRET }} # set service account secret via environment variable | ||
| BYTEBASE_PROJECT: "projects/project-sample" | ||
| BYTEBASE_TARGETS: "instances/prod-sample-instance/databases/hr_prod" | ||
| BYTEBASE_VERSION: "3.14.0" | ||
| FILE_PATTERN: "migrations/*.sql" | ||
| run: | | ||
| ls -la migrations/ | ||
| docker run --rm \ | ||
| --add-host=host.docker.internal:host-gateway \ | ||
| -v "${{ github.workspace }}":/workspace \ | ||
| -e GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" \ | ||
| -e BYTEBASE_URL="${{ env.BYTEBASE_URL }}" \ | ||
| -e BYTEBASE_SERVICE_ACCOUNT="${{ env.BYTEBASE_SERVICE_ACCOUNT }}" \ | ||
| -e BYTEBASE_SERVICE_ACCOUNT_SECRET="${{ secrets.BYTEBASE_SERVICE_ACCOUNT_SECRET }}" \ | ||
| -e BYTEBASE_PROJECT="${{ env.BYTEBASE_PROJECT }}" \ | ||
| -e BYTEBASE_TARGETS="${{ env.BYTEBASE_TARGETS }}" \ | ||
| -e GITHUB_REPOSITORY="${{ github.repository }}" \ | ||
| -e GITHUB_EVENT_NAME="${{ github.event_name }}" \ | ||
| -e GITHUB_EVENT_PATH=/github/workflow/event.json \ | ||
| -v "${{ github.event_path }}":/github/workflow/event.json:ro \ | ||
| -e GITHUB_API_URL="${{ github.api_url }}" \ | ||
| -e GITHUB_ACTIONS=true \ | ||
| -w /workspace \ | ||
| bytebase/bytebase-action:"${{ env.BYTEBASE_VERSION }}" \ | ||
| sh -c "ls -la /workspace/migrations/ && bytebase-action check --url=${{ env.BYTEBASE_URL }} --project=${{ env.BYTEBASE_PROJECT }} --targets=${{ env.BYTEBASE_TARGETS }} --file-pattern=${{ env.FILE_PATTERN }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ALTER TABLE IF EXISTS employee ADD COLUMN IF NOT EXISTS address TEXT NOT NULL DEFAULT ''; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yo