diff --git a/CHANGES.md b/CHANGES.md index 5eea22138856..e20459c7da0f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,17 +1,14 @@ # ArgoCD +Forked from: [argoproj/argo-cd](https://github.com/argoproj/argo-cd) -Forked from [argoproj/argo-cd](https://github.com/argoproj/argo-cd), commit [987f665](https://github.com/argoproj/argo-cd/tree/987f6659b88e656a8f6f8feef87f4dd467d53c44). +## v2.3.3 (Base) +Argo CD's latest stable release, as of May 13, 2022, is v2.3.3. -## v2.2.3 (Base) - -The following sections detail the enhancements made to ArgoCD Extensions. - -## v2.3.2 (Fork) +## v2.3.3 (Fork) +The changes were rebased based on v2.3.3. This section details the enhancements made to Argo CD Extensions. ### Resource Customization ConfigMap - -Pulls in resource overrides from the resource customization ConfigMap. This ConfigMap will only exist if created by +Pulls in resource overrides from the resource customization `ConfigMap`. This `ConfigMap` will only exist if created by ArgoCD Extensions. If this ConfigMap doesn't exist, then ArgoCD simply continues on. -The resource overrides are loaded _after_ the `argocd-cm` ConfigMap. If a resource override was already provided in the -`argocd-cm` ConfigMap, then the resource override from the resource customization ConfigMap is ***not loaded***. +The resource overrides are loaded ***after*** the `argocd-cm` `ConfigMap`. If a resource override was already provided in the `argocd-cm` `ConfigMap`, then the resource override from the resource customization `ConfigMap` is ***not loaded***. \ No newline at end of file diff --git a/VERSION b/VERSION index f90b1afc082f..0bee604df761 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.3.2 +2.3.3 diff --git a/docs/roadmap.md b/docs/roadmap.md index 8ba099be4de4..f7f28aa1a5b9 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,26 +1,29 @@ # Roadmap - [Roadmap](#roadmap) - - [v2.3](#v23) - - [Merge Argo CD Notifications into Argo CD](#merge-argo-cd-notifications-into-argo-cd) - - [Merge ApplicationSet controller into Argo CD](#merge-applicationset-controller-into-argo-cd) - - [Compact resources tree](#compact-resources-tree) - - [Maintain difference in cluster and git values for specific fields](#maintain-difference-in-cluster-and-git-values-for-specific-fields) - - [ARM images and CLI binary](#arm-images-and-cli-binary) + - [v2.4](#v24) - [Server side apply](#server-side-apply) - - [v2.4 and beyond](#v24-and-beyond) - - [First class support for ApplicationSet resources](#first-class-support-for-applicationset-resources) - [Input Forms UI Refresh](#input-forms-ui-refresh) - - [Merge Argo CD Image Updater into Argo CD](#merge-argo-cd-image-updater-into-argo-cd) - [Web Shell](#web-shell) - [Helm values from external repo](#helm-values-from-external-repo) + - [Support multiple sources for an Application](#support-multiple-sources-for-an-application) + - [Config Management Tools Enhancements: Parametrization & Security Improvements](#config-management-tools-enhancements-parametrization--security-improvements) + - [v2.5 and beyond](#v25-and-beyond) + - [Config Management Tools Enhancements: UI/CLI](#config-management-tools-enhancements-uicli) + - [First class support for ApplicationSet resources](#first-class-support-for-applicationset-resources) + - [Merge Argo CD Image Updater into Argo CD](#merge-argo-cd-image-updater-into-argo-cd) + - [Sharding application controller](#sharding-application-controller) - [Add support for secrets in Application parameters](#add-support-for-secrets-in-application-parameters) - - [Config Management Tools Integrations UI/CLI](#config-management-tools-integrations-uicli) - [Allow specifying parent/child relationships in config](#allow-specifying-parentchild-relationships-in-config) - [Dependencies between applications](#dependencies-between-applications) - [Multi-tenancy improvements](#multi-tenancy-improvements) - [GitOps Engine Enhancements](#gitops-engine-enhancements) - [Completed](#completed) + - [✅ Merge Argo CD Notifications into Argo CD](#-merge-argo-cd-notifications-into-argo-cd) + - [✅ Merge ApplicationSet controller into Argo CD](#-merge-applicationset-controller-into-argo-cd) + - [✅ Compact resources tree](#-compact-resources-tree) + - [✅ Maintain difference in cluster and git values for specific fields](#-maintain-difference-in-cluster-and-git-values-for-specific-fields) + - [✅ ARM images and CLI binary](#-arm-images-and-cli-binary) - [✅ Config Management Tools Integrations (proposal)](#-config-management-tools-integrations-proposal) - [✅ Argo CD Extensions (proposal)](#-argo-cd-extensions-proposal) - [✅ Project scoped repository and clusters (proposal)](#-project-scoped-repository-and-clusters-proposal) @@ -34,66 +37,61 @@ - [✅ Automated Registry Monitoring](#-automated-registry-monitoring) - [✅ Projects Enhancements](#-projects-enhancements) -## v2.3 +## v2.4 -> ETA: Feb 2021 +> ETA: May 2022 -### Merge Argo CD Notifications into Argo CD +### Server side apply -The [Argo CD Notifications](https://github.com/argoproj-labs/argocd-notifications) should be merged into Argo CD and available out-of-the-box: [#7350](https://github.com/argoproj/argo-cd/issues/7350) +Support using [server side apply](https://kubernetes.io/docs/reference/using-api/server-side-apply/) during application syncing +[#2267](https://github.com/argoproj/argo-cd/issues/2267) -### Merge ApplicationSet controller into Argo CD +### Input Forms UI Refresh -The ApplicationSet functionality is available in Argo CD out-of-the-box ([#7351](https://github.com/argoproj/argo-cd/issues/7351)). +Improved design of the input forms in Argo CD Web UI: https://www.figma.com/file/IIlsFqqmM5UhqMVul9fQNq/Argo-CD?node-id=0%3A1 -### Compact resources tree +### Web Shell -An ability to collaps leaf resources tree to improve visualization of very large applications: [#7349](https://github.com/argoproj/argo-cd/issues/7349) +Exec into the Kubernetes Pod right from Argo CD Web UI! [#4351](https://github.com/argoproj/argo-cd/issues/4351) -### Maintain difference in cluster and git values for specific fields +### Helm values from external repo -The feature allows to avoid updating fields excluded from diffing ([#2913](https://github.com/argoproj/argo-cd/issues/2913)). +The feature allows combining of-the-shelf Helm chart and value file in Git repository ([#2789](https://github.com/argoproj/argo-cd/issues/2789)) -### ARM images and CLI binary +### Support multiple sources for an Application -The release workflow should build and publish ARM images and CLI binaries: ([#4211](https://github.com/argoproj/argo-cd/issues/4211)) +Support more than one source for creating an Application [#8322](https://github.com/argoproj/argo-cd/pull/8322). -### Server side apply +### Config Management Tools Enhancements: Parametrization & Security Improvements -Support using [server side apply](https://kubernetes.io/docs/reference/using-api/server-side-apply/) during application syncing -[#2267](https://github.com/argoproj/argo-cd/issues/2267) +The continuation of the Config Management Tools of [proposal](https://github.com/argoproj/argo-cd/blob/master/docs/proposals/parameterized-config-management-plugins.md). +The Argo config management plugin configuration allows users to specify the accepted parameters, default values to eventually power UI and CLI. +Additionally, plugins implementation should provide better Argo CD tenant isolation and security. -## v2.4 and beyond +## v2.5 and beyond -### First class support for ApplicationSet resources +### Config Management Tools Enhancements: UI/CLI -The Argo CD UI/CLI/API allows to manage ApplicationSet resources same as Argo CD Applications ([#7352](https://github.com/argoproj/argo-cd/issues/7352)). +The Argo CD should provide a first-class experience for configured third-party config management tools. User should be able to view supported parameters, +observe default parameter values and override them. -### Input Forms UI Refresh +### First class support for ApplicationSet resources -Improved design of the input forms in Argo CD Web UI: https://www.figma.com/file/IIlsFqqmM5UhqMVul9fQNq/Argo-CD?node-id=0%3A1 +The Argo CD UI/CLI/API allows to manage ApplicationSet resources same as Argo CD Applications ([#7352](https://github.com/argoproj/argo-cd/issues/7352)). ### Merge Argo CD Image Updater into Argo CD The [Argo CD Image Updater](https://github.com/argoproj-labs/argocd-image-updater) should be merged into Argo CD and available out-of-the-box: [#7385](https://github.com/argoproj/argo-cd/issues/7385) -### Web Shell -Exec into the Kubernetes Pod right from Argo CD Web UI! [#4351](https://github.com/argoproj/argo-cd/issues/4351) +### Sharding application controller -### Helm values from external repo - -The feature allows combining of-the-shelf Helm chart and value file in Git repository ([#2789](https://github.com/argoproj/argo-cd/issues/2789)) +Application controller to scale automatically to provide high availability[#8340](https://github.com/argoproj/argo-cd/issues/8340). ### Add support for secrets in Application parameters The feature allows referencing secrets in Application parameters. [#1786](https://github.com/argoproj/argo-cd/issues/1786). -### Config Management Tools Integrations UI/CLI - -The continuation of the Config Management Tools of [proposal](https://github.com/argoproj/argo-cd/pull/5927). The Argo CD UI/CLI -should provide first class experience for configured third-party config management tools: [#5734](https://github.com/argoproj/argo-cd/issues/5734). - ### Allow specifying parent/child relationships in config The feature [#5082](https://github.com/argoproj/argo-cd/issues/5082) allows configuring parent/child relationships between resources. This allows to correctly @@ -123,13 +121,32 @@ A lot of Argo CD features are still not available in GitOps engine. The followin ## Completed +### ✅ Merge Argo CD Notifications into Argo CD + +The [Argo CD Notifications](https://github.com/argoproj-labs/argocd-notifications) should be merged into Argo CD and available out-of-the-box: [#7350](https://github.com/argoproj/argo-cd/issues/7350) + +### ✅ Merge ApplicationSet controller into Argo CD + +The ApplicationSet functionality is available in Argo CD out-of-the-box ([#7351](https://github.com/argoproj/argo-cd/issues/7351)). + +### ✅ Compact resources tree + +An ability to collaps leaf resources tree to improve visualization of very large applications: [#7349](https://github.com/argoproj/argo-cd/issues/7349) + +### ✅ Maintain difference in cluster and git values for specific fields + +The feature allows to avoid updating fields excluded from diffing ([#2913](https://github.com/argoproj/argo-cd/issues/2913)). + +### ✅ ARM images and CLI binary + +The release workflow should build and publish ARM images and CLI binaries: ([#4211](https://github.com/argoproj/argo-cd/issues/4211)) + ### ✅ Config Management Tools Integrations ([proposal](https://github.com/argoproj/argo-cd/pull/5927)) The community likes the first class support of Helm, Kustomize and keeps requesting support for more tools. Argo CD provides a mechanism to integrate with any config management tool. We need to investigate why it is not enough and implement missing features. - ### ✅ Argo CD Extensions ([proposal](https://github.com/argoproj/argo-cd/pull/6240)) Argo CD supports customizing handling of Kubernetes resources via diffing customizations, diff --git a/go.mod b/go.mod index 9861ae5e9e7b..2524460e6a4b 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/TomOnTime/utfutil v0.0.0-20180511104225-09c41003ee1d github.com/alicebob/miniredis v2.5.0+incompatible github.com/alicebob/miniredis/v2 v2.14.2 - github.com/argoproj/gitops-engine v0.6.1 + github.com/argoproj/gitops-engine v0.6.2 github.com/argoproj/notifications-engine v0.3.1-0.20220127183449-91deed20b998 github.com/argoproj/pkg v0.11.1-0.20211203175135-36c59d8fafe0 github.com/bombsimon/logrusr/v2 v2.0.1 diff --git a/go.sum b/go.sum index ecb21b7db881..3b0bf0a20b12 100644 --- a/go.sum +++ b/go.sum @@ -125,8 +125,8 @@ github.com/antonmedv/expr v1.8.9/go.mod h1:5qsM3oLGDND7sDmQGDXHkYfkjYMUX14qsgqmH github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/appscode/go v0.0.0-20190808133642-1d4ef1f1c1e0/go.mod h1:iy07dV61Z7QQdCKJCIvUoDL21u6AIceRhZzyleh2ymc= -github.com/argoproj/gitops-engine v0.6.1 h1:fiaMQ+0OfBHQWInekgkO645i4dolvl3KA//0F7n4PK8= -github.com/argoproj/gitops-engine v0.6.1/go.mod h1:pRgVpLW7pZqf7n3COJ7UcDepk4cI61LAcJd64Q3Jq/c= +github.com/argoproj/gitops-engine v0.6.2 h1:hM+pQeplCeIPAvfAmr1f91+ykxqaU0GAzuxVujqlKHM= +github.com/argoproj/gitops-engine v0.6.2/go.mod h1:pRgVpLW7pZqf7n3COJ7UcDepk4cI61LAcJd64Q3Jq/c= github.com/argoproj/notifications-engine v0.3.1-0.20220127183449-91deed20b998 h1:V9RDg+IZeebnm3XjkfkbN07VM21Fu1Cy/RJNoHO++VM= github.com/argoproj/notifications-engine v0.3.1-0.20220127183449-91deed20b998/go.mod h1:5mKv7zEgI3NO0L+fsuRSwBSY9EIXSuyIsDND8O8TTIw= github.com/argoproj/pkg v0.11.1-0.20211203175135-36c59d8fafe0 h1:Cfp7rO/HpVxnwlRqJe0jHiBbZ77ZgXhB6HWlYD02Xdc= diff --git a/manifests/base/kustomization.yaml b/manifests/base/kustomization.yaml index 6284acde5f2d..fbebf801f347 100644 --- a/manifests/base/kustomization.yaml +++ b/manifests/base/kustomization.yaml @@ -5,7 +5,7 @@ kind: Kustomization images: - name: quay.io/argoproj/argocd newName: quay.io/argoproj/argocd - newTag: v2.3.2 + newTag: v2.3.3 resources: - ./application-controller - ./dex diff --git a/manifests/core-install.yaml b/manifests/core-install.yaml index 2824a67244bb..795c4e624663 100644 --- a/manifests/core-install.yaml +++ b/manifests/core-install.yaml @@ -9692,7 +9692,7 @@ spec: value: /helm-working-dir - name: HELM_DATA_HOME value: /helm-working-dir - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: failureThreshold: 3 @@ -9741,7 +9741,7 @@ spec: - -n - /usr/local/bin/argocd - /var/run/argocd/argocd-cmp-server - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 name: copyutil volumeMounts: - mountPath: /var/run/argocd @@ -9906,7 +9906,7 @@ spec: key: controller.default.cache.expiration name: argocd-cmd-params-cm optional: true - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: httpGet: diff --git a/manifests/core-install/kustomization.yaml b/manifests/core-install/kustomization.yaml index ed64da0bb198..537d08515061 100644 --- a/manifests/core-install/kustomization.yaml +++ b/manifests/core-install/kustomization.yaml @@ -11,4 +11,4 @@ resources: images: - name: quay.io/argoproj/argocd newName: quay.io/argoproj/argocd - newTag: v2.3.2 + newTag: v2.3.3 diff --git a/manifests/ha/base/kustomization.yaml b/manifests/ha/base/kustomization.yaml index 55879a7ab7e2..28998dce399c 100644 --- a/manifests/ha/base/kustomization.yaml +++ b/manifests/ha/base/kustomization.yaml @@ -11,7 +11,7 @@ patchesStrategicMerge: images: - name: quay.io/argoproj/argocd newName: quay.io/argoproj/argocd - newTag: v2.3.2 + newTag: v2.3.3 resources: - ../../base/application-controller - ../../base/dex diff --git a/manifests/ha/install.yaml b/manifests/ha/install.yaml index e383398629ec..65c4abf9286c 100644 --- a/manifests/ha/install.yaml +++ b/manifests/ha/install.yaml @@ -10516,7 +10516,7 @@ spec: - -n - /usr/local/bin/argocd - /shared/argocd-dex - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always name: copyutil volumeMounts: @@ -10549,7 +10549,7 @@ spec: containers: - command: - argocd-notifications - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: tcpSocket: @@ -10782,7 +10782,7 @@ spec: value: /helm-working-dir - name: HELM_DATA_HOME value: /helm-working-dir - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: failureThreshold: 3 @@ -10831,7 +10831,7 @@ spec: - -n - /usr/local/bin/argocd - /var/run/argocd/argocd-cmp-server - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 name: copyutil volumeMounts: - mountPath: /var/run/argocd @@ -11058,7 +11058,7 @@ spec: key: server.http.cookie.maxnumber name: argocd-cmd-params-cm optional: true - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: httpGet: @@ -11254,7 +11254,7 @@ spec: key: controller.default.cache.expiration name: argocd-cmd-params-cm optional: true - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: httpGet: diff --git a/manifests/ha/namespace-install.yaml b/manifests/ha/namespace-install.yaml index 150bae5044f0..36f8ace29d51 100644 --- a/manifests/ha/namespace-install.yaml +++ b/manifests/ha/namespace-install.yaml @@ -7812,7 +7812,7 @@ spec: - -n - /usr/local/bin/argocd - /shared/argocd-dex - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always name: copyutil volumeMounts: @@ -7845,7 +7845,7 @@ spec: containers: - command: - argocd-notifications - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: tcpSocket: @@ -8078,7 +8078,7 @@ spec: value: /helm-working-dir - name: HELM_DATA_HOME value: /helm-working-dir - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: failureThreshold: 3 @@ -8127,7 +8127,7 @@ spec: - -n - /usr/local/bin/argocd - /var/run/argocd/argocd-cmp-server - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 name: copyutil volumeMounts: - mountPath: /var/run/argocd @@ -8354,7 +8354,7 @@ spec: key: server.http.cookie.maxnumber name: argocd-cmd-params-cm optional: true - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: httpGet: @@ -8550,7 +8550,7 @@ spec: key: controller.default.cache.expiration name: argocd-cmd-params-cm optional: true - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: httpGet: diff --git a/manifests/install.yaml b/manifests/install.yaml index 94c36640e99d..13d04fcb16c8 100644 --- a/manifests/install.yaml +++ b/manifests/install.yaml @@ -9886,7 +9886,7 @@ spec: - -n - /usr/local/bin/argocd - /shared/argocd-dex - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always name: copyutil volumeMounts: @@ -9919,7 +9919,7 @@ spec: containers: - command: - argocd-notifications - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: tcpSocket: @@ -10116,7 +10116,7 @@ spec: value: /helm-working-dir - name: HELM_DATA_HOME value: /helm-working-dir - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: failureThreshold: 3 @@ -10165,7 +10165,7 @@ spec: - -n - /usr/local/bin/argocd - /var/run/argocd/argocd-cmp-server - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 name: copyutil volumeMounts: - mountPath: /var/run/argocd @@ -10388,7 +10388,7 @@ spec: key: server.http.cookie.maxnumber name: argocd-cmd-params-cm optional: true - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: httpGet: @@ -10578,7 +10578,7 @@ spec: key: controller.default.cache.expiration name: argocd-cmd-params-cm optional: true - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: httpGet: diff --git a/manifests/namespace-install.yaml b/manifests/namespace-install.yaml index 5f76a97bedc9..cb7f9eb15a52 100644 --- a/manifests/namespace-install.yaml +++ b/manifests/namespace-install.yaml @@ -7182,7 +7182,7 @@ spec: - -n - /usr/local/bin/argocd - /shared/argocd-dex - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always name: copyutil volumeMounts: @@ -7215,7 +7215,7 @@ spec: containers: - command: - argocd-notifications - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: tcpSocket: @@ -7412,7 +7412,7 @@ spec: value: /helm-working-dir - name: HELM_DATA_HOME value: /helm-working-dir - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: failureThreshold: 3 @@ -7461,7 +7461,7 @@ spec: - -n - /usr/local/bin/argocd - /var/run/argocd/argocd-cmp-server - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 name: copyutil volumeMounts: - mountPath: /var/run/argocd @@ -7684,7 +7684,7 @@ spec: key: server.http.cookie.maxnumber name: argocd-cmd-params-cm optional: true - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: httpGet: @@ -7874,7 +7874,7 @@ spec: key: controller.default.cache.expiration name: argocd-cmd-params-cm optional: true - image: quay.io/argoproj/argocd:v2.3.2 + image: quay.io/argoproj/argocd:v2.3.3 imagePullPolicy: Always livenessProbe: httpGet: diff --git a/pkg/apis/application/v1alpha1/types.go b/pkg/apis/application/v1alpha1/types.go index a1fe6495746d..1684b2e96b33 100644 --- a/pkg/apis/application/v1alpha1/types.go +++ b/pkg/apis/application/v1alpha1/types.go @@ -2477,6 +2477,8 @@ func (c *Cluster) RawRestConfig() *rest.Config { panic(fmt.Sprintf("Unable to create K8s REST config: %v", err)) } config.Timeout = K8sServerSideTimeout + config.QPS = K8sClientConfigQPS + config.Burst = K8sClientConfigBurst return config } diff --git a/reposerver/repository/repository.go b/reposerver/repository/repository.go index 83b9194c9fbd..33dd2e95cf31 100644 --- a/reposerver/repository/repository.go +++ b/reposerver/repository/repository.go @@ -1660,33 +1660,40 @@ func directoryPermissionInitializer(rootPath string) goio.Closer { // nolint:unparam func (s *Service) checkoutRevision(gitClient git.Client, revision string, submoduleEnabled bool) (goio.Closer, error) { closer := s.gitRepoInitializer(gitClient.Root()) + return closer, checkoutRevision(gitClient, revision, submoduleEnabled) +} + +func checkoutRevision(gitClient git.Client, revision string, submoduleEnabled bool) error { err := gitClient.Init() if err != nil { - return closer, status.Errorf(codes.Internal, "Failed to initialize git repo: %v", err) + return status.Errorf(codes.Internal, "Failed to initialize git repo: %v", err) } - err = gitClient.Fetch(revision) + // Fetching with no revision first. Fetching with an explicit version can cause repo bloat. https://github.com/argoproj/argo-cd/issues/8845 + err = gitClient.Fetch("") + if err != nil { + return status.Errorf(codes.Internal, "Failed to fetch default: %v", err) + } + err = gitClient.Checkout(revision, submoduleEnabled) if err != nil { - log.Infof("Failed to fetch revision %s: %v", revision, err) - log.Infof("Fallback to fetch default") - err = gitClient.Fetch("") + // When fetching with no revision, only refs/heads/* and refs/remotes/origin/* are fetched. If checkout fails + // for the given revision, try explicitly fetching it. + log.Infof("Failed to checkout revision %s: %v", revision, err) + log.Infof("Fallback to fetching specific revision %s. ref might not have been in the default refspec fetched.", revision) + + err = gitClient.Fetch(revision) if err != nil { - return closer, status.Errorf(codes.Internal, "Failed to fetch default: %v", err) + return status.Errorf(codes.Internal, "Failed to checkout revision %s: %v", revision, err) } - err = gitClient.Checkout(revision, submoduleEnabled) + + err = gitClient.Checkout("FETCH_HEAD", submoduleEnabled) if err != nil { - return closer, status.Errorf(codes.Internal, "Failed to checkout revision %s: %v", revision, err) + return status.Errorf(codes.Internal, "Failed to checkout FETCH_HEAD: %v", err) } - return closer, err - } - - err = gitClient.Checkout("FETCH_HEAD", submoduleEnabled) - if err != nil { - return closer, status.Errorf(codes.Internal, "Failed to checkout FETCH_HEAD: %v", err) } - return closer, err + return err } func (s *Service) GetHelmCharts(ctx context.Context, q *apiclient.HelmChartsRequest) (*apiclient.HelmChartsResponse, error) { diff --git a/reposerver/repository/repository_test.go b/reposerver/repository/repository_test.go index 4ffd23ceac0f..52e70e668270 100644 --- a/reposerver/repository/repository_test.go +++ b/reposerver/repository/repository_test.go @@ -1816,3 +1816,51 @@ func TestInit(t *testing.T) { require.Error(t, err) require.NoError(t, initGitRepo(path.Join(dir, "repo2"), "https://github.com/argo-cd/test-repo2")) } + +// TestCheckoutRevisionCanGetNonstandardRefs shows that we can fetch a revision that points to a non-standard ref. In +// other words, we haven't regressed and caused this issue again: https://github.com/argoproj/argo-cd/issues/4935 +func TestCheckoutRevisionCanGetNonstandardRefs(t *testing.T) { + rootPath, err := ioutil.TempDir("", "") + require.NoError(t, err) + + sourceRepoPath, err := ioutil.TempDir(rootPath, "") + require.NoError(t, err) + + // Create a repo such that one commit is on a non-standard ref _and nowhere else_. This is meant to simulate, for + // example, a GitHub ref for a pull into one repo from a fork of that repo. + runGit(t, sourceRepoPath, "init") + runGit(t, sourceRepoPath, "checkout", "-b", "main") // make sure there's a main branch to switch back to + runGit(t, sourceRepoPath, "commit", "-m", "empty", "--allow-empty") + runGit(t, sourceRepoPath, "checkout", "-b", "branch") + runGit(t, sourceRepoPath, "commit", "-m", "empty", "--allow-empty") + sha := runGit(t, sourceRepoPath, "rev-parse", "HEAD") + runGit(t, sourceRepoPath, "update-ref", "refs/pull/123/head", strings.TrimSuffix(sha, "\n")) + runGit(t, sourceRepoPath, "checkout", "main") + runGit(t, sourceRepoPath, "branch", "-D", "branch") + + destRepoPath, err := ioutil.TempDir(rootPath, "") + require.NoError(t, err) + + gitClient, err := git.NewClientExt("file://"+sourceRepoPath, destRepoPath, &git.NopCreds{}, true, false, "") + require.NoError(t, err) + + pullSha, err := gitClient.LsRemote("refs/pull/123/head") + require.NoError(t, err) + + err = checkoutRevision(gitClient, "does-not-exist", false) + assert.Error(t, err) + + err = checkoutRevision(gitClient, pullSha, false) + assert.NoError(t, err) +} + +// runGit runs a git command in the given working directory. If the command succeeds, it returns the combined standard +// and error output. If it fails, it stops the test with a failure message. +func runGit(t *testing.T, workDir string, args ...string) string { + cmd := exec.Command("git", args...) + cmd.Dir = workDir + out, err := cmd.CombinedOutput() + stringOut := string(out) + require.NoError(t, err, stringOut) + return stringOut +}