mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-21 08:02:38 +00:00
fix: keep instance groups when editing auto-invite (#11217)
* fix: keep instance groups when editing auto-invite and push them from sync Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix: compare settings.yaml without undeclared instance groups on push Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix: read a missing auto_invite as empty when diffing settings.yaml on push Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * chore: update ee-repo-ref to f2fced19fcae81de7f6dac545010ce404c052e1b This commit updates the EE repository reference after PR #813 was merged in windmill-ee-private. Previous ee-repo-ref: cf4258c1232720ca3b82db2b22ea1fb4bca9533e New ee-repo-ref: f2fced19fcae81de7f6dac545010ce404c052e1b Automated by sync-ee-ref workflow. --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com> Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
This commit is contained in:
co-authored by
Claude Opus 5
windmill-internal-app[bot]
Ruben Fiszel
parent
5639187fec
commit
df61dea5fa
@@ -2546,9 +2546,9 @@ export function preservePendingScriptLocks(
|
||||
}
|
||||
|
||||
// `sync push` never applies the workspace's display name from settings.yaml and
|
||||
// applies its color only when the local file carries one (see
|
||||
// pushWorkspaceSettings), so on a push the fields it would not apply must
|
||||
// compare equal, or the row is listed on every run.
|
||||
// applies its color and auto_invite.instance_groups only when the local file
|
||||
// carries them (see pushWorkspaceSettings), so on a push the fields it would not
|
||||
// apply must compare equal, or the row is listed on every run.
|
||||
const isWorkspaceSettingsFile = (p: string) =>
|
||||
/^settings(\.[^./\\]+)?\.(yaml|json)$/.test(p);
|
||||
function stripUnappliedSettingsFields(local: any, remote: any) {
|
||||
@@ -2558,6 +2558,20 @@ function stripUnappliedSettingsFields(local: any, remote: any) {
|
||||
delete local?.color;
|
||||
delete remote?.color;
|
||||
}
|
||||
// push reads a missing auto_invite as {} on both sides
|
||||
if (local) local.auto_invite ??= {};
|
||||
if (remote) remote.auto_invite ??= {};
|
||||
const localInvite = local?.auto_invite;
|
||||
const remoteInvite = remote?.auto_invite;
|
||||
if (localInvite?.instance_groups == null) {
|
||||
for (const invite of [localInvite, remoteInvite]) {
|
||||
delete invite?.instance_groups;
|
||||
delete invite?.instance_groups_roles;
|
||||
}
|
||||
} else {
|
||||
localInvite.instance_groups_roles ??= {};
|
||||
if (remoteInvite) remoteInvite.instance_groups_roles ??= {};
|
||||
}
|
||||
}
|
||||
|
||||
export async function compareDynFSElement(
|
||||
|
||||
@@ -239,8 +239,19 @@ export async function pushWorkspaceSettings(
|
||||
});
|
||||
}
|
||||
|
||||
// Handle auto_invite using grouped format
|
||||
if (!deepEqual(localSettings.auto_invite, settings.auto_invite)) {
|
||||
// Handle auto_invite using grouped format. The domain invite and the instance groups
|
||||
// are applied by separate endpoints, each rewriting only its own keys.
|
||||
const {
|
||||
instance_groups: localGroups,
|
||||
instance_groups_roles: localGroupRoles,
|
||||
...localDomainInvite
|
||||
} = localSettings.auto_invite ?? {};
|
||||
const {
|
||||
instance_groups: remoteGroups,
|
||||
instance_groups_roles: remoteGroupRoles,
|
||||
...remoteDomainInvite
|
||||
} = settings.auto_invite ?? {};
|
||||
if (!deepEqual(localDomainInvite, remoteDomainInvite)) {
|
||||
log.debug(`Updating auto invite...`);
|
||||
|
||||
const localAutoInvite = localSettings.auto_invite;
|
||||
@@ -278,6 +289,20 @@ export async function pushWorkspaceSettings(
|
||||
}
|
||||
}
|
||||
|
||||
// Only when settings.yaml declares instance_groups: clearing a group removes the
|
||||
// workspace members it granted, so an absent key must never clear it.
|
||||
if (
|
||||
localGroups != undefined &&
|
||||
(!deepEqual(localGroups, remoteGroups) ||
|
||||
!deepEqual(localGroupRoles ?? {}, remoteGroupRoles ?? {}))
|
||||
) {
|
||||
log.debug(`Updating instance groups...`);
|
||||
await wmill.editInstanceGroups({
|
||||
workspace,
|
||||
requestBody: { groups: localGroups, roles: localGroupRoles ?? {} },
|
||||
});
|
||||
}
|
||||
|
||||
if (!deepEqual(localSettings.ai_config, settings.ai_config)) {
|
||||
log.debug(`Updating copilot settings...`);
|
||||
await wmill.editCopilotConfig({
|
||||
|
||||
Reference in New Issue
Block a user