uselagoon / lagoon

Lagoon, the developer-focused application delivery platform
https://docs.lagoon.sh/
Apache License 2.0
555 stars 148 forks source link

feat: add new project and group importer for organizations #3598

Closed shreddedbacon closed 9 months ago

shreddedbacon commented 9 months ago

General Checklist

Database Migrations

This adds a new query and mutation for helping with importing a project, and all associated groups into an organization.

The new query is called checkBulkImportProjectsAndGroupsToOrganization and it will return lists of all the projects and groups that would be imported into the organization. The payload allows an administrator to verify that the correct projects and groups would be imported. Giving the administrator time to verify the imported projects and groups and either remove, or add anything that may be missing, then run the query again.

This query also returns a second list of projects and groups, but it will contain anything in there that indicates a project or group has already been moved into a completely different organization, which would result in the import failing.

The new mutation is called bulkImportProjectsAndGroupsToOrganization and will perform the changes that checkBulkImportProjectsAndGroupsToOrganization outputs. There is the option of also detaching all notifications from all projects within the import. Otherwise existing notifications will remain attached to the projects, but the organization owners will only ever be able to remove these from their projects, because the main notification object will be owned by the platform (the way notifications always were before). The platform defined notifcations themselves will NOT be imported, as there could be the possibility that this is shared across multiple organizations, which is not supported by the organization model.

It marks all the previous importing queries and mutations as deprecated, and their usage is discouraged.

tobybellwood commented 9 months ago

Sample check query:

query checkBulkImportProjectsAndGroupsToOrganization {
    checkBulkImportProjectsAndGroupsToOrganization(
        input: { project: 1, organization: 1 }
    ) {
        projects {id, name}
        groups { id, name }
        otherOrgProjects { id, name }
        otherOrgGroups { id, name }
    }
}