Skip to content

Modern Docker Management, Designed for Everyone

feat: carry pre-deploy hook and deploy options through gitops sync import (#3952)

Kyle Mendellda22a65fac88
diff --git a/backend/internal/gitops/backup_test.go b/backend/internal/gitops/backup_test.go
index af2f46a3c..be12bbe6d 100644
--- a/backend/internal/gitops/backup_test.go
+++ b/backend/internal/gitops/backup_test.go
@@ -487,7 +487,7 @@ func TestGitOpsBackup_CreateValidation(t *testing.T) {
},
{
name: "deployment-only pre-deploy script",
- request: gitops.CreateSyncRequest{PreDeployScriptPath: &scriptPath},
+ request: gitops.CreateSyncRequest{PreDeployConfigRequest: gitops.PreDeployConfigRequest{PreDeployScriptPath: &scriptPath}},
wantErr: common.ErrValidation,
},
}
@@ -652,3 +652,58 @@ func TestGitOpsDeploy_LinksExistingProject(t *testing.T) {
}, common.User{ID: "user-1", Username: "tester"})
require.ErrorIs(t, err, common.ErrConflict)
}
+
+func TestGitOpsImport_ForwardsDeployAndLifecycleFields(t *testing.T) {
+ env := setupGitOpsBackupTestServiceInternal(t)
+ ctx := context.Background()
+ require.NoError(t, env.service.settingsService.SetStringSetting(ctx, "lifecycleEnabled", "true"))
+
+ resp, err := env.service.ImportSyncs(ctx, "0", []gitops.ImportGitOpsSyncRequest{
+ {
+ SyncName: "Media-Server",
+ GitRepo: "backup-remote",
+ Branch: "main",
+ DockerComposePath: "apps/demo/compose.yaml",
+ SyncDirectory: new(true),
+ ProjectName: "media-server",
+ PullImageAfterSync: new(true),
+ RedeployAfterSync: new(true),
+ PreDeployConfigRequest: gitops.PreDeployConfigRequest{
+ PreDeployScriptPath: new("scripts/decrypt.sh"),
+ PreDeployRunnerImage: new("alpine:3.20"),
+ PreDeployEnv: new("SOPS_AGE_KEY=secret\n"),
+ PreDeployTimeoutSec: new(120),
+ PreDeployNetworkMode: new("bridge"),
+ },
+ },
+ {
+ SyncName: "plain",
+ GitRepo: "backup-remote",
+ Branch: "main",
+ DockerComposePath: "apps/demo/compose.yaml",
+ },
+ }, common.SystemUser)
+ require.NoError(t, err)
+ require.Empty(t, resp.Errors)
+ require.Equal(t, 2, resp.SuccessCount)
+
+ var full, plain projectpkg.GitOpsSync
+ require.NoError(t, env.db.Where("name = ?", "Media-Server").First(&full).Error)
+ require.NoError(t, env.db.Where("name = ?", "plain").First(&plain).Error)
+
+ assert.Equal(t, "media-server", full.ProjectName)
+ assert.True(t, full.PullImageAfterSync)
+ assert.True(t, full.RedeployAfterSync)
+ assert.Equal(t, "scripts/decrypt.sh", *full.PreDeployScriptPath)
+ assert.Equal(t, "alpine:3.20", *full.PreDeployRunnerImage)
+ assert.Equal(t, "SOPS_AGE_KEY=secret", *full.PreDeployEnv)
+ assert.Equal(t, 120, full.PreDeployTimeoutSec)
+ assert.Equal(t, "bridge", full.PreDeployNetworkMode)
+
+ assert.Equal(t, "plain", plain.ProjectName)
+ assert.False(t, plain.PullImageAfterSync)
+ assert.False(t, plain.RedeployAfterSync)
+ assert.Nil(t, plain.PreDeployScriptPath)
+ assert.Equal(t, 60, plain.PreDeployTimeoutSec)
+ assert.Equal(t, "none", plain.PreDeployNetworkMode)
+}
diff --git a/backend/internal/gitops/gitops_sync.go b/backend/internal/gitops/gitops_sync.go
index 721c06b58..e72adf752 100644
--- a/backend/internal/gitops/gitops_sync.go
+++ b/backend/internal/gitops/gitops_sync.go
@@ -1640,28 +1640,31 @@ func (s *GitOpsSyncService) ImportSyncs(ctx context.Context, environmentID strin
repo, err := s.repoService.GetRepositoryByName(ctx, importItem.GitRepo)
if err != nil {
response.FailedCount++
- response.Errors = append(response.Errors, fmt.Sprintf("Stack '%s': Repository '%s' not found (%v)", importItem.SyncName, importItem.GitRepo, err))
+ response.Errors = append(response.Errors, fmt.Sprintf("Sync '%s': Repository '%s' not found (%v)", importItem.SyncName, importItem.GitRepo, err))
continue
}
createReq := gitops.CreateSyncRequest{
- Name: importItem.SyncName,
- RepositoryID: repo.ID,
- Branch: importItem.Branch,
- ComposePath: importItem.DockerComposePath,
- ProjectName: importItem.SyncName,
- AutoSync: new(importItem.AutoSync),
- SyncInterval: new(importItem.SyncInterval),
- SyncDirectory: importItem.SyncDirectory,
- MaxSyncFiles: importItem.MaxSyncFiles,
- MaxSyncTotalSize: importItem.MaxSyncTotalSize,
- MaxSyncBinarySize: importItem.MaxSyncBinarySize,
+ Name: importItem.SyncName,
+ RepositoryID: repo.ID,
+ Branch: importItem.Branch,
+ ComposePath: importItem.DockerComposePath,
+ ProjectName: importItem.ProjectName,
+ AutoSync: new(importItem.AutoSync),
+ SyncInterval: new(importItem.SyncInterval),
+ SyncDirectory: importItem.SyncDirectory,
+ PullImageAfterSync: importItem.PullImageAfterSync,
+ RedeployAfterSync: importItem.RedeployAfterSync,
+ MaxSyncFiles: importItem.MaxSyncFiles,
+ MaxSyncTotalSize: importItem.MaxSyncTotalSize,
+ MaxSyncBinarySize: importItem.MaxSyncBinarySize,
+ PreDeployConfigRequest: importItem.PreDeployConfigRequest,
}
_, err = s.CreateSync(ctx, environmentID, createReq, actor)
if err != nil {
response.FailedCount++
- response.Errors = append(response.Errors, fmt.Sprintf("Stack '%s': %v", importItem.SyncName, err))
+ response.Errors = append(response.Errors, fmt.Sprintf("Sync '%s': %v", importItem.SyncName, err))
} else {
response.SuccessCount++
}
diff --git a/backend/internal/gitops/handler.go b/backend/internal/gitops/handler.go
index e474bbc7f..c7960b4af 100644
--- a/backend/internal/gitops/handler.go
+++ b/backend/internal/gitops/handler.go
@@ -143,7 +143,7 @@ func RegisterGitOpsSyncs(api huma.API, syncService *GitOpsSyncService) {
// Admin built-in role) rather than the broader gitops:create / gitops:update
// permissions that non-admin roles such as Editor hold. Whether a request
// touches the hook is decided by the request type itself
-// (gitops.*SyncRequest.HasPreDeployConfig) so the field set has a single owner.
+// (gitops.PreDeployConfigRequest.HasPreDeployConfig) so the field set has a single owner.
func requireLifecyclePermissionInternal(ctx context.Context, environmentID string, lifecycleRequested bool) error {
if !lifecycleRequested {
return nil
@@ -235,6 +235,12 @@ func (h *GitOpsSyncHandler) CreateSync(ctx context.Context, input *CreateGitOpsS
// ImportSyncs imports multiple GitOps syncs.
func (h *GitOpsSyncHandler) ImportSyncs(ctx context.Context, input *ImportGitOpsSyncsInput) (*handlerutil.Out[gitops.ImportGitOpsSyncResponse], error) {
+ for _, item := range input.Body {
+ if err := requireLifecyclePermissionInternal(ctx, input.EnvironmentID, item.HasPreDeployConfig()); err != nil {
+ return nil, err
+ }
+ }
+
actor := handlerutil.CurrentActor(ctx)
response, err := h.syncService.ImportSyncs(ctx, input.EnvironmentID, input.Body, actor)
diff --git a/backend/internal/middleware/environment_middleware.go b/backend/internal/middleware/environment_middleware.go
index a05374a3d..eadea9882 100644
--- a/backend/internal/middleware/environment_middleware.go
+++ b/backend/internal/middleware/environment_middleware.go
@@ -3,6 +3,7 @@ package middleware
import (
"github.com/samber/mo"
+ "bytes"
"context"
"encoding/json/v2"
"io"
@@ -12,6 +13,7 @@ import (
"net/http"
"os"
"path"
+ "slices"
"strings"
"time"
@@ -22,6 +24,7 @@ import (
wsutil "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/ws"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
httputils "github.com/getarcaneapp/arcane/backend/v2/pkg/utils/httpx"
+ "github.com/getarcaneapp/arcane/types/v2/gitops"
volumetypes "github.com/getarcaneapp/arcane/types/v2/volume"
"github.com/labstack/echo/v5"
)
@@ -35,6 +38,7 @@ const (
proxyTimeout = 30 * time.Minute
maxProxiedWorkspaceManifestBytes = 1024 * 1024
+ maxProxiedGitOpsSyncBodyBytes = 1024 * 1024
)
// managementEndpointSet contains paths handled locally and never proxied to remote environments.
@@ -257,20 +261,24 @@ func (m *EnvironmentMiddleware) proxyPermissionDenied(c *echo.Context, ps *authz
"method", method, "path", suffix, "permission", perm, "environment_id", envID)
return true
}
+ var required []string
+ var err error
if isVolumeWorkspaceUpdateRequestInternal(method, suffix) {
- required, err := proxiedVolumeWorkspacePermissionsInternal(c.Request())
- if err != nil {
- slog.DebugContext(c.Request().Context(), "Denying proxied volume workspace request with invalid manifest",
- "path", suffix, "environment_id", envID, "error", err)
+ required, err = proxiedVolumeWorkspacePermissionsInternal(c.Request())
+ } else {
+ required, err = proxiedGitOpsSyncPermissionsInternal(c.Request(), method, suffix)
+ }
+ if err != nil {
+ slog.DebugContext(c.Request().Context(), "Denying proxied request with invalid body",
+ "path", suffix, "environment_id", envID, "error", err)
+ return true
+ }
+ for _, operationPermission := range required {
+ if !ps.Allows(operationPermission, envID) {
+ slog.DebugContext(c.Request().Context(), "Denying proxied request: body-derived permission denied",
+ "path", suffix, "permission", operationPermission, "environment_id", envID)
return true
}
- for _, operationPermission := range required {
- if !ps.Allows(operationPermission, envID) {
- slog.DebugContext(c.Request().Context(), "Denying proxied volume workspace operation",
- "path", suffix, "permission", operationPermission, "environment_id", envID)
- return true
- }
- }
}
return false
}
@@ -362,6 +370,60 @@ func proxiedVolumeWorkspacePermissionsInternal(request *http.Request) ([]string,
}
}
+// proxiedGitOpsSyncPermissionsInternal mirrors the handler-level lifecycle and
+// backup gates for POST /gitops-syncs, POST /gitops-syncs/import, and PUT
+// /gitops-syncs/{syncId}. The agent authenticates forwarded requests as sudo,
+// so these body-dependent checks must run at the proxy. Returns nil for any
+// other route.
+func proxiedGitOpsSyncPermissionsInternal(request *http.Request, method, suffix string) ([]string, error) {
+ segments := strings.Split(strings.Trim(suffix, "/"), "/")
+ isCreate := len(segments) == 1 && segments[0] == "gitops-syncs" && method == http.MethodPost
+ isImport := len(segments) == 2 && segments[0] == "gitops-syncs" && segments[1] == "import" && method == http.MethodPost
+ isUpdate := len(segments) == 2 && segments[0] == "gitops-syncs" && segments[1] != "" && method == http.MethodPut
+ if !isCreate && !isImport && !isUpdate || request == nil || request.Body == nil {
+ return nil, nil
+ }
+
+ body, readErr := io.ReadAll(io.LimitReader(request.Body, maxProxiedGitOpsSyncBodyBytes+1))
+ closeErr := request.Body.Close()
+ if err := errors.Combine(readErr, closeErr); err != nil {
+ return nil, errors.WrapIf(err, "read gitops sync body")
+ }
+ if len(body) > maxProxiedGitOpsSyncBodyBytes {
+ return nil, errors.New("gitops sync body is too large")
+ }
+ request.Body = io.NopCloser(bytes.NewReader(body))
+
+ type syncBodyInternal struct {
+ gitops.PreDeployConfigRequest
+
+ Mode string `json:"mode"`
+ }
+ var items []syncBodyInternal
+ if isImport {
+ if err := json.Unmarshal(body, &items); err != nil {
+ return nil, errors.WrapIf(err, "decode gitops sync import body")
+ }
+ } else {
+ var single syncBodyInternal
+ if err := json.Unmarshal(body, &single); err != nil {
+ return nil, errors.WrapIf(err, "decode gitops sync body")
+ }
+ items = []syncBodyInternal{single}
+ }
+
+ var required []string
+ for _, item := range items {
+ if item.HasPreDeployConfig() && !slices.Contains(required, authz.PermGitOpsLifecycle) {
+ required = append(required, authz.PermGitOpsLifecycle)
+ }
+ if isCreate && item.Mode == gitops.SyncModeBackup && !slices.Contains(required, authz.PermGitOpsBackup) {
+ required = append(required, authz.PermGitOpsBackup)
+ }
+ }
+ return required, nil
+}
+
type proxiedReplayBodyInternal struct {
io.Reader
diff --git a/backend/internal/middleware/environment_middleware_authz_test.go b/backend/internal/middleware/environment_middleware_authz_test.go
index 9cf656c69..7f2e6e3df 100644
--- a/backend/internal/middleware/environment_middleware_authz_test.go
+++ b/backend/internal/middleware/environment_middleware_authz_test.go
@@ -178,6 +178,38 @@ func TestProxyPermissionDeniedChecksVolumeWorkspaceManifestPermissions(t *testin
require.Equal(t, rawBody, replayed)
}
+func gitOpsSyncMatcher() *authz.PermissionMatcher {
+ m := authz.NewPermissionMatcher()
+ m.Add(http.MethodPost, "/gitops-syncs/import", authz.PermGitOpsCreate)
+ return m
+}
+
+func newProxyGitOpsImportContext(body string) *echo.Context {
+ e := echo.New()
+ req := httptest.NewRequest(http.MethodPost, "/api/environments/"+proxyTestEnvID+"/gitops-syncs/import", bytes.NewReader([]byte(body)))
+ req.Header.Set("Content-Type", "application/json")
+ return e.NewContext(req, httptest.NewRecorder())
+}
+
+func TestProxyPermissionDeniedChecksGitOpsImportLifecyclePermission(t *testing.T) {
+ m := newProxyAuthzMiddleware(gitOpsSyncMatcher())
+ hookBody := `[{"syncName":"a","gitRepo":"r","branch":"main","dockerComposePath":"compose.yaml","preDeployScriptPath":"scripts/run.sh"}]`
+ plainBody := `[{"syncName":"a","gitRepo":"r","branch":"main","dockerComposePath":"compose.yaml"}]`
+
+ createOnly := authz.NewPermissionSet()
+ createOnly.AddEnv(proxyTestEnvID, authz.PermGitOpsCreate)
+ require.True(t, m.proxyPermissionDenied(newProxyGitOpsImportContext(hookBody), createOnly, proxyTestEnvID))
+ require.False(t, m.proxyPermissionDenied(newProxyGitOpsImportContext(plainBody), createOnly, proxyTestEnvID))
+
+ withLifecycle := authz.NewPermissionSet()
+ withLifecycle.AddEnv(proxyTestEnvID, authz.PermGitOpsCreate, authz.PermGitOpsLifecycle)
+ c := newProxyGitOpsImportContext(hookBody)
+ require.False(t, m.proxyPermissionDenied(c, withLifecycle, proxyTestEnvID))
+ replayed, err := io.ReadAll(c.Request().Body)
+ require.NoError(t, err)
+ require.Equal(t, hookBody, string(replayed))
+}
+
// wsTerminalMatcher mirrors ws.AddProxiedPermissions for the container terminal
// stream: the proxy computes the suffix "/ws/containers/{id}/terminal" for a
// forwarded WebSocket request, and the matcher requires containers:exec for it.
diff --git a/cli/pkg/gitops/cmd.go b/cli/pkg/gitops/cmd.go
index 79ec309a9..355f3c016 100644
--- a/cli/pkg/gitops/cmd.go
+++ b/cli/pkg/gitops/cmd.go
@@ -31,6 +31,7 @@ var (
gitopsUpdateBranch string
gitopsUpdateComposePath string
gitopsUpdateProjectName string
+ gitopsImportProjectName string
gitopsUpdateAutoSync bool
gitopsUpdateInterval int
)
@@ -427,6 +428,7 @@ var importCmd = &cobra.Command{
DockerComposePath: composePath,
AutoSync: autoSync,
SyncInterval: interval,
+ ProjectName: gitopsImportProjectName,
}
// The endpoint accepts a batch, so a single sync still has to be wrapped
@@ -516,6 +518,7 @@ func init() {
importCmd.Flags().String("compose-path", "", "Path to docker-compose file")
importCmd.Flags().Bool("auto-sync", false, "Enable automatic sync")
importCmd.Flags().Int("interval", 5, "Sync interval in minutes")
+ importCmd.Flags().StringVar(&gitopsImportProjectName, "project-name", "", "Project name for the sync")
importCmd.Flags().BoolVar(&jsonOutput, "json", false, "Output in JSON format")
_ = importCmd.MarkFlagRequired("name")
_ = importCmd.MarkFlagRequired("repo-url")
diff --git a/frontend/src/lib/components/dialogs/gitops-import-dialog.svelte b/frontend/src/lib/components/dialogs/gitops-import-dialog.svelte
index 676358791..281ff527d 100644
--- a/frontend/src/lib/components/dialogs/gitops-import-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/gitops-import-dialog.svelte
@@ -92,7 +92,7 @@
<Textarea
id="json-content"
bind:value={jsonContent}
- placeholder={`[\n {\n "syncName": "example-sync",\n "gitRepo": "my-repo",\n "branch": "main",\n "dockerComposePath": "docker-compose.yml",\n "autoSync": true,\n "syncInterval": 10\n }\n]`}
+ placeholder={`[\n {\n "syncName": "example-sync",\n "gitRepo": "my-repo",\n "branch": "main",\n "dockerComposePath": "docker-compose.yml",\n "autoSync": true,\n "syncInterval": 10,\n "projectName": "example",\n "redeployAfterSync": true\n }\n]`}
class="h-[300px] font-mono text-xs"
/>
{#if error}
diff --git a/frontend/src/lib/types/automation.ts b/frontend/src/lib/types/automation.ts
index d7696aec2..1cbcabd09 100644
--- a/frontend/src/lib/types/automation.ts
+++ b/frontend/src/lib/types/automation.ts
@@ -345,6 +345,19 @@ export interface ImportGitOpsSyncRequest {
dockerComposePath: string;
autoSync: boolean;
syncInterval: number;
+ syncDirectory?: boolean;
+ maxSyncFiles?: number;
+ maxSyncTotalSize?: number;
+ maxSyncBinarySize?: number;
+ projectName?: string;
+ pullImageAfterSync?: boolean;
+ redeployAfterSync?: boolean;
+ preDeployScriptPath?: string;
+ preDeployRunnerImage?: string;
+ preDeployEnv?: string;
+ preDeployExtraMounts?: string;
+ preDeployTimeoutSec?: number;
+ preDeployNetworkMode?: string;
}
export interface ImportGitOpsSyncResponse {
diff --git a/types/gitops/gitops.go b/types/gitops/gitops.go
index d8d5e76de..00822ad9a 100644
--- a/types/gitops/gitops.go
+++ b/types/gitops/gitops.go
@@ -513,6 +513,8 @@ type UpdateRepositoryRequest struct {
// CreateSyncRequest represents the request to create a gitops sync.
type CreateSyncRequest struct {
+ PreDeployConfigRequest
+
// Name of the sync configuration.
//
// Required: true
@@ -627,7 +629,12 @@ type CreateSyncRequest struct {
//
// Required: false
MaxSyncBinarySize *int64 `json:"maxSyncBinarySize,omitempty"`
+}
+// PreDeployConfigRequest carries the pre-deploy lifecycle hook fields shared by
+// the create, update, and import sync requests. A nil pointer means the field
+// is absent from the request body; on update, an empty string clears the value.
+type PreDeployConfigRequest struct {
// PreDeployScriptPath is the optional path inside the synced repo to a
// script executed in a throwaway container before each deploy.
//
@@ -641,36 +648,40 @@ type CreateSyncRequest struct {
PreDeployRunnerImage *string `json:"preDeployRunnerImage,omitempty"`
// PreDeployEnv is the env config exposed to the script, one KEY=VALUE
- // entry per line; same format as a .env file. Keys must match POSIX
- // identifier syntax.
+ // entry per line; same format as a .env file.
//
// Required: false
PreDeployEnv *string `json:"preDeployEnv,omitempty"`
// PreDeployExtraMounts is the bind-mount config added to the runner
// container, one entry per line in docker -v "src:tgt[:ro|:rw]" form.
- // Source and target must be absolute paths.
//
// Required: false
PreDeployExtraMounts *string `json:"preDeployExtraMounts,omitempty"`
// PreDeployTimeoutSec bounds the script execution. Capped by the
- // lifecycleMaxTimeoutSec global setting at validation time. Defaults to 60.
+ // lifecycleMaxTimeoutSec global setting. Defaults to 60.
//
// Required: false
PreDeployTimeoutSec *int `json:"preDeployTimeoutSec,omitempty"`
// PreDeployNetworkMode is the Docker network mode for the runner
- // container. Defaults to "none" (no network access). Set to "bridge",
- // "host", or a named Docker network to grant outbound or compose-network
- // access.
+ // container: "none" (default), "bridge", "host", or a named network.
//
// Required: false
PreDeployNetworkMode *string `json:"preDeployNetworkMode,omitempty"`
}
+// HasPreDeployConfig reports whether any pre-deploy hook field is present.
+// Configuring the hook is gated behind the gitops:lifecycle permission.
+func (r PreDeployConfigRequest) HasPreDeployConfig() bool {
+ return r != PreDeployConfigRequest{}
+}
+
// UpdateSyncRequest represents the request to update a gitops sync.
type UpdateSyncRequest struct {
+ PreDeployConfigRequest
+
// Name of the sync configuration.
//
// Required: false
@@ -761,71 +772,6 @@ type UpdateSyncRequest struct {
//
// Required: false
MaxSyncBinarySize *int64 `json:"maxSyncBinarySize,omitzero"`
-
- // PreDeployScriptPath is the optional path inside the synced repo to a
- // script executed in a throwaway container before each deploy. Set to
- // an empty string to clear an existing configuration.
- //
- // Required: false
- PreDeployScriptPath *string `json:"preDeployScriptPath,omitzero"`
-
- // PreDeployRunnerImage is the image used to run the pre-deploy script.
- // When omitted, the lifecycleDefaultRunnerImage setting is used.
- //
- // Required: false
- PreDeployRunnerImage *string `json:"preDeployRunnerImage,omitzero"`
-
- // PreDeployEnv is the env config exposed to the script, one KEY=VALUE
- // entry per line; same format as a .env file. Keys must match POSIX
- // identifier syntax.
- //
- // Required: false
- PreDeployEnv *string `json:"preDeployEnv,omitzero"`
-
- // PreDeployExtraMounts is the bind-mount config added to the runner
- // container, one entry per line in docker -v "src:tgt[:ro|:rw]" form.
- // Source and target must be absolute paths.
- //
- // Required: false
- PreDeployExtraMounts *string `json:"preDeployExtraMounts,omitzero"`
-
- // PreDeployTimeoutSec bounds the script execution. Capped by the
- // lifecycleMaxTimeoutSec global setting at validation time.
- //
- // Required: false
- PreDeployTimeoutSec *int `json:"preDeployTimeoutSec,omitzero"`
-
- // PreDeployNetworkMode is the Docker network mode for the runner
- // container. Set to "none", "bridge", "host", or a named Docker
- // network. Empty string resets to the default ("none").
- //
- // Required: false
- PreDeployNetworkMode *string `json:"preDeployNetworkMode,omitzero"`
-}
-
-// HasPreDeployConfig reports whether the request carries any pre-deploy
-// lifecycle hook field. Configuring the hook is gated behind the dedicated
-// gitops:lifecycle permission (see the GitOps sync handlers), so callers use
-// this to decide whether that authorization check applies. A nil pointer means
-// the field is absent from the request body.
-func (r CreateSyncRequest) HasPreDeployConfig() bool {
- return r.PreDeployScriptPath != nil ||
- r.PreDeployRunnerImage != nil ||
- r.PreDeployEnv != nil ||
- r.PreDeployExtraMounts != nil ||
- r.PreDeployNetworkMode != nil ||
- r.PreDeployTimeoutSec != nil
-}
-
-// HasPreDeployConfig reports whether the request carries any pre-deploy
-// lifecycle hook field. See CreateSyncRequest.HasPreDeployConfig.
-func (r UpdateSyncRequest) HasPreDeployConfig() bool {
- return r.PreDeployScriptPath != nil ||
- r.PreDeployRunnerImage != nil ||
- r.PreDeployEnv != nil ||
- r.PreDeployExtraMounts != nil ||
- r.PreDeployNetworkMode != nil ||
- r.PreDeployTimeoutSec != nil
}
// HasDeploymentOptions reports whether the request sets deployment-only
@@ -1121,6 +1067,8 @@ type SyncStatus struct {
// ImportGitOpsSyncRequest represents the request to import gitops syncs.
type ImportGitOpsSyncRequest struct {
+ PreDeployConfigRequest
+
// SyncName is the name of the sync configuration.
//
// Required: true
@@ -1174,6 +1122,23 @@ type ImportGitOpsSyncRequest struct {
//
// Required: false
MaxSyncBinarySize *int64 `json:"maxSyncBinarySize,omitempty"`
+
+ // ProjectName is the compose project name. Defaults to SyncName.
+ //
+ // Required: false
+ ProjectName string `json:"projectName,omitempty"`
+
+ // PullImageAfterSync pulls each service image after a sync that changes
+ // managed content. Default: false.
+ //
+ // Required: false
+ PullImageAfterSync *bool `json:"pullImageAfterSync,omitempty"`
+
+ // RedeployAfterSync redeploys the project after a sync that changes
+ // managed content. Default: false.
+ //
+ // Required: false
+ RedeployAfterSync *bool `json:"redeployAfterSync,omitempty"`
}
// ImportGitOpsSyncResponse represents the response for importing gitops syncs.