Skip to content

Conversation

@d-bytebase
Copy link
Contributor

Summary

Add support for the new ApprovalTemplate.id field introduced in Bytebase API to support both built-in and custom approval templates.

Changes

  • ✅ Add required id field to approval flow schema with validation
  • ✅ Update convertToV1ApprovalSetting to set template ID when creating/updating
  • ✅ Update flattenWorkspaceApprovalSetting to include template ID when reading
  • ✅ Update Bytebase protobuf dependencies to latest version
    • buf.build/gen/go/bytebase/bytebase/protocolbuffers/gov1.36.10-20251010220308-691f96ff880a.1
    • buf.build/gen/go/bytebase/bytebase/connectrpc/gov1.19.1-20251010220308-691f96ff880a.1

Template ID Format

  • Built-in templates: Use bb.* prefix (e.g., bb.project-owner, bb.workspace-dba)
  • Custom templates: Use UUIDs

Example Usage

resource "bytebase_setting" "approval" {
  name = "settings/WORKSPACE_APPROVAL"
  
  approval_flow {
    rules {
      flow {
        id          = "bb.workspace-dba"
        title       = "DBA Approval"
        description = "Requires DBA approval"
        roles       = ["roles/workspaceDBA"]
      }
      conditions {
        source = "DDL"
        level  = "HIGH"
      }
    }
  }
}

Related

Test Plan

  • Code compiles successfully
  • Existing tests pass
  • Manual testing with Bytebase 3.12+ instance

🤖 Generated with Claude Code

d-bytebase and others added 3 commits October 10, 2025 16:25
Add support for the new ApprovalTemplate.id field introduced in
Bytebase API to support both built-in and custom approval templates.

Changes:
- Add required 'id' field to approval flow schema with validation
- Update convertToV1ApprovalSetting to set template ID
- Update flattenWorkspaceApprovalSetting to include template ID
- Update Bytebase protobuf dependencies to latest version

Built-in templates use 'bb.*' prefix (e.g., 'bb.project-owner',
'bb.workspace-dba'), while custom templates use UUIDs.

Related: bytebase/bytebase#17689

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Update all approval flow test cases to include the new required 'id' field.
Use custom flow IDs (e.g., 'test-flow', 'test-ddl-approval-flow')
instead of built-in 'bb.*' prefixed IDs for test cases.

Fixes test failures caused by adding the required id field to ApprovalTemplate.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Update all examples and tutorials to include the required 'id' field in
approval flow configurations. Regenerate documentation to reflect the
new schema changes.

Changes:
- Add id field to examples/setup/approval_flow.tf
- Add id field to tutorials/4-3-approval-flow.tf
- Regenerate docs/resources/setting.md with updated schema
- Regenerate docs/data-sources/setting.md with updated schema

All examples now use the built-in template ID format:
'bb.project-owner-workspace-dba-workspace-admin'

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@d-bytebase d-bytebase changed the title feat: add approval template id field for Bytebase 3.12 compatibility feat: add approval template id field for Bytebase 3.11 compatibility Oct 11, 2025
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@d-bytebase d-bytebase merged commit 3f15511 into main Oct 11, 2025
3 checks passed
@d-bytebase d-bytebase deleted the add-approval-template-id branch October 11, 2025 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants