Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions src/MetadataFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ private function getOtherRolesToMainProjectRole(array $roles): array
$filteredRolesInRole = array_filter($rolesInRole, fn(GrantToRole $v) => !in_array($v->getName(), $roles));

foreach ($filteredRolesInRole as $item) {
if (Helper::isWorkspaceRole($item->getName())) {
continue;
}
$roles[$item->getName()] = Role::fromArray([
'name' => $item->getName(),
'owner' => $item->getGranteeName(),
Expand Down
13 changes: 13 additions & 0 deletions src/Snowflake/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ public static function filterUserDollarGrants(array $grants): array
});
}

/**
* Checks if a role name is a workspace role that should be skipped during migration.
* Workspace roles are ephemeral and dynamically created by Keboola when workspaces are provisioned.
* They may be deleted between migration phases, causing "Role does not exist" errors.
*
* @param string $roleName The role name to check
* @return bool True if the role is a workspace role that should be skipped
*/
public static function isWorkspaceRole(string $roleName): bool
{
return (bool) preg_match('/^(KEBOOLA|SAPI|sapi)_WORKSPACE_/', $roleName);
}

/**
* @param GrantToRole[] $grants
*/
Expand Down