Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
36c29a7
bundle: add postgres_roles as a resource type
pietern May 19, 2026
48d1701
postgres_role: require role_id and treat 404 from GetRole as not-found
pietern May 19, 2026
efe72ff
postgres_role: include enum_fields from validation regeneration
pietern May 19, 2026
02108c6
postgres_role: only log "does not exist" on the not-found path
pietern May 19, 2026
c253582
postgres_role: prefer Status.RoleId over TrimPrefix in RemapState
pietern May 26, 2026
1bff84d
Merge remote-tracking branch 'origin/main' into postgres-roles
pietern Jun 2, 2026
8768a75
postgres_role: treat postgres_role/auth_method/identity_type as recre…
pietern Jun 2, 2026
9d89b35
Merge remote-tracking branch 'origin/main' into postgres-roles
pietern Jun 3, 2026
ee1eb81
Merge remote-tracking branch 'origin/main' into postgres-roles
janniklasrose Jun 8, 2026
f102b28
postgres_role: clean up NEXT_CHANGELOG.md entries
janniklasrose Jun 9, 2026
b6a669d
dresources: isolate the role update-mask leaf collapse from the share…
janniklasrose Jun 9, 2026
91871b6
postgres_role: map RemapState from remote.Status
janniklasrose Jun 9, 2026
4360f21
testserver: honor update_mask in PostgresRoleUpdate
janniklasrose Jun 9, 2026
c8b7a1e
acceptance: document postgres role inheritance conflict (Badness)
janniklasrose Jun 12, 2026
79fb4fe
testserver: return 400 for duplicate Postgres role create
janniklasrose Jun 13, 2026
08473f8
acceptance: show bind as the escape hatch for a pre-existing role
janniklasrose Jun 13, 2026
9408669
Merge origin/main into postgres-roles
janniklasrose Jun 16, 2026
81d6c10
testserver: clarify applyRoleSpecMask collapse comment
janniklasrose Jun 16, 2026
b3bcfd3
postgres_role: don't synthesize spec from status in RemapState
janniklasrose Jun 16, 2026
f0f3b05
lint
janniklasrose Jun 16, 2026
412d086
regenerate
janniklasrose Jun 16, 2026
5976509
Remove comment block
janniklasrose Jun 16, 2026
ea1f33c
Address comment
janniklasrose Jun 16, 2026
06554de
Merge branch 'main' into postgres-roles
janniklasrose Jun 16, 2026
935a4cf
Address comment
janniklasrose Jun 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* engine/direct: Fix WAL corruption after two consecutive failed deploys ([#5606](https://github.com/databricks/cli/pull/5606)).
* engine/direct: Don't open the deployment state WAL when a deploy's plan fails ([#5607](https://github.com/databricks/cli/pull/5607)).
* Ignore unity catalog managed schema property defaults to avoid unnecessary drift ([#5195](https://github.com/databricks/cli/pull/5195)).
* Add Postgres role as a bundle resource ([#5467](https://github.com/databricks/cli/pull/5467)).
Comment thread
janniklasrose marked this conversation as resolved.

### Dependency updates

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bundle:
name: test-bundle

resources:
postgres_roles:
role1:
parent: projects/test-project/branches/main
role_id: test-role
postgres_role: app_role
3 changes: 3 additions & 0 deletions acceptance/bundle/deployment/bind/postgres_role/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions acceptance/bundle/deployment/bind/postgres_role/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

>>> [CLI] bundle deployment bind role1 projects/test-project/branches/main/roles/test-role --auto-approve
Updating deployment state...
Successfully bound postgres_role with an id 'projects/test-project/branches/main/roles/test-role'
Run 'bundle deploy' to deploy changes to your workspace

>>> [CLI] bundle summary

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't really show bind was successful, because it looks the same as after unbind

Name: test-bundle
Target: default
Workspace:
User: [USERNAME]
Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
Resources:
Postgres roles:
role1:
Name:
URL: (not deployed)

>>> [CLI] bundle deployment unbind role1
Updating deployment state...

>>> [CLI] bundle summary
Name: test-bundle
Target: default
Workspace:
User: [USERNAME]
Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
Resources:
Postgres roles:
role1:
Name:
URL: (not deployed)
6 changes: 6 additions & 0 deletions acceptance/bundle/deployment/bind/postgres_role/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ROLE_NAME="projects/test-project/branches/main/roles/test-role"
trace $CLI bundle deployment bind role1 "${ROLE_NAME}" --auto-approve
trace $CLI bundle summary

trace $CLI bundle deployment unbind role1
trace $CLI bundle summary
18 changes: 18 additions & 0 deletions acceptance/bundle/deployment/bind/postgres_role/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Local = true
Cloud = false

Ignore = [
".databricks"
]

[[Server]]
Pattern = "GET /api/2.0/postgres/projects/test-project/branches/main/roles/test-role"
Response.Body = '''
{
"name": "projects/test-project/branches/main/roles/test-role",
"parent": "projects/test-project/branches/main",
"status": {
"postgres_role": "app_role"
}
}
'''
20 changes: 20 additions & 0 deletions acceptance/bundle/invariant/configs/postgres_role.yml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
bundle:
name: test-bundle-$UNIQUE_NAME

resources:
postgres_projects:
project:
project_id: test-pg-project-$UNIQUE_NAME
display_name: Test Postgres Project

postgres_branches:
branch:
parent: ${resources.postgres_projects.project.name}
branch_id: test-branch-$UNIQUE_NAME
no_expiry: true

postgres_roles:
foo:
parent: ${resources.postgres_branches.branch.name}
role_id: test-role-$UNIQUE_NAME
postgres_role: app_role
1 change: 1 addition & 0 deletions acceptance/bundle/invariant/continue_293/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions acceptance/bundle/invariant/migrate/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions acceptance/bundle/invariant/no_drift/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions acceptance/bundle/invariant/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ EnvMatrix.INPUT_CONFIG = [
"postgres_catalog.yml.tmpl",
"postgres_endpoint.yml.tmpl",
"postgres_project.yml.tmpl",
"postgres_role.yml.tmpl",
"postgres_synced_table.yml.tmpl",
"registered_model.yml.tmpl",
"schema.yml.tmpl",
Expand Down Expand Up @@ -75,6 +76,7 @@ no_postgres_branch_on_cloud = ["CONFIG_Cloud=true", "INPUT_CONFIG=postgres_branc
no_postgres_endpoint_on_cloud = ["CONFIG_Cloud=true", "INPUT_CONFIG=postgres_endpoint.yml.tmpl"]
no_postgres_catalog_on_cloud = ["CONFIG_Cloud=true", "INPUT_CONFIG=postgres_catalog.yml.tmpl"]
no_postgres_synced_table_on_cloud = ["CONFIG_Cloud=true", "INPUT_CONFIG=postgres_synced_table.yml.tmpl"]
no_postgres_role_on_cloud = ["CONFIG_Cloud=true", "INPUT_CONFIG=postgres_role.yml.tmpl"]

# External locations require actual storage credentials with cloud IAM setup
# which are environment-specific, so we only test locally with the mock server
Expand Down
30 changes: 30 additions & 0 deletions acceptance/bundle/refschema/out.fields.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2977,6 +2977,36 @@ resources.postgres_projects.*.permissions[*].group_name string ALL
resources.postgres_projects.*.permissions[*].level iam.PermissionLevel ALL
resources.postgres_projects.*.permissions[*].service_principal_name string ALL
resources.postgres_projects.*.permissions[*].user_name string ALL
resources.postgres_roles.*.attributes *postgres.RoleAttributes ALL
resources.postgres_roles.*.attributes.bypassrls bool ALL
resources.postgres_roles.*.attributes.createdb bool ALL
resources.postgres_roles.*.attributes.createrole bool ALL
resources.postgres_roles.*.auth_method postgres.RoleAuthMethod ALL
resources.postgres_roles.*.create_time *time.Time REMOTE
resources.postgres_roles.*.id string INPUT
resources.postgres_roles.*.identity_type postgres.RoleIdentityType ALL
resources.postgres_roles.*.lifecycle resources.Lifecycle INPUT
resources.postgres_roles.*.lifecycle.prevent_destroy bool INPUT
resources.postgres_roles.*.membership_roles []postgres.RoleMembershipRole ALL
resources.postgres_roles.*.membership_roles[*] postgres.RoleMembershipRole ALL
resources.postgres_roles.*.modified_status string INPUT
resources.postgres_roles.*.name string REMOTE
resources.postgres_roles.*.parent string ALL
resources.postgres_roles.*.postgres_role string ALL
resources.postgres_roles.*.role_id string ALL
resources.postgres_roles.*.status *postgres.RoleRoleStatus REMOTE
resources.postgres_roles.*.status.attributes *postgres.RoleAttributes REMOTE
resources.postgres_roles.*.status.attributes.bypassrls bool REMOTE
resources.postgres_roles.*.status.attributes.createdb bool REMOTE
resources.postgres_roles.*.status.attributes.createrole bool REMOTE
resources.postgres_roles.*.status.auth_method postgres.RoleAuthMethod REMOTE
resources.postgres_roles.*.status.identity_type postgres.RoleIdentityType REMOTE
resources.postgres_roles.*.status.membership_roles []postgres.RoleMembershipRole REMOTE
resources.postgres_roles.*.status.membership_roles[*] postgres.RoleMembershipRole REMOTE
resources.postgres_roles.*.status.postgres_role string REMOTE
resources.postgres_roles.*.status.role_id string REMOTE
resources.postgres_roles.*.update_time *time.Time REMOTE
resources.postgres_roles.*.url string INPUT
resources.postgres_synced_tables.*.branch string ALL
resources.postgres_synced_tables.*.create_database_objects_if_missing bool ALL
resources.postgres_synced_tables.*.create_time *time.Time REMOTE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
bundle:
name: deploy-postgres-role-$UNIQUE_NAME

sync:
paths: []

resources:
postgres_projects:
my_project:
project_id: test-pg-proj-$UNIQUE_NAME
display_name: "Test Project for Role"
pg_version: 16
history_retention_duration: "604800s"

postgres_branches:
main:
parent: ${resources.postgres_projects.my_project.id}
branch_id: main
no_expiry: true

postgres_roles:
my_role:
parent: ${resources.postgres_branches.main.id}
role_id: test-role
postgres_role: app_role
attributes:
createdb: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"method": "POST",
"path": "/api/2.0/postgres/projects",
"q": {
"project_id": "test-pg-proj-[UNIQUE_NAME]"
},
"body": {
"spec": {
"display_name": "Test Project for Role",
"history_retention_duration": "604800s",
"pg_version": 16
}
}
}
{
"method": "POST",
"path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches",
"q": {
"branch_id": "main"
},
"body": {
"spec": {
"no_expiry": true
}
}
}
{
"method": "POST",
"path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/roles",
"q": {
"role_id": "test-role"
},
"body": {
"spec": {
"attributes": {
"createdb": true
},
"postgres_role": "app_role"
}
}
}
{
"method": "GET",
"path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/roles/test-role"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"method": "POST",
"path": "/api/2.0/postgres/projects",
"q": {
"project_id": "test-pg-proj-[UNIQUE_NAME]"
},
"body": {
"spec": {
"display_name": "Test Project for Role",
"history_retention_duration": "604800s",
"pg_version": 16
}
}
}
{
"method": "POST",
"path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches",
"q": {
"branch_id": "main"
},
"body": {
"parent": "projects/test-pg-proj-[UNIQUE_NAME]",
"spec": {
"no_expiry": true
}
}
}
{
"method": "POST",
"path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/roles",
"q": {
"role_id": "test-role"
},
"body": {
"parent": "projects/test-pg-proj-[UNIQUE_NAME]/branches/main",
"spec": {
"attributes": {
"createdb": true
},
"postgres_role": "app_role"
}
}
}
{
"method": "GET",
"path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/roles/test-role"
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading