Skip to content

Commit f68f0ec

Browse files
authored
fix: the concurrency issue with git detached processing in Repo Server (argoproj#25101) (argoproj#25127)
Signed-off-by: Eugene Doudine <eugene.doudine@octopus.com>
1 parent f3ae26b commit f68f0ec

19 files changed

+214
-8
lines changed

cmd/argocd-repo-server/commands/argocd_repo_server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ func NewCommand() *cobra.Command {
8080
includeHiddenDirectories bool
8181
cmpUseManifestGeneratePaths bool
8282
ociMediaTypes []string
83+
enableBuiltinGitConfig bool
8384
)
8485
command := cobra.Command{
8586
Use: cliName,
@@ -155,6 +156,7 @@ func NewCommand() *cobra.Command {
155156
IncludeHiddenDirectories: includeHiddenDirectories,
156157
CMPUseManifestGeneratePaths: cmpUseManifestGeneratePaths,
157158
OCIMediaTypes: ociMediaTypes,
159+
EnableBuiltinGitConfig: enableBuiltinGitConfig,
158160
}, askPassServer)
159161
errors.CheckError(err)
160162

@@ -265,6 +267,7 @@ func NewCommand() *cobra.Command {
265267
command.Flags().BoolVar(&includeHiddenDirectories, "include-hidden-directories", env.ParseBoolFromEnv("ARGOCD_REPO_SERVER_INCLUDE_HIDDEN_DIRECTORIES", false), "Include hidden directories from Git")
266268
command.Flags().BoolVar(&cmpUseManifestGeneratePaths, "plugin-use-manifest-generate-paths", env.ParseBoolFromEnv("ARGOCD_REPO_SERVER_PLUGIN_USE_MANIFEST_GENERATE_PATHS", false), "Pass the resources described in argocd.argoproj.io/manifest-generate-paths value to the cmpserver to generate the application manifests.")
267269
command.Flags().StringSliceVar(&ociMediaTypes, "oci-layer-media-types", env.StringsFromEnv("ARGOCD_REPO_SERVER_OCI_LAYER_MEDIA_TYPES", []string{"application/vnd.oci.image.layer.v1.tar", "application/vnd.oci.image.layer.v1.tar+gzip", "application/vnd.cncf.helm.chart.content.v1.tar+gzip"}, ","), "Comma separated list of allowed media types for OCI media types. This only accounts for media types within layers.")
270+
command.Flags().BoolVar(&enableBuiltinGitConfig, "enable-builtin-git-config", env.ParseBoolFromEnv("ARGOCD_REPO_SERVER_ENABLE_BUILTIN_GIT_CONFIG", true), "Enable builtin git configuration options that are required for correct argocd-repo-server operation.")
268271
tlsConfigCustomizerSrc = tls.AddTLSFlagsToCmd(&command)
269272
cacheSrc = reposervercache.AddCacheFlagsToCmd(&command, cacheutil.Options{
270273
OnClientCreated: func(client *redis.Client) {

docs/operator-manual/argocd-cmd-params-cm.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ data:
219219
reposerver.git.lsremote.parallelism.limit: "0"
220220
# Git requests timeout.
221221
reposerver.git.request.timeout: "15s"
222+
# Enable builtin git configuration options that are required for correct argocd-repo-server operation (default "true")
223+
reposerver.enable.builtin.git.config: "true"
222224
# Include hidden directories from Git
223225
reposerver.include.hidden.directories: "false"
224226

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
# Git Configuration
3+
4+
## System Configuration
5+
6+
Argo CD uses the Git installation from its base image (Ubuntu), which
7+
includes a standard system configuration file located at
8+
`/etc/gitconfig`. This file is minimal, just defining filters
9+
necessary for Git LFS functionality.
10+
11+
You can customize Git's system configuration by mounting a file from a
12+
ConfigMap or by creating a custom Argo CD image.
13+
14+
## Global Configuration
15+
16+
Argo CD runs Git with the `HOME` environment variable set to
17+
`/dev/null`. As a result, global Git configuration is not supported.
18+
19+
## Built-in Configuration
20+
21+
The `argocd-repo-server` adds specific configuration parameters to the
22+
Git environment to ensure proper Argo CD operation. These built-in
23+
settings override any conflicting values from the system Git
24+
configuration.
25+
26+
Currently, the following built-in configuration options are set:
27+
28+
- `maintenance.autoDetach=false`
29+
- `gc.autoDetach=false`
30+
31+
These settings force Git's repository maintenance tasks to run in the
32+
foreground. This prevents Git from running detached background
33+
processes that could modify the repository and interfere with
34+
subsequent Git invocations from `argocd-repo-server`.
35+
36+
You can disable these built-in settings by setting the
37+
`argocd-cmd-params-cm` value `reposerver.enable.builtin.git.config` to
38+
`"false"`. This allows you to experiment with background processing or
39+
if you are certain that concurrency issues will not occur in your
40+
environment.
41+
42+
> [!NOTE]
43+
> Disabling this is not recommended and is not supported!

docs/operator-manual/server-commands/argocd-repo-server.md

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

manifests/base/repo-server/argocd-repo-server-deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@ spec:
239239
key: reposerver.git.request.timeout
240240
name: argocd-cmd-params-cm
241241
optional: true
242+
- name: ARGOCD_REPO_SERVER_ENABLE_BUILTIN_GIT_CONFIG
243+
valueFrom:
244+
configMapKeyRef:
245+
name: argocd-cmd-params-cm
246+
key: reposerver.enable.builtin.git.config
247+
optional: true
242248
- name: ARGOCD_GRPC_MAX_SIZE_MB
243249
valueFrom:
244250
configMapKeyRef:

manifests/core-install-with-hydrator.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

manifests/core-install.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

manifests/ha/install-with-hydrator.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

manifests/ha/install.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

manifests/ha/namespace-install-with-hydrator.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)