Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7ed9cd5

Browse files
chore: update chatops readme (#44)
1 parent 2c2e810 commit 7ed9cd5

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

‎.github/workflows/chatops-migrate.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ env:
99
BYTEBASE_SERVICE_ACCOUNT: api@service.bytebase.com
1010
BYTEBASE_SERVICE_ACCOUNT_SECRET: ${{ secrets.BYTEBASE_SERVICE_ACCOUNT_SECRET }}
1111
BYTEBASE_PROJECT: "projects/hr"
12+
FILE_PATTERN: "migrations-semver/*.sql"
1213

1314
jobs:
1415
parse-command:
@@ -128,7 +129,6 @@ jobs:
128129
id: create-rollout
129130
env:
130131
BYTEBASE_TARGETS: ${{ needs.parse-command.outputs.targets }}
131-
FILE_PATTERN: "migrations-semver/*.sql"
132132
BYTEBASE_OUTPUT: ${{ runner.temp }}/bytebase-metadata.json
133133
run: |
134134
echo "Creating rollout plan for ${{ needs.parse-command.outputs.environment }}..."

‎README.md‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,55 @@ Set your service account password in the repository secrets setting with the nam
6363

6464
> [!IMPORTANT]
6565
> The migration filename SHOULD comply to the naming scheme described in [bytebase-action](https://github.com/bytebase/bytebase/tree/main/action#global-flags) `--file-pattern` flag section.
66+
67+
### How to configure chatops-migrate.yml
68+
69+
Copy [chatops-migrate.yml](/.github/workflows/chatops-migrate.yml) to your repository.
70+
71+
This workflow enables ChatOps-style deployments through PR comments. Team members can trigger migrations by commenting `/migrate <environment>` on pull requests.
72+
73+
#### Configuration
74+
75+
1. **Define environments in the workflow**: Edit the `config.yaml` generation step to define your environments and their database targets.
76+
77+
> [!NOTE]
78+
> The top-level keys (e.g., `test`, `prod`) are used as GitHub Actions job environments, so they must match the environment names configured in your repository settings.
79+
80+
81+
```yml
82+
- name: Write command config
83+
run: |
84+
cat <<EOF > ${{ runner.temp }}/config.yaml
85+
test:
86+
stage: environments/test
87+
targets:
88+
- instances/test-sample-instance/databases/hr_test
89+
prod:
90+
stage: environments/prod
91+
targets:
92+
- instances/prod-sample-instance/databases/hr_prod
93+
EOF
94+
```
95+
96+
- `stage`: The environment of the databases (e.g., `environments/test`)
97+
- `targets`: List of databases (e.g., `instances/test-sample-instance/databases/hr_test`)
98+
99+
2. **Set environment variables**: Configure these variables in the workflow:
100+
101+
```yml
102+
env:
103+
BYTEBASE_URL: https://demo.bytebase.com
104+
BYTEBASE_SERVICE_ACCOUNT: api@service.bytebase.com
105+
BYTEBASE_SERVICE_ACCOUNT_SECRET: ${{ secrets.BYTEBASE_SERVICE_ACCOUNT_SECRET }}
106+
BYTEBASE_PROJECT: "projects/hr"
107+
FILE_PATTERN: "migrations-semver/*.sql"
108+
```
109+
110+
3. **Configure GitHub environments**: Create environments matching your config (e.g., "test", "prod") in repository settings. Add deployment protection rules for production environments.
111+
112+
4. **Add service account secret**: Set `BYTEBASE_SERVICE_ACCOUNT_SECRET` in repository secrets.
113+
114+
#### Usage
115+
116+
- Comment `/migrate <environment>` on a PR to trigger deployment to that environment
117+
- Example: `/migrate prod` deploys to production (requires environment approval if configured)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /