Step 1: Create a Workload Identity in Bytebase
- Go to IAM & Admin > Users & Groups.
- Click Add User in the upper-right corner.
- Select Workload Identity as the Type.
- Fill in the configuration:
| Field | Description | Example |
|---|---|---|
| Name | Display name for this identity | GitHub Actions Deploy |
Unique email for this identity (must end with @workload.bytebase.com) | [email protected] | |
| Platform | Select GitHub Actions | GitHub Actions |
| Owner | GitHub organization or username | my-org |
| Repository | Repository name | my-repo |
| Branch | Branch name (use * for all branches) | main |
- Click Confirm to create the Workload Identity.
Step 2: Assign Roles
After creating the Workload Identity, assign theGitOps Service Agent role to enable automated CI/CD workflows:
- Go to your project’s Settings > Members.
- Click Grant Access.
- Enter the Workload Identity email (e.g.,
[email protected]). - Select the GitOps Service Agent role.
- Click Confirm.
Step 3: Configure GitHub Actions Workflow
In your GitHub Actions workflow, add the following configuration:Request OIDC Token
Addid-token: write permission and use the actions/github-script action to get the token:
Complete Example
Here’s a complete workflow that creates a database change using Workload Identity:Troubleshooting
Token Exchange Fails
If the token exchange returns an error:- Verify the repository and branch: Check that your workflow’s repository, branch match the configured values in Bytebase.
-
Check the audience: Ensure the audience in your
getIDToken()call matcheshttps://github.com/{owner}.
Permission Denied
If API calls return permission errors:- Verify the Workload Identity has the
GitOps Service Agentrole assigned. - Check that the Workload Identity is a member of the target project.
Debug Token Claims
To inspect the OIDC token claims, decode the JWT:sub, aud, and iss that Bytebase validates.
