Skip to content

Modern Docker Management, Designed for Everyone

fix: git sync file size limitations not being respected (#2427)

Kyle Mendell5ebd9531011a
diff --git a/backend/internal/models/gitops_sync.go b/backend/internal/models/gitops_sync.go
index 68bee0ab9..90c97fd07 100644
--- a/backend/internal/models/gitops_sync.go
+++ b/backend/internal/models/gitops_sync.go
@@ -20,9 +20,9 @@ type GitOpsSync struct {
SyncInterval int `json:"syncInterval" sortable:"true" search:"interval,frequency,schedule,cron,minutes"` // in minutes
SyncDirectory bool `json:"syncDirectory" gorm:"column:sync_directory"` // Sync entire directory containing compose file
SyncedFiles *string `json:"syncedFiles,omitempty" gorm:"column:synced_files"` // JSON array of synced file paths
- MaxSyncFiles int `json:"maxSyncFiles" gorm:"column:max_sync_files;default:500"` // 0 = inherit environment limit; unlimited only if the effective environment limit is also 0
- MaxSyncTotalSize int64 `json:"maxSyncTotalSize" gorm:"column:max_sync_total_size;default:52428800"` // bytes; 0 = inherit environment limit; unlimited only if the effective environment limit is also 0
- MaxSyncBinarySize int64 `json:"maxSyncBinarySize" gorm:"column:max_sync_binary_size;default:10485760"` // bytes; 0 = inherit environment limit; unlimited only if the effective environment limit is also 0
+ MaxSyncFiles int `json:"maxSyncFiles" gorm:"column:max_sync_files;default:500"` // 0 = unlimited; env var overrides take precedence
+ MaxSyncTotalSize int64 `json:"maxSyncTotalSize" gorm:"column:max_sync_total_size;default:52428800"` // bytes; 0 = unlimited; env var overrides take precedence
+ MaxSyncBinarySize int64 `json:"maxSyncBinarySize" gorm:"column:max_sync_binary_size;default:10485760"` // bytes; 0 = unlimited; env var overrides take precedence
LastSyncAt *time.Time `json:"lastSyncAt,omitempty" sortable:"true"`
LastSyncStatus *string `json:"lastSyncStatus,omitempty" search:"status,success,failed,pending,error"`
LastSyncError *string `json:"lastSyncError,omitempty"`
diff --git a/backend/internal/services/gitops_sync_service.go b/backend/internal/services/gitops_sync_service.go
index bde8a6a4e..f249de2e5 100644
--- a/backend/internal/services/gitops_sync_service.go
+++ b/backend/internal/services/gitops_sync_service.go
@@ -94,32 +94,6 @@ func megabytesToBytes(value int) int64 {
return int64(value) * 1024 * 1024
}
-func effectiveIntLimit(syncLimit, environmentLimit int) int {
- switch {
- case syncLimit == 0:
- return environmentLimit
- case environmentLimit == 0:
- return syncLimit
- case syncLimit < environmentLimit:
- return syncLimit
- default:
- return environmentLimit
- }
-}
-
-func effectiveInt64Limit(syncLimit, environmentLimit int64) int64 {
- switch {
- case syncLimit == 0:
- return environmentLimit
- case environmentLimit == 0:
- return syncLimit
- case syncLimit < environmentLimit:
- return syncLimit
- default:
- return environmentLimit
- }
-}
-
func NewGitOpsSyncService(db *database.DB, repoService *GitRepositoryService, projectService *ProjectService, swarmService *SwarmService, eventService *EventService, settingsService *SettingsService) *GitOpsSyncService {
return &GitOpsSyncService{
db: db,
@@ -151,10 +125,29 @@ func (s *GitOpsSyncService) getEnvironmentSyncLimits(ctx context.Context) (int,
func (s *GitOpsSyncService) getEffectiveSyncLimits(ctx context.Context, sync *models.GitOpsSync) (int, int64, int64) {
environmentMaxFiles, environmentMaxTotalSize, environmentMaxBinarySize := s.getEnvironmentSyncLimits(ctx)
+ if sync == nil {
+ return environmentMaxFiles, environmentMaxTotalSize, environmentMaxBinarySize
+ }
+
+ maxFiles := sync.MaxSyncFiles
+ maxTotalSize := sync.MaxSyncTotalSize
+ maxBinarySize := sync.MaxSyncBinarySize
+
+ if s.gitSyncLimitEnvOverrideActiveInternal("gitSyncMaxFiles") {
+ maxFiles = environmentMaxFiles
+ }
+ if s.gitSyncLimitEnvOverrideActiveInternal("gitSyncMaxTotalSizeMb") {
+ maxTotalSize = environmentMaxTotalSize
+ }
+ if s.gitSyncLimitEnvOverrideActiveInternal("gitSyncMaxBinarySizeMb") {
+ maxBinarySize = environmentMaxBinarySize
+ }
+
+ return maxFiles, maxTotalSize, maxBinarySize
+}
- return effectiveIntLimit(sync.MaxSyncFiles, environmentMaxFiles),
- effectiveInt64Limit(sync.MaxSyncTotalSize, environmentMaxTotalSize),
- effectiveInt64Limit(sync.MaxSyncBinarySize, environmentMaxBinarySize)
+func (s *GitOpsSyncService) gitSyncLimitEnvOverrideActiveInternal(key string) bool {
+ return s.settingsService != nil && s.settingsService.isEnvOverrideActiveInternal(key)
}
func (s *GitOpsSyncService) ListSyncIntervalsRaw(ctx context.Context) ([]startup.IntervalMigrationItem, error) {
@@ -327,7 +320,7 @@ func (s *GitOpsSyncService) CreateSync(ctx context.Context, environmentID string
sync.MaxSyncBinarySize = *req.MaxSyncBinarySize
}
- if err := s.db.WithContext(ctx).Create(&sync).Error; err != nil {
+ if err := s.db.WithContext(ctx).Select("*").Omit("Environment", "Repository", "Project").Create(&sync).Error; err != nil {
slog.ErrorContext(ctx, "Failed to create GitOps sync in database", "name", req.Name, "repositoryID", req.RepositoryID, "environmentID", environmentID, "error", err)
return nil, fmt.Errorf("failed to create sync: %w", err)
}
diff --git a/backend/internal/services/gitops_sync_service_test.go b/backend/internal/services/gitops_sync_service_test.go
index 3293cf62c..b2c46c7a1 100644
--- a/backend/internal/services/gitops_sync_service_test.go
+++ b/backend/internal/services/gitops_sync_service_test.go
@@ -414,6 +414,10 @@ func TestGitOpsSyncService_GetEnvironmentSyncLimits(t *testing.T) {
func TestGitOpsSyncService_GetEffectiveSyncLimits(t *testing.T) {
ctx := context.Background()
+ t.Setenv("GIT_SYNC_MAX_FILES", "")
+ t.Setenv("GIT_SYNC_MAX_TOTAL_SIZE_MB", "")
+ t.Setenv("GIT_SYNC_MAX_BINARY_SIZE_MB", "")
+
db := setupSettingsTestDB(t)
settingsSvc, err := NewSettingsService(ctx, db)
require.NoError(t, err)
@@ -424,7 +428,7 @@ func TestGitOpsSyncService_GetEffectiveSyncLimits(t *testing.T) {
svc := &GitOpsSyncService{settingsService: settingsSvc}
- t.Run("uses environment caps when sync values are looser", func(t *testing.T) {
+ t.Run("preserves sync-specific limits when they exceed settings", func(t *testing.T) {
sync := &models.GitOpsSync{
MaxSyncFiles: 500,
MaxSyncTotalSize: 50 * 1024 * 1024,
@@ -433,12 +437,12 @@ func TestGitOpsSyncService_GetEffectiveSyncLimits(t *testing.T) {
maxFiles, maxTotalSize, maxBinarySize := svc.getEffectiveSyncLimits(ctx, sync)
- require.Equal(t, 200, maxFiles)
- require.Equal(t, int64(30*1024*1024), maxTotalSize)
- require.Equal(t, int64(5*1024*1024), maxBinarySize)
+ require.Equal(t, 500, maxFiles)
+ require.Equal(t, int64(50*1024*1024), maxTotalSize)
+ require.Equal(t, int64(10*1024*1024), maxBinarySize)
})
- t.Run("preserves tighter sync-specific limits", func(t *testing.T) {
+ t.Run("preserves sync-specific limits when they are below settings", func(t *testing.T) {
sync := &models.GitOpsSync{
MaxSyncFiles: 75,
MaxSyncTotalSize: 8 * 1024 * 1024,
@@ -452,7 +456,7 @@ func TestGitOpsSyncService_GetEffectiveSyncLimits(t *testing.T) {
require.Equal(t, int64(2*1024*1024), maxBinarySize)
})
- t.Run("treats zero as unlimited", func(t *testing.T) {
+ t.Run("zero disables sync limits", func(t *testing.T) {
sync := &models.GitOpsSync{
MaxSyncFiles: 0,
MaxSyncTotalSize: 0,
@@ -461,8 +465,44 @@ func TestGitOpsSyncService_GetEffectiveSyncLimits(t *testing.T) {
maxFiles, maxTotalSize, maxBinarySize := svc.getEffectiveSyncLimits(ctx, sync)
- require.Equal(t, 200, maxFiles)
- require.Equal(t, int64(30*1024*1024), maxTotalSize)
- require.Equal(t, int64(5*1024*1024), maxBinarySize)
+ require.Equal(t, 0, maxFiles)
+ require.Equal(t, int64(0), maxTotalSize)
+ require.Equal(t, int64(0), maxBinarySize)
+ })
+
+ t.Run("environment variables override stored sync limits", func(t *testing.T) {
+ t.Setenv("GIT_SYNC_MAX_FILES", "10000")
+ t.Setenv("GIT_SYNC_MAX_TOTAL_SIZE_MB", "1024")
+ t.Setenv("GIT_SYNC_MAX_BINARY_SIZE_MB", "12")
+
+ sync := &models.GitOpsSync{
+ MaxSyncFiles: 500,
+ MaxSyncTotalSize: 50 * 1024 * 1024,
+ MaxSyncBinarySize: 10 * 1024 * 1024,
+ }
+
+ maxFiles, maxTotalSize, maxBinarySize := svc.getEffectiveSyncLimits(ctx, sync)
+
+ require.Equal(t, 10000, maxFiles)
+ require.Equal(t, int64(1024*1024*1024), maxTotalSize)
+ require.Equal(t, int64(12*1024*1024), maxBinarySize)
+ })
+
+ t.Run("environment variable zero disables runtime caps", func(t *testing.T) {
+ t.Setenv("GIT_SYNC_MAX_FILES", "0")
+ t.Setenv("GIT_SYNC_MAX_TOTAL_SIZE_MB", "0")
+ t.Setenv("GIT_SYNC_MAX_BINARY_SIZE_MB", "0")
+
+ sync := &models.GitOpsSync{
+ MaxSyncFiles: 75,
+ MaxSyncTotalSize: 8 * 1024 * 1024,
+ MaxSyncBinarySize: 2 * 1024 * 1024,
+ }
+
+ maxFiles, maxTotalSize, maxBinarySize := svc.getEffectiveSyncLimits(ctx, sync)
+
+ require.Equal(t, 0, maxFiles)
+ require.Equal(t, int64(0), maxTotalSize)
+ require.Equal(t, int64(0), maxBinarySize)
})
}
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index 3e6268a90..d147fa2b1 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -105,6 +105,7 @@
"common_yes": "Yes",
"common_no": "No",
"common_na": "N/A",
+ "common_default": "default",
"common_cancel": "Cancel",
"common_dismiss": "Dismiss",
"common_confirm": "Confirm",
@@ -1763,7 +1764,8 @@
"git_sync_sync_files": "Sync Files",
"git_sync_sync_files_description": "Copy sibling files from the compose directory into the managed project. When disabled, Arcane only syncs the selected compose file.",
"git_sync_auto_sync": "Auto Sync",
- "git_sync_sync_interval": "Sync Interval (minutes)",
+ "git_sync_sync_interval": "Sync Interval",
+ "git_sync_sync_interval_description": "Minutes",
"git_sync_last_sync": "Last Sync",
"git_sync_status": "Sync Status",
"git_sync_perform": "Sync Now",
@@ -1812,6 +1814,11 @@
"git_sync_max_total_size_help": "Maximum combined size of synced files per sync. Set 0 to disable the environment cap.",
"git_sync_max_binary_size_label": "Max Binary Size (MB)",
"git_sync_max_binary_size_help": "Maximum size for a single binary file copied during sync. Set 0 to disable the environment cap.",
+ "git_sync_per_sync_file_limits_title": "Sync File Limits",
+ "git_sync_per_sync_file_limits_description": "Set limits for this sync. Environment variables override these values when configured. Use 0 for no cap.",
+ "git_sync_max_files_per_sync_help": "Maximum files for this sync. Set 0 for no cap.",
+ "git_sync_max_total_size_per_sync_help": "Maximum combined size for this sync. Set 0 for no cap.",
+ "git_sync_max_binary_size_per_sync_help": "Maximum binary file size for this sync. Set 0 for no cap.",
"common_syncing": "Syncing...",
"_comment_customize_variables": "=== CUSTOMIZATION - VARIABLES ===",
"variables_title": "Variables",
diff --git a/frontend/src/lib/components/dialogs/gitops-sync-dialog.svelte b/frontend/src/lib/components/dialogs/gitops-sync-dialog.svelte
index 5a7d3d8de..ced5bb582 100644
--- a/frontend/src/lib/components/dialogs/gitops-sync-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/gitops-sync-dialog.svelte
@@ -2,19 +2,22 @@
import { ResponsiveDialog } from '$lib/components/ui/responsive-dialog/index.js';
import { Button } from '$lib/components/ui/button/index.js';
import FormInput from '$lib/components/form/form-input.svelte';
- import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
import SelectWithLabel from '$lib/components/form/select-with-label.svelte';
import { Spinner } from '$lib/components/ui/spinner/index.js';
import * as Select from '$lib/components/ui/select/index.js';
+ import * as Collapsible from '$lib/components/ui/collapsible/index.js';
import { Label } from '$lib/components/ui/label/index.js';
+ import { Switch } from '$lib/components/ui/switch/index.js';
+ import { Input } from '$lib/components/ui/input/index.js';
import FileBrowserDialog from '$lib/components/dialogs/file-browser-dialog.svelte';
import type { GitOpsSync, GitOpsSyncCreateDto, GitOpsSyncUpdateDto, GitRepository, BranchInfo } from '$lib/types/gitops.type';
import { gitRepositoryService } from '$lib/services/git-repository-service';
+ import { settingsService } from '$lib/services/settings-service';
import { z } from 'zod/v4';
import { createForm, preventDefault } from '$lib/utils/form.utils';
import { queryKeys } from '$lib/query/query-keys';
import { m } from '$lib/paraglide/messages';
- import { FolderOpenIcon, InfoIcon } from '$lib/icons';
+ import { ArrowRightIcon, FolderOpenIcon, InfoIcon } from '$lib/icons';
import * as Alert from '$lib/components/ui/alert';
import { createQuery } from '@tanstack/svelte-query';
@@ -49,16 +52,46 @@
branch: z.string().min(1, m.common_required()),
composePath: z.string().min(1, m.common_required()),
syncDirectory: z.boolean().default(false),
+ maxSyncFiles: z.coerce.number().int().nonnegative(),
+ maxSyncTotalSizeMb: z.coerce.number().int().nonnegative(),
+ maxSyncBinarySizeMb: z.coerce.number().int().nonnegative(),
autoSync: z.boolean().default(true),
syncInterval: z.number().min(1).default(5)
});
+ const bytesPerMegabyte = 1024 * 1024;
+
+ function bytesToMegabytesInternal(value: number | undefined, fallback: number): number {
+ if (value === undefined) return fallback;
+ return Math.round(value / bytesPerMegabyte);
+ }
+
+ function megabytesToBytesInternal(value: number): number {
+ return value * bytesPerMegabyte;
+ }
+
+ const settingsQuery = createQuery(() => ({
+ queryKey: queryKeys.settings.global(),
+ queryFn: () => settingsService.getSettings(),
+ enabled: open,
+ staleTime: 30_000
+ }));
+
let formData = $derived({
name: open && syncToEdit ? syncToEdit.name : '',
repositoryId: open && syncToEdit ? syncToEdit.repositoryId : '',
branch: open && syncToEdit ? syncToEdit.branch : 'main',
composePath: open && syncToEdit ? syncToEdit.composePath : 'docker-compose.yml',
syncDirectory: open && syncToEdit ? (syncToEdit.syncDirectory ?? false) : false,
+ maxSyncFiles: open && syncToEdit ? (syncToEdit.maxSyncFiles ?? 0) : (settingsQuery.data?.gitSyncMaxFiles ?? 0),
+ maxSyncTotalSizeMb:
+ open && syncToEdit
+ ? bytesToMegabytesInternal(syncToEdit.maxSyncTotalSize, 0)
+ : (settingsQuery.data?.gitSyncMaxTotalSizeMb ?? 0),
+ maxSyncBinarySizeMb:
+ open && syncToEdit
+ ? bytesToMegabytesInternal(syncToEdit.maxSyncBinarySize, 0)
+ : (settingsQuery.data?.gitSyncMaxBinarySizeMb ?? 0),
autoSync: open && syncToEdit ? (syncToEdit.autoSync ?? true) : true,
syncInterval: open && syncToEdit ? (syncToEdit.syncInterval ?? 5) : 5
});
@@ -73,7 +106,8 @@
staleTime: 0
}));
const repositories = $derived<GitRepository[]>(repositoriesQuery.data?.data ?? []);
- const loadingData = $derived(repositoriesQuery.isPending || repositoriesQuery.isFetching);
+ const loadingSettings = $derived(!isEditMode && (settingsQuery.isPending || settingsQuery.isFetching));
+ const loadingData = $derived(repositoriesQuery.isPending || repositoriesQuery.isFetching || loadingSettings);
const branchesQuery = createQuery(() => ({
queryKey: queryKeys.gitRepositories.branches(selectedRepository?.value || ''),
@@ -124,6 +158,9 @@
targetType: selectedTargetType,
projectName: data.name,
syncDirectory: data.syncDirectory,
+ maxSyncFiles: data.maxSyncFiles,
+ maxSyncTotalSize: megabytesToBytesInternal(data.maxSyncTotalSizeMb),
+ maxSyncBinarySize: megabytesToBytesInternal(data.maxSyncBinarySizeMb),
autoSync: data.autoSync,
syncInterval: data.syncInterval
};
@@ -136,7 +173,7 @@
bind:open
title={isEditMode ? m.git_sync_edit_title() : m.git_sync_add_title()}
description={isEditMode ? m.common_edit_description() : m.common_add_description()}
- contentClass="sm:max-w-2xl"
+ contentClass="sm:max-w-3xl"
>
{#snippet children()}
{#if loadingData}
@@ -144,134 +181,205 @@
<Spinner class="size-6" />
</div>
{:else}
- <form id="sync-form" onsubmit={preventDefault(handleSubmit)} class="grid gap-y-3 py-4">
- <FormInput label={m.git_sync_name()} type="text" placeholder={m.common_name_placeholder()} bind:input={$inputs.name} />
-
- <SelectWithLabel
- id="targetType"
- label={m.webhook_target_type_label()}
- value={selectedTargetType}
- options={targetTypeOptions}
- onValueChange={(value) => (selectedTargetType = value as GitOpsSyncTargetType)}
- />
-
- <div class="space-y-1.5">
- <Label for="repository">{m.git_sync_repository()}</Label>
- <Select.Root
- type="single"
- value={selectedRepository?.value}
- onValueChange={(v) => {
- if (v) {
- const repo = repositories.find((r) => r.id === v);
- if (repo) {
- selectedRepository = { value: repo.id, label: repo.name };
- $inputs.repositoryId.value = v;
- }
- }
- }}
- >
- <Select.Trigger id="repository" class="w-full" aria-invalid={$inputs.repositoryId.error ? 'true' : undefined}>
- <span>{selectedRepository?.label ?? m.common_select_placeholder()}</span>
- </Select.Trigger>
- <Select.Content style="width: var(--bits-select-anchor-width);">
- {#each repositories as repo}
- <Select.Item value={repo.id} class="truncate">{repo.name}</Select.Item>
- {/each}
- </Select.Content>
- </Select.Root>
- {#if $inputs.repositoryId.error}
- <p class="mt-1 text-sm text-red-500">{$inputs.repositoryId.error}</p>
- {/if}
- </div>
+ <form id="sync-form" onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
+ <div class="space-y-3">
+ <div class="grid gap-3 sm:grid-cols-2">
+ <FormInput
+ label={m.git_sync_name()}
+ type="text"
+ placeholder={m.common_name_placeholder()}
+ bind:input={$inputs.name}
+ />
+
+ <SelectWithLabel
+ id="targetType"
+ label={m.webhook_target_type_label()}
+ value={selectedTargetType}
+ options={targetTypeOptions}
+ onValueChange={(value) => (selectedTargetType = value as GitOpsSyncTargetType)}
+ />
+ </div>
+
+ <div class="grid gap-3 sm:grid-cols-[minmax(0,1fr)_12rem]">
+ <div class="space-y-1.5">
+ <Label for="repository">{m.git_sync_repository()}</Label>
+ <Select.Root
+ type="single"
+ value={selectedRepository?.value}
+ onValueChange={(v) => {
+ if (v) {
+ const repo = repositories.find((r) => r.id === v);
+ if (repo) {
+ selectedRepository = { value: repo.id, label: repo.name };
+ $inputs.repositoryId.value = v;
+ }
+ }
+ }}
+ >
+ <Select.Trigger id="repository" class="w-full" aria-invalid={$inputs.repositoryId.error ? 'true' : undefined}>
+ <span>{selectedRepository?.label ?? m.common_select_placeholder()}</span>
+ </Select.Trigger>
+ <Select.Content style="width: var(--bits-select-anchor-width);">
+ {#each repositories as repo (repo.id)}
+ <Select.Item value={repo.id} class="truncate">{repo.name}</Select.Item>
+ {/each}
+ </Select.Content>
+ </Select.Root>
+ {#if $inputs.repositoryId.error}
+ <p class="mt-1 text-sm text-red-500">{$inputs.repositoryId.error}</p>
+ {/if}
+ </div>
+
+ <div class="space-y-1.5">
+ <Label for="branch">{m.git_sync_branch()}</Label>
+ {#if loadingBranches}
+ <div class="flex h-10 items-center gap-2 rounded-md border px-3">
+ <Spinner class="size-4" />
+ <span class="text-muted-foreground text-sm">{m.common_loading()}</span>
+ </div>
+ {:else if branches.length > 0}
+ <Select.Root
+ type="single"
+ value={$inputs.branch.value}
+ onValueChange={(v) => {
+ if (v) {
+ $inputs.branch.value = v;
+ }
+ }}
+ >
+ <Select.Trigger id="branch" class="w-full" aria-invalid={$inputs.branch.error ? 'true' : undefined}>
+ <span>{$inputs.branch.value || m.common_select_placeholder()}</span>
+ </Select.Trigger>
+ <Select.Content style="width: var(--bits-select-anchor-width);">
+ {#each branches as branch (branch.name)}
+ <Select.Item value={branch.name} class="truncate">
+ {branch.name}
+ {#if branch.isDefault}
+ <span class="text-muted-foreground ml-2 text-xs">({m.common_default()})</span>
+ {/if}
+ </Select.Item>
+ {/each}
+ </Select.Content>
+ </Select.Root>
+ {:else}
+ <FormInput type="text" placeholder="main" bind:input={$inputs.branch} />
+ {/if}
+ {#if $inputs.branch.error}
+ <p class="mt-1 text-sm text-red-500">{$inputs.branch.error}</p>
+ {/if}
+ </div>
+ </div>
- <div class="space-y-1.5">
- <Label for="branch">{m.git_sync_branch()}</Label>
- {#if loadingBranches}
- <div class="flex items-center gap-2">
- <Spinner class="size-4" />
- <span class="text-muted-foreground text-sm">Loading branches...</span>
+ <div class="space-y-1.5">
+ <Label for="composePath">{m.git_sync_compose_path()}</Label>
+ <div class="flex gap-2">
+ <div class="flex-1">
+ <FormInput type="text" placeholder="docker-compose.yml" bind:input={$inputs.composePath} />
+ </div>
+ <Button
+ type="button"
+ variant="outline"
+ size="icon"
+ onclick={() => (showFileBrowser = true)}
+ disabled={!selectedRepository?.value || !$inputs.branch.value}
+ title={m.git_sync_browse_files_title()}
+ >
+ <FolderOpenIcon class="size-4" />
+ </Button>
</div>
- {:else if branches.length > 0}
- <Select.Root
- type="single"
- value={$inputs.branch.value}
- onValueChange={(v) => {
- if (v) {
- $inputs.branch.value = v;
- }
- }}
- >
- <Select.Trigger id="branch" class="w-full" aria-invalid={$inputs.branch.error ? 'true' : undefined}>
- <span>{$inputs.branch.value || m.common_select_placeholder()}</span>
- </Select.Trigger>
- <Select.Content style="width: var(--bits-select-anchor-width);">
- {#each branches as branch}
- <Select.Item value={branch.name} class="truncate">
- {branch.name}
- {#if branch.isDefault}
- <span class="text-muted-foreground ml-2 text-xs">(default)</span>
- {/if}
- </Select.Item>
- {/each}
- </Select.Content>
- </Select.Root>
- {:else}
- <FormInput type="text" placeholder="main" bind:input={$inputs.branch} />
- {/if}
- {#if $inputs.branch.error}
- <p class="mt-1 text-sm text-red-500">{$inputs.branch.error}</p>
- {/if}
- <p class="text-muted-foreground text-xs">
- {branches.length > 0 ? m.git_sync_branch_select_hint() : m.git_sync_branch_manual_hint()}
- </p>
+ </div>
</div>
- <div class="space-y-1.5">
- <Label for="composePath">{m.git_sync_compose_path()}</Label>
- <div class="flex gap-2">
- <div class="flex-1">
- <FormInput type="text" placeholder="docker-compose.yml" bind:input={$inputs.composePath} />
+ <div class="border-border/70 bg-muted/20 grid gap-3 rounded-lg border p-3 sm:grid-cols-[minmax(0,1fr)_8rem]">
+ <div class="grid gap-3 sm:grid-cols-2">
+ <div class="flex items-start gap-3">
+ <Switch id="syncDirectorySwitch" bind:checked={$inputs.syncDirectory.value} />
+ <div class="space-y-1">
+ <Label for="syncDirectorySwitch" class="mb-0 text-sm leading-none font-medium">{m.git_sync_sync_files()}</Label>
+ <p class="text-muted-foreground text-xs">{m.git_sync_sync_files_description()}</p>
+ {#if $inputs.syncDirectory.error}
+ <p class="text-destructive text-xs font-medium">{$inputs.syncDirectory.error}</p>
+ {/if}
+ </div>
+ </div>
+
+ <div class="flex items-start gap-3">
+ <Switch id="autoSyncSwitch" bind:checked={$inputs.autoSync.value} />
+ <div class="space-y-1">
+ <Label for="autoSyncSwitch" class="mb-0 text-sm leading-none font-medium">{m.git_sync_auto_sync()}</Label>
+ <p class="text-muted-foreground text-xs">{m.common_auto_sync_description()}</p>
+ {#if $inputs.autoSync.error}
+ <p class="text-destructive text-xs font-medium">{$inputs.autoSync.error}</p>
+ {/if}
+ </div>
</div>
- <Button
- type="button"
- variant="outline"
- size="icon"
- onclick={() => (showFileBrowser = true)}
- disabled={!selectedRepository?.value || !$inputs.branch.value}
- title="Browse files"
- >
- <FolderOpenIcon class="size-4" />
- </Button>
</div>
- {#if !selectedRepository?.value || !$inputs.branch.value}
- <p class="text-muted-foreground text-xs">Select a repository and branch to browse files</p>
- {/if}
+
+ <div class="space-y-2 sm:max-w-32">
+ <div class="space-y-1">
+ <Label for="syncInterval" class="mb-0 text-sm leading-none font-medium">
+ {m.git_sync_sync_interval()}
+ </Label>
+ <p class="text-muted-foreground text-xs">{m.git_sync_sync_interval_description()}</p>
+ </div>
+ <Input
+ id="syncInterval"
+ type="number"
+ placeholder="5"
+ bind:value={$inputs.syncInterval.value}
+ aria-invalid={$inputs.syncInterval.error ? 'true' : undefined}
+ />
+ {#if $inputs.syncInterval.error}
+ <p class="text-destructive text-xs font-medium">{$inputs.syncInterval.error}</p>
+ {/if}
+ </div>
</div>
- <SwitchWithLabel
- id="syncDirectorySwitch"
- label={m.git_sync_sync_files()}
- description={m.git_sync_sync_files_description()}
- error={$inputs.syncDirectory.error}
- bind:checked={$inputs.syncDirectory.value}
- />
-
- <SwitchWithLabel
- id="autoSyncSwitch"
- label={m.git_sync_auto_sync()}
- description={m.common_auto_sync_description()}
- error={$inputs.autoSync.error}
- bind:checked={$inputs.autoSync.value}
- />
-
- <FormInput label={m.git_sync_sync_interval()} type="number" placeholder="5" bind:input={$inputs.syncInterval} />
-
- <Alert.Root class="border-primary/20 bg-primary/5 dark:border-primary/30 dark:bg-primary/10">
+ <Collapsible.Root class="group/collapsible">
+ <Collapsible.Trigger
+ type="button"
+ class="text-muted-foreground hover:text-foreground flex w-full items-start justify-between gap-3 rounded-md px-1 py-1.5 text-left text-sm transition-colors"
+ >
+ <span class="min-w-0">
+ <span class="block font-medium">{m.git_sync_per_sync_file_limits_title()}</span>
+ </span>
+ <ArrowRightIcon class="mt-0.5 size-4 shrink-0 transition-transform group-data-[state=open]/collapsible:rotate-90" />
+ </Collapsible.Trigger>
+ <Collapsible.Content>
+ <div class="border-border/70 mt-2 rounded-lg border border-dashed p-3">
+ <p class="text-muted-foreground mb-3 text-xs">{m.git_sync_per_sync_file_limits_description()}</p>
+ <div class="grid gap-3 sm:grid-cols-3">
+ <FormInput
+ label={m.git_sync_max_files_label()}
+ type="number"
+ placeholder="0"
+ helpText={m.git_sync_max_files_per_sync_help()}
+ bind:input={$inputs.maxSyncFiles}
+ />
+ <FormInput
+ label={m.git_sync_max_total_size_label()}
+ type="number"
+ placeholder="0"
+ helpText={m.git_sync_max_total_size_per_sync_help()}
+ bind:input={$inputs.maxSyncTotalSizeMb}
+ />
+ <FormInput
+ label={m.git_sync_max_binary_size_label()}
+ type="number"
+ placeholder="0"
+ helpText={m.git_sync_max_binary_size_per_sync_help()}
+ bind:input={$inputs.maxSyncBinarySizeMb}
+ />
+ </div>
+ </div>
+ </Collapsible.Content>
+ </Collapsible.Root>
+
+ <Alert.Root class="border-border/70 bg-muted/20 text-muted-foreground py-2 [&>svg]:top-1/2 [&>svg]:-translate-y-1/2">
<InfoIcon class="size-4" />
- <Alert.Title>{m.webhook_hint_title()}</Alert.Title>
- <Alert.Description>
+ <Alert.Description class="text-xs">
{m.webhook_hint_description()}
- <a href="/settings/webhooks" class="underline">{m.sidebar_settings()} → {m.webhook_page_title()}</a>
+ <a href="/settings/webhooks" class="text-foreground underline">{m.webhook_page_title()}</a>
{m.git_sync_webhook_hint_suffix()}
</Alert.Description>
</Alert.Root>
diff --git a/types/gitops/gitops.go b/types/gitops/gitops.go
index 1540022c7..011f5da7f 100644
--- a/types/gitops/gitops.go
+++ b/types/gitops/gitops.go
@@ -131,19 +131,19 @@ type GitOpsSync struct {
SyncedFiles *string `json:"syncedFiles,omitempty"`
// MaxSyncFiles is the maximum number of files to sync.
- // 0 means inherit the environment limit; unlimited only applies when the effective environment limit is also 0.
+ // 0 means unlimited; env var overrides take precedence.
//
// Required: true
MaxSyncFiles int `json:"maxSyncFiles"`
// MaxSyncTotalSize is the maximum total size in bytes for all synced files.
- // 0 means inherit the environment limit; unlimited only applies when the effective environment limit is also 0.
+ // 0 means unlimited; env var overrides take precedence.
//
// Required: true
MaxSyncTotalSize int64 `json:"maxSyncTotalSize"`
// MaxSyncBinarySize is the maximum size in bytes for individual binary files.
- // 0 means inherit the environment limit; unlimited only applies when the effective environment limit is also 0.
+ // 0 means unlimited; env var overrides take precedence.
//
// Required: true
MaxSyncBinarySize int64 `json:"maxSyncBinarySize"`
@@ -348,22 +348,22 @@ type CreateSyncRequest struct {
SyncDirectory *bool `json:"syncDirectory,omitempty"`
// MaxSyncFiles is the maximum number of files to sync.
- // 0 means inherit the environment limit; unlimited only applies when the effective environment limit is also 0.
- // Default: 500
+ // 0 means unlimited; env var overrides take precedence.
+ // Default: 0
//
// Required: false
MaxSyncFiles *int `json:"maxSyncFiles,omitempty"`
// MaxSyncTotalSize is the maximum total size in bytes for all synced files.
- // 0 means inherit the environment limit; unlimited only applies when the effective environment limit is also 0.
- // Default: 52428800 (50MB)
+ // 0 means unlimited; env var overrides take precedence.
+ // Default: 0
//
// Required: false
MaxSyncTotalSize *int64 `json:"maxSyncTotalSize,omitempty"`
// MaxSyncBinarySize is the maximum size in bytes for individual binary files.
- // 0 means inherit the environment limit; unlimited only applies when the effective environment limit is also 0.
- // Default: 10485760 (10MB)
+ // 0 means unlimited; env var overrides take precedence.
+ // Default: 0
//
// Required: false
MaxSyncBinarySize *int64 `json:"maxSyncBinarySize,omitempty"`
@@ -419,19 +419,19 @@ type UpdateSyncRequest struct {
SyncDirectory *bool `json:"syncDirectory,omitempty"`
// MaxSyncFiles is the maximum number of files to sync.
- // 0 means inherit the environment limit; unlimited only applies when the effective environment limit is also 0.
+ // 0 means unlimited; env var overrides take precedence.
//
// Required: false
MaxSyncFiles *int `json:"maxSyncFiles,omitempty"`
// MaxSyncTotalSize is the maximum total size in bytes for all synced files.
- // 0 means inherit the environment limit; unlimited only applies when the effective environment limit is also 0.
+ // 0 means unlimited; env var overrides take precedence.
//
// Required: false
MaxSyncTotalSize *int64 `json:"maxSyncTotalSize,omitempty"`
// MaxSyncBinarySize is the maximum size in bytes for individual binary files.
- // 0 means inherit the environment limit; unlimited only applies when the effective environment limit is also 0.
+ // 0 means unlimited; env var overrides take precedence.
//
// Required: false
MaxSyncBinarySize *int64 `json:"maxSyncBinarySize,omitempty"`
@@ -688,19 +688,19 @@ type ImportGitOpsSyncRequest struct {
SyncDirectory *bool `json:"syncDirectory,omitempty"`
// MaxSyncFiles is the maximum number of files to sync.
- // 0 means inherit the environment limit; unlimited only applies when the effective environment limit is also 0.
+ // 0 means unlimited; env var overrides take precedence.
//
// Required: false
MaxSyncFiles *int `json:"maxSyncFiles,omitempty"`
// MaxSyncTotalSize is the maximum total size in bytes for all synced files.
- // 0 means inherit the environment limit; unlimited only applies when the effective environment limit is also 0.
+ // 0 means unlimited; env var overrides take precedence.
//
// Required: false
MaxSyncTotalSize *int64 `json:"maxSyncTotalSize,omitempty"`
// MaxSyncBinarySize is the maximum size in bytes for individual binary files.
- // 0 means inherit the environment limit; unlimited only applies when the effective environment limit is also 0.
+ // 0 means unlimited; env var overrides take precedence.
//
// Required: false
MaxSyncBinarySize *int64 `json:"maxSyncBinarySize,omitempty"`