Skip to content

Commit

Permalink
feat: add flag to include .git
Browse files Browse the repository at this point in the history
  • Loading branch information
clstb committed Jan 17, 2025
1 parent 38a515c commit edc1c80
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/argo_client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type ArgoClient struct {
k8s kubernetes.Interface
k8sConfig *rest.Config
sendFullRepository bool
includeDotGit bool
}

func NewArgoClient(
Expand Down Expand Up @@ -74,6 +75,7 @@ func NewArgoClient(
k8s: k8s.ClientSet(),
k8sConfig: k8s.Config(),
sendFullRepository: cfg.ArgoCDSendFullRepository,
includeDotGit: cfg.ArgoCDIncludeDotGit,
}, nil
}

Expand Down
8 changes: 7 additions & 1 deletion pkg/argo_client/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,13 @@ func (a *ArgoClient) generateManifests(ctx context.Context, app v1alpha1.Applica
}

log.Info().Msg("compressing files")
f, filesWritten, checksum, err := tgzstream.CompressFiles(packageDir, []string{"*"}, []string{".git"})

exclude := []string{}
if !a.includeDotGit {
exclude = append(exclude, ".git")
}

f, filesWritten, checksum, err := tgzstream.CompressFiles(packageDir, []string{"*"}, exclude)
if err != nil {
return nil, fmt.Errorf("failed to compress files: %w", err)
}
Expand Down
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type ServerConfig struct {
ArgoCDRepositoryEndpoint string `mapstructure:"argocd-repository-endpoint"`
ArgoCDRepositoryInsecure bool `mapstructure:"argocd-repository-insecure"`
ArgoCDSendFullRepository bool `mapstructure:"argocd-send-full-repository"`
ArgoCDIncludeDotGit bool `mapstructure:"argocd-include-dot-git"`
KubernetesConfig string `mapstructure:"kubernetes-config"`
KubernetesType string `mapstructure:"kubernetes-type"`
KubernetesClusterID string `mapstructure:"kubernetes-clusterid"`
Expand Down

0 comments on commit edc1c80

Please sign in to comment.