diff --git a/charts/radix-operator/Chart.yaml b/charts/radix-operator/Chart.yaml index 42d891ccc..6f01ae3c3 100644 --- a/charts/radix-operator/Chart.yaml +++ b/charts/radix-operator/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: radix-operator version: 1.39.2 -appVersion: 1.59.2 +appVersion: 1.59.3 kubeVersion: ">=1.24.0" description: Radix Operator keywords: diff --git a/pipeline-runner/internal/jobs/build/acr_test.go b/pipeline-runner/internal/jobs/build/acr_test.go index d998c66f2..fad07c82e 100644 --- a/pipeline-runner/internal/jobs/build/acr_test.go +++ b/pipeline-runner/internal/jobs/build/acr_test.go @@ -120,7 +120,7 @@ func assertACRJobSpec(t *testing.T, pushImage bool) { assert.ElementsMatch(t, []string{"internal-nslookup", "clone", "internal-chmod"}, slice.Map(job.Spec.Template.Spec.InitContainers, func(c corev1.Container) string { return c.Name })) cloneContainer, _ := slice.FindFirst(job.Spec.Template.Spec.InitContainers, func(c corev1.Container) bool { return c.Name == "clone" }) assert.Equal(t, args.GitCloneGitImage, cloneContainer.Image) - assert.Equal(t, []string{"sh", "-c", "git config --global --add safe.directory /workspace && git clone --recurse-submodules anycloneurl -b anybranch --verbose --progress /workspace && cd /workspace && if [ -n \"$(git lfs ls-files 2>/dev/null)\" ]; then git lfs install && echo 'Pulling large files...' && git lfs pull && echo 'Done'; fi && cd -"}, cloneContainer.Command) + assert.Equal(t, []string{"sh", "-c", "git config --global --add safe.directory /workspace && git clone anycloneurl -b anybranch --verbose --progress /workspace && (git submodule update --init --recursive || echo \"Warning: Unable to clone submodules, proceeding without them\") && cd /workspace && if [ -n \"$(git lfs ls-files 2>/dev/null)\" ]; then git lfs install && echo 'Pulling large files...' && git lfs pull && echo 'Done'; fi && cd -"}, cloneContainer.Command) assert.Empty(t, cloneContainer.Args) expectedCloneVolumeMounts := []corev1.VolumeMount{ {Name: git.BuildContextVolumeName, MountPath: git.Workspace}, diff --git a/pipeline-runner/internal/jobs/build/buildkit_test.go b/pipeline-runner/internal/jobs/build/buildkit_test.go index 260938751..eeed6266f 100644 --- a/pipeline-runner/internal/jobs/build/buildkit_test.go +++ b/pipeline-runner/internal/jobs/build/buildkit_test.go @@ -151,7 +151,7 @@ func assertBuildKitJobSpec(t *testing.T, useCache, pushImage bool, buildSecrets assert.ElementsMatch(t, []string{"internal-nslookup", "clone", "internal-chmod"}, slice.Map(job.Spec.Template.Spec.InitContainers, func(c corev1.Container) string { return c.Name })) cloneContainer, _ := slice.FindFirst(job.Spec.Template.Spec.InitContainers, func(c corev1.Container) bool { return c.Name == "clone" }) assert.Equal(t, args.GitCloneGitImage, cloneContainer.Image) - assert.Equal(t, []string{"sh", "-c", "git config --global --add safe.directory /workspace && git clone --recurse-submodules anycloneurl -b anybranch --verbose --progress /workspace && cd /workspace && if [ -n \"$(git lfs ls-files 2>/dev/null)\" ]; then git lfs install && echo 'Pulling large files...' && git lfs pull && echo 'Done'; fi && cd -"}, cloneContainer.Command) + assert.Equal(t, []string{"sh", "-c", "git config --global --add safe.directory /workspace && git clone anycloneurl -b anybranch --verbose --progress /workspace && (git submodule update --init --recursive || echo \"Warning: Unable to clone submodules, proceeding without them\") && cd /workspace && if [ -n \"$(git lfs ls-files 2>/dev/null)\" ]; then git lfs install && echo 'Pulling large files...' && git lfs pull && echo 'Done'; fi && cd -"}, cloneContainer.Command) assert.Empty(t, cloneContainer.Args) expectedCloneVolumeMounts := []corev1.VolumeMount{ {Name: git.BuildContextVolumeName, MountPath: git.Workspace}, diff --git a/pkg/apis/utils/git/clone.go b/pkg/apis/utils/git/clone.go index fd66f4ba9..7b3a68204 100644 --- a/pkg/apis/utils/git/clone.go +++ b/pkg/apis/utils/git/clone.go @@ -30,7 +30,7 @@ func CloneInitContainers(sshURL, branch string, config CloneConfig) []corev1.Con // CloneInitContainersWithContainerName The sidecars for cloning repo func CloneInitContainersWithContainerName(sshURL, branch, cloneContainerName string, config CloneConfig, useLfs bool) []corev1.Container { gitConfigCommand := fmt.Sprintf("git config --global --add safe.directory %s", Workspace) - gitCloneCommand := fmt.Sprintf("git clone --recurse-submodules %s -b %s --verbose --progress %s", sshURL, branch, Workspace) + gitCloneCommand := fmt.Sprintf("git clone %s -b %s --verbose --progress %s && (git submodule update --init --recursive || echo \"Warning: Unable to clone submodules, proceeding without them\")", sshURL, branch, Workspace) getLfsFilesCommands := fmt.Sprintf("cd %s && if [ -n \"$(git lfs ls-files 2>/dev/null)\" ]; then git lfs install && echo 'Pulling large files...' && git lfs pull && echo 'Done'; fi && cd -", Workspace) gitCloneCmd := []string{"sh", "-c", fmt.Sprintf("%s && %s %s", gitConfigCommand, gitCloneCommand, utils.TernaryString(useLfs, fmt.Sprintf("&& %s", getLfsFilesCommands), ""))}