Compare commits

...

528 Commits

Author SHA1 Message Date
github-actions[bot]
5a4ef23d96 Bump version to 3.0.14 on release-3.0 branch (#24396)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
2025-09-04 11:48:39 -04:00
Michael Crenshaw
5ebdd714d0 fix(security): repository.GetDetailedProject exposes repo secrets (#24390)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2025-09-04 11:32:52 -04:00
Adrian Berger
ef5b8ca167 fix(cherry-pick-3.0): custom resource health for flux helm repository of type oci (#24340)
Signed-off-by: Adrian Berger <adrian.berger@bedag.ch>
2025-09-02 15:19:13 -04:00
Nitish Kumar
775edda033 chore(cherry-pick-3.0): replace bitnami images (#24101) (#24287)
Signed-off-by: nitishfy <justnitish06@gmail.com>
2025-08-27 14:03:15 +02:00
Anand Francis Joseph
f4d409cf9b fix(appset): prevent idle connection buildup by cloning http.DefaultTransport in Bitbucket SCM/PR generator (#24266)
Signed-off-by: portly-halicore-76 <170707699+portly-halicore-76@users.noreply.github.com>
Signed-off-by: anandf <anjoseph@redhat.com>
Co-authored-by: portly-halicore-76 <170707699+portly-halicore-76@users.noreply.github.com>
2025-08-26 09:53:34 -04:00
github-actions[bot]
083ef929a5 Bump version to 3.0.13 on release-3.0 branch (#24261)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
2025-08-25 11:30:39 -04:00
Codey Jenkins
d6e0e5c852 chore: cherry pick #24235 to release-3.0 (#24237)
Signed-off-by: Codey Jenkins <FourFifthsCode@users.noreply.github.com>
Co-authored-by: Matthew Bennett <mtbennett@godaddy.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-08-22 16:55:13 -04:00
rumstead
46e7c008ce fix(server): Send Azure DevOps token via git extra headers (#23478) (#23631) (#24222)
Signed-off-by: Mike Bordon <mikebordon@gmail.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: mikebordon <31316193+mikebordon@users.noreply.github.com>
2025-08-22 09:42:21 -04:00
Anand Francis Joseph
274ab28f8f fix(util): Fix default key exchange algorthims used for SSH connection to be FIPS compliant (#24086) (cherry-pick 3.0) (#24165)
Signed-off-by: anandf <anjoseph@redhat.com>
2025-08-15 11:30:55 +02:00
Alexandre Gaudreault
b1df89bfce fix(lua): allow actions to add items to array (#24136)
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-08-13 17:20:55 -04:00
Blake Pettersson
d76cedea57 fix: kustomize edit add component check (#24100) (cherry-pick 3.0) (#24103)
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
2025-08-11 12:02:56 +02:00
Ville Vesilehto
3fb825c36c chore: update Go to 1.24.6 (release-3.0) (#24092)
Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-08-11 10:38:43 +02:00
gcp-cherry-pick-bot[bot]
7822fbd43a docs: 3.0 migration - added remediation for explicitly syncing apps that use ApplyOutOfSyncOnly=true (cherry-pick #23918) (#23957)
Signed-off-by: reggie-k <regina.voloshin@codefresh.io>
Co-authored-by: Regina Voloshin <regina.voloshin@codefresh.io>
2025-08-03 23:22:23 -04:00
gcp-cherry-pick-bot[bot]
d11bf1ac88 fix: helm GetTags cache writing (cherry-pick #23865) (#23953)
Signed-off-by: Matthew Clarke <mclarke@spotify.com>
Co-authored-by: Matthew Clarke <matthewclarke47@gmail.com>
Co-authored-by: Linghao Su <linghao.su@daocloud.io>
2025-07-28 23:42:32 +02:00
github-actions[bot]
ed1e2397ef Bump version to 3.0.12 on release-3.0 branch (#23936)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
2025-07-25 10:35:18 -07:00
pbhatnagar-oss
5e769f900f fix(metrics): Cherrypick grpc stats fix release 3.0 (#23889)
Signed-off-by: pbhatnagar-oss <pbhatifiwork@gmail.com>
2025-07-23 07:51:52 -07:00
rumstead
fc27c4d099 fix(appset): When Appset is deleted, the controller should reconcile applicationset #23723 (cherry-pick ##23823) (#23834)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: sangeer <86688098+sangdammad@users.noreply.github.com>
2025-07-17 12:18:29 -04:00
github-actions[bot]
240a1833c0 Bump version to 3.0.11 on release-3.0 branch (#23745)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
2025-07-10 10:26:31 -04:00
github-actions[bot]
b19defcd40 Bump version to 3.0.10 on release-3.0 branch (#23744)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
2025-07-10 10:18:47 -04:00
gcp-cherry-pick-bot[bot]
bbf0582eb0 fix(health): CRD health check message (#23690) (cherry-pick #23691) (#23739)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-07-10 10:18:28 -04:00
gcp-cherry-pick-bot[bot]
ba3d90972c docs(images): add a note about missing images for 3.0 releases (cherry-pick #23741) (#23742)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-07-10 10:17:27 -04:00
gcp-cherry-pick-bot[bot]
0fe62852c7 fix(darwin): remove the need for cgo when building a darwin binary on linux (cherry-pick #23507) (#23735)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-07-10 09:58:01 -04:00
gcp-cherry-pick-bot[bot]
108dab6e16 docs(images): add a note about missing images for 3.0 releases (#23612) (cherry-pick #23712) (#23714)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-07-09 13:56:56 -04:00
Michael Crenshaw
873289c409 fix(server): infer resource status health for apps-in-any-ns (#22944) (#23706)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-07-09 11:20:22 -04:00
gcp-cherry-pick-bot[bot]
3ab0e9c1f5 fix: improves the ui message when an operation is terminated due to controller sync timeout (cherry-pick #23657) (#23671)
Signed-off-by: Patroklos Papapetrou <ppapapetrou76@gmail.com>
Co-authored-by: Papapetrou Patroklos <1743100+ppapapetrou76@users.noreply.github.com>
2025-07-07 10:49:04 +03:00
Alexandre Gaudreault
f7d0ebda31 fix(sync): auto-sync loop when FailOnSharedResource (#23357) (#23639)
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-07-02 15:00:22 -04:00
gcp-cherry-pick-bot[bot]
ea7e2b7905 fix(controller): get commit server url from env (cherry-pick #23536) (#23542)
Signed-off-by: Alexej Disterhoft <alexej.disterhoft@redcare-pharmacy.com>
Co-authored-by: Alexej Disterhoft <alexej@disterhoft.de>
2025-06-24 14:40:49 -04:00
gcp-cherry-pick-bot[bot]
06fd5060a0 fix: kustomize components + monorepos (cherry-pick #23486) (#23539)
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
2025-06-24 18:07:24 +02:00
gcp-cherry-pick-bot[bot]
f264eaa40f fix(controller): impersonation with destination name (#23309) (cherry-pick #23504) (#23517)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-06-23 09:52:45 -04:00
gcp-cherry-pick-bot[bot]
be3e9403e9 fix(appset): Add token to enterprise client (#23240) (cherry-pick #23455) (#23476)
Signed-off-by: Collin Walker <cwalker@ancestry.com>
Co-authored-by: Collin Walker <10523817+lets-call-n-walk@users.noreply.github.com>
Co-authored-by: Collin Walker <cwalker@ancestry.com>
2025-06-18 19:50:46 +05:30
github-actions[bot]
a1faf0265f Bump version to 3.0.9 on release-3.0 branch (#23462)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-06-17 16:45:12 -04:00
gcp-cherry-pick-bot[bot]
8868f91bbd fix(goreleaser): add darwin with CGO enabled and remove static to gorelease (cherry-pick #23457) (#23459)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-06-17 16:41:31 -04:00
github-actions[bot]
902826f8c7 Bump version to 3.0.8 on release-3.0 branch (#23451)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-06-17 11:53:16 -04:00
rumstead
95d8b48624 fix(goreleaser): add darwin with CGO enabled to gorelease (#23438)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-06-16 23:01:14 -04:00
github-actions[bot]
f458786dec Bump version to 3.0.7 on release-3.0 branch (#23428)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-06-16 13:59:56 -04:00
rumstead
7f2745f90f fix(server): Propagate useAzureWorkloadIdentity flag from during repo validation (#23348) (#23416)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: mikebordon <31316193+mikebordon@users.noreply.github.com>
2025-06-16 12:22:28 -04:00
rumstead
3ab884fe7b fix(applicationset): requeue applicationste when application status changes (#23412)
Signed-off-by: Dmitry Shmelev <Dmitry.Shmelev@jetbrains.com>
Signed-off-by: Dmitry Shmelev <avikez@gmail.com>
Co-authored-by: Dmitry Shmelev <avikez@gmail.com>
2025-06-16 11:48:18 -04:00
rumstead
d89e34b900 fix(azure): use compatible workload identity modules (#23004)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-06-11 12:26:35 -04:00
github-actions[bot]
db93798d66 Bump version to 3.0.6 on release-3.0 branch (#23336)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
2025-06-09 17:25:10 -04:00
Michael Crenshaw
fc271d4f24 fix(metrics): populate dest_server label (#23246) (#23269) (#23308)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-06-06 16:53:06 -04:00
Rouke Broersma
d98a0caf5e chore(repo-server): unify semver resolution in new versions subpackage (#20216) (#23310)
Signed-off-by: Paul Larsen <pnvlarsen@gmail.com>
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Paul Larsen <pnvlarsen@gmail.com>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-06-06 15:38:45 -04:00
gcp-cherry-pick-bot[bot]
59d4519c61 fix(tls): validate RSA keys before marshaling (cherry-pick #23295) (#23300)
Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
Co-authored-by: Ville Vesilehto <ville@vesilehto.fi>
2025-06-06 15:14:19 +02:00
Ville Vesilehto
0ef49b6a5a chore: upgrade Go from 1.24.1 to 1.24.4 (release-3.0) (#23293)
Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-06-06 12:49:12 +02:00
gcp-cherry-pick-bot[bot]
a31d5c915b fix: parse project with applicationset resource (cherry-pick #23252) (#23267)
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
2025-06-04 23:12:07 -10:00
Alexandre Gaudreault
f72ac787b6 fix: Change workloadidentity token cache expiry based on token expiry (#23100) (#23264)
Signed-off-by: Jagpreet Singh Tamber <jagpreetstamber@gmail.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Jagpreet Singh Tamber <jagpreetstamber@gmail.com>
2025-06-04 13:55:14 -04:00
Nitish Kumar
001848ee69 chore: replace heptio-images with argocd-e2e-container (cherry-pick #23040) (#23058)
Signed-off-by: nitishfy <justnitish06@gmail.com>
Signed-off-by: Nitish Kumar <justnitish06@gmail.com>
2025-06-03 07:20:51 +03:00
Michael Crenshaw
5c24b6bd7a fix(server): avoid unecessary claims restrictions (#22973) (3.0) (#23207)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-05-29 15:08:23 -06:00
github-actions[bot]
af9ebac0bb Bump version to 3.0.5 on release-3.0 branch (#23204)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
2025-05-29 11:25:11 -06:00
gcp-cherry-pick-bot[bot]
fe5869d59a fix(hydrator): increase max msg size (cherry-pick #23190) (#23191)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-05-28 16:57:04 -06:00
Soumya Ghosh Dastidar
0e20cb60a8 fix: add cooldown to prevent resetting autoheal exp backoff preemptively (cherry-pick #23057) (#23189)
Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
2025-05-28 22:40:53 +02:00
github-actions[bot]
5328bd58e6 Bump version to 3.0.4 on release-3.0 branch (#23185)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
2025-05-28 08:45:50 -06:00
Michael Crenshaw
040ed44b20 Merge commit from fork
Fix shadowed variable name

Signed-off-by: Ry0taK <49341894+Ry0taK@users.noreply.github.com>
Co-authored-by: Ry0taK <49341894+Ry0taK@users.noreply.github.com>
2025-05-28 08:20:49 -06:00
gcp-cherry-pick-bot[bot]
c27a9d3360 fix(commit-server): apply image override (cherry-pick #22916) (#22917)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-05-21 14:48:38 -04:00
github-actions[bot]
a14b0125fe Bump version to 3.0.3 on release-3.0 branch (#23087)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
2025-05-21 14:18:58 -04:00
Peter Jiang
866db14e30 chore: bump gitops-engine ssd fix (#23071)
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
2025-05-20 21:09:18 -04:00
gcp-cherry-pick-bot[bot]
af3d9266a8 fix: Account for batch event processing in e2e tests (cherry-pick #22356) (#23070)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
Co-authored-by: Andrii Korotkov <137232734+andrii-korotkov-verkada@users.noreply.github.com>
2025-05-20 20:09:04 -04:00
Alexandre Gaudreault
ddd6df5d44 fix: infinite reconciliation loop when app is in error (#23067)
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-05-20 16:12:00 -04:00
gcp-cherry-pick-bot[bot]
927ed3504e fix: remove default spec.preserveUnknownFields ignoreDifference for CRD (cherry-pick #22948) (#23044)
Signed-off-by: mikutas <23391543+mikutas@users.noreply.github.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Takumi Sue <23391543+mikutas@users.noreply.github.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-05-20 09:43:08 -04:00
gcp-cherry-pick-bot[bot]
b1cafa9d76 docs: fix jsonpath in 2.14-3.0 upgrade doc (cherry-pick #23045) (#23046)
Signed-off-by: Cyril Gaudin <cyril.gaudin@camunda.com>
Co-authored-by: Cyril Gaudin <cyril.gaudin@gmail.com>
2025-05-19 09:58:23 -07:00
github-actions[bot]
8a7c0f0c86 Bump version to 3.0.2 on release-3.0 branch (#23039)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: reggie-k <19544836+reggie-k@users.noreply.github.com>
2025-05-19 16:41:34 +03:00
Regina Voloshin
3fb34b99de fix(haproxy): setting maxconn in haproxy config cherry-pick (#15319) (#18283) (#23037)
Signed-off-by: Timothy Griffiths <griffiths.timothy@gmail.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Timothy Griffiths <griffiths.timothy@gmail.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-05-19 14:48:47 +02:00
Oleksandr Saulyak
90e9d1a5ad fix: settings request doesn't return default tracking method (#22965) (cherry-pick) (#23034)
Signed-off-by: oleksandr-codefresh <oleksandr.saulyak@octopus.com>
2025-05-19 11:07:32 +03:00
gcp-cherry-pick-bot[bot]
cca991a018 fix(test): broken e2e test (cherry-pick #22975) (#23017)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-05-16 10:00:08 -07:00
gcp-cherry-pick-bot[bot]
3d37cfac04 docs(server): no resource health when using the list api (cherry-pick #22954) (#22972)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-05-14 11:40:19 -04:00
github-actions[bot]
2bcef48772 Bump version to 3.0.1 on release-3.0 branch (#22968)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: reggie-k <19544836+reggie-k@users.noreply.github.com>
2025-05-14 17:59:45 +03:00
gcp-cherry-pick-bot[bot]
cb5d6f5ef7 fix(health): handle nil lastTransitionTime (#22897) (cherry-pick #22900) (#22908)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-05-09 10:46:00 -04:00
gcp-cherry-pick-bot[bot]
2913d5fcb5 fix: Race condition in nativeGitClient.LsFiles (issue #21754) (cherry-pick #22878) (#22906)
Signed-off-by: Mathieu Agar <magar@mirakl.com>
Co-authored-by: Mathieu Agar <magar@mirakl.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-05-08 08:01:31 -07:00
gcp-cherry-pick-bot[bot]
edd2358f79 fix(docs): upgrading 3.0 docs (cherry-pick #22891) (#22894)
Signed-off-by: Joerg Heyduk <joerg@heyduk.org>
Co-authored-by: jheyduk <jheyduk@users.noreply.github.com>
2025-05-07 09:06:07 -04:00
github-actions[bot]
e98f483bfd Bump version to 3.0.0 on release-3.0 branch (#22880)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: reggie-k <19544836+reggie-k@users.noreply.github.com>
2025-05-06 14:20:53 +03:00
github-actions[bot]
e2250bad87 Bump version to 3.0.0-rc6 on release-3.0 branch (#22861)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: reggie-k <19544836+reggie-k@users.noreply.github.com>
2025-05-04 11:43:11 +03:00
gcp-cherry-pick-bot[bot]
a444a05e8f fix: AppSet PullRequest and SCM generators get 401 from GitHub without tokenRef (cherry-pick #22737) (#22744)
Signed-off-by: reggie-k <regina.voloshin@codefresh.io>
Co-authored-by: Regina Voloshin <regina.voloshin@codefresh.io>
2025-05-02 18:25:24 -04:00
gcp-cherry-pick-bot[bot]
f075c5acd3 fix: Only port-forward to ready pods (#10610) (cherry-pick #22794) (#22825)
Signed-off-by: Mike Bryant <mike.bryant@mettle.co.uk>
Co-authored-by: Mike Bryant <mike.bryant@mettle.co.uk>
2025-05-02 18:24:25 -04:00
github-actions[bot]
f58b8070f1 Bump version to 3.0.0-rc5 on release-3.0 branch (#22830)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: reggie-k <19544836+reggie-k@users.noreply.github.com>
2025-04-30 08:38:01 +03:00
gcp-cherry-pick-bot[bot]
b2e875323c fix: do not normalize resource tracking on live crds (cherry-pick #22722) - cherry-pick 3.0 (#22735)
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
2025-04-28 17:22:08 -04:00
gcp-cherry-pick-bot[bot]
6fea008447 fix: remove project from cache key for project scoped credentials (cherry-pick #22712) (#22817)
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
Co-authored-by: Peter Jiang <35584807+pjiang-dev@users.noreply.github.com>
2025-04-28 16:47:01 -04:00
Regina Voloshin
ffbf9d5911 fix: AppSet PullRequest and SCM generators get 401 from GitHub without tokenRef (manually signed off cherry-pick #22737) (#22763)
Signed-off-by: reggie-k <regina.voloshin@codefresh.io>
2025-04-28 11:24:02 +03:00
gcp-cherry-pick-bot[bot]
ebeae20ff4 fix(ui): fix bearerToken validate in helm connect page (cherry-pick #22791) (#22798)
Signed-off-by: linghaoSu <linghao.su@daocloud.io>
Co-authored-by: Linghao Su <linghao.su@daocloud.io>
2025-04-25 08:35:07 -07:00
github-actions[bot]
3ae374ce22 Bump version to 3.0.0-rc4 on release-3.0 branch (#22756)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
2025-04-22 08:25:30 -07:00
gcp-cherry-pick-bot[bot]
3d2c010dbe feat(hydrator): handle sourceHydrator fields from webhook (#19397) (cherry-pick #22485) (#22753)
Signed-off-by: daengdaengLee <gunho1020@gmail.com>
Signed-off-by: Alexy Mantha <alexy@mantha.dev>
Co-authored-by: Alexy Mantha <alexy.mantha@goto.com>
Co-authored-by: Kunho Lee <gunho1020@gmail.com>
2025-04-22 08:21:13 -07:00
gcp-cherry-pick-bot[bot]
b6e6104dbc fix(ui): avoid spurious error on hydration (#22506) (cherry-pick #22711) (#22715)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-04-17 16:40:54 -07:00
gcp-cherry-pick-bot[bot]
a8ce6772b8 fix(controller): always set health.status.lastTransitionTime (#22665) (cherry-pick #22666) (#22667)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-04-14 12:50:58 -07:00
gcp-cherry-pick-bot[bot]
5d131c5251 fix: do not exclude APIService resources (cherry-pick #22586) (#22587)
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-04-07 12:24:48 +01:00
gcp-cherry-pick-bot[bot]
d6a04a3642 fix: Check for semver constraint matching in application webhook handler (cherry-pick #21648) (#22507)
Signed-off-by: eadred <eadred77@googlemail.com>
Co-authored-by: Eadred <eadred77@googlemail.com>
2025-03-27 11:27:26 -04:00
github-actions[bot]
4f37dd880a Bump version to 3.0.0-rc3 on release-3.0 branch (#22468)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
2025-03-24 15:38:58 -04:00
Michael Crenshaw
20f0fc6786 chore(deps): bump github.com/golang-jwt/jwt to 4.5.2/5.2.2 (#22464)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-24 14:06:45 -04:00
github-actions[bot]
4ced513335 Bump version to 3.0.0-rc2 on release-3.0 branch (#22411)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
2025-03-19 13:04:03 -04:00
gcp-cherry-pick-bot[bot]
0d2471b3f9 fix: Enable service account token automount for haproxy (#22226) (cherry-pick #22353) (#22406)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
Co-authored-by: Andrii Korotkov <137232734+andrii-korotkov-verkada@users.noreply.github.com>
2025-03-19 10:53:20 -04:00
gcp-cherry-pick-bot[bot]
226a670fe6 chore(ci): improve previous-version script readability, fix bug (cherry-pick #22378) (#22381)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-17 15:18:27 -04:00
gcp-cherry-pick-bot[bot]
2933154a5c fix(ci): get correct previous version, fail workflow if not (cherry-pick #22376) (#22377)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-17 20:01:18 +02:00
github-actions[bot]
ba866bfc16 Bump version to 3.0.0-rc1 on release-3.0 branch (#22374)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: reggie-k <19544836+reggie-k@users.noreply.github.com>
2025-03-17 17:48:35 +02:00
gcp-cherry-pick-bot[bot]
6e4c8fd53d fix(ci): use tags instead of branches (cherry-pick #22372) (#22373)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-17 17:43:57 +02:00
gcp-cherry-pick-bot[bot]
15046b992e fix(ci): handle major versions in compatibility table generator (cherry-pick #22370) (#22371)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-17 17:17:55 +02:00
Cheng Fang
8545d214b6 fix(docs): update --auth-token description in argocd_appset_update.md to account for environment variable (#22350)
Signed-off-by: Cheng Fang <cfang@redhat.com>
2025-03-16 16:49:50 -04:00
Andrii Korotkov
bfd72b42df fix: Revert "fix: Race condition occurs during initial sharding (#22264)" (#22354)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
2025-03-14 17:00:08 -07:00
Peter Jiang
f044200d9e chore: bump gitops-engine (#22335)
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
2025-03-14 16:52:00 -04:00
Linghao Su
0fab3cfeec feat(ui): support display sync wave (#20614)
Signed-off-by: linghaoSu <linghao.su@daocloud.io>
2025-03-14 12:05:32 -04:00
dependabot[bot]
c8e1de6146 chore(deps): bump github.com/Azure/kubelogin from 0.1.8 to 0.1.9 (#22308)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-14 11:30:06 -04:00
dependabot[bot]
de40dc2334 chore(deps): bump github.com/coreos/go-oidc/v3 from 3.12.0 to 3.13.0 (#22347)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-14 10:12:11 -04:00
Dan Garfield
9f8d68f07b docs: various wording fixes for 3.0 migration guide (#22343)
Signed-off-by: Dan Garfield <dan@codefresh.io>
2025-03-14 10:08:26 -04:00
Alexandre Gaudreault
fe598a831e chore!: add 60s default jitter (#22342)
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-03-13 22:01:12 +00:00
Michael Crenshaw
aeb0002877 chore: set default tracking to annotation (#22289)
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Yuan Tang <terrytangyuan@gmail.com>
2025-03-13 17:40:51 -04:00
Michael Crenshaw
910b9518e4 feat(controller): enable batch event processing by default (#22338)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-13 17:40:31 -04:00
Marco Franssen
2ce593b5de chore: Optimize Docker image layers (#21525)
Signed-off-by: Marco Franssen <marco.franssen@gmail.com>
2025-03-13 15:24:45 -04:00
Matthieu MOREL
83257a9e73 chore: use grpc-middleware interceptors (#22329)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-03-13 15:25:38 +00:00
renovate[bot]
cae840bb13 chore(deps): update dependency gotestyourself/gotestsum to v1.12.1 (#22328)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-13 06:42:34 -07:00
Regina Voloshin
8d12e352f4 docs: document logs RBAC enforcement remediation (#22285)
Signed-off-by: reggie-k <regina.voloshin@codefresh.io>
2025-03-13 09:39:45 -04:00
Michael Crenshaw
d54ae98b20 fix(controller): wrong tracking annotation for malformed resources (#22325)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-13 09:34:20 -04:00
renovate[bot]
12928cbdcc chore(deps): update module github.com/golangci/golangci-lint to v1.64.7 (#22306)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-12 16:40:13 -04:00
Alexandre Gaudreault
9c443b6501 fix(cli): improve performance for admin export/import cmd (#22322)
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-03-12 20:05:39 +00:00
dependabot[bot]
a45f715763 chore(deps): bump chromedriver from 134.0.0 to 134.0.2 in /ui-test (#22307)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-03-12 15:31:42 +00:00
Alexandre Gaudreault
335b65baf8 chore(config)!: Ignore all .status updates & known high churn changes by default (#21760)
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-03-12 09:12:47 +02:00
Regina Voloshin
f27515783a docs: Document Helm 3.17.1 breaking changes (#22283)
Signed-off-by: reggie-k <regina.voloshin@codefresh.io>
2025-03-11 17:27:04 -04:00
Michael Crenshaw
2afcb6f107 fix(test): delete CRD between tests, install CRD before syncing CRs (#22299)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-11 17:11:26 -04:00
dependabot[bot]
05a9171b42 chore(deps-dev): bump typescript from 5.7.3 to 5.8.2 in /ui-test (#22118)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-11 17:00:17 -04:00
Alexandre Gaudreault
ac50d8e1c1 feat(config)!: exclude known interim resources by default (#20013) (#21635)
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-03-11 12:57:42 -04:00
Brett Dudo
f775e7bf28 feat(appset): Add values to PR generator (#21557)
Signed-off-by: Brett C. Dudo <brett@dudo.io>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Tobias Lindberg <tobias.ehlert@gmail.com>
Signed-off-by: Afzal Ansari <afzal442@gmail.com>
Signed-off-by: Revital Barletz <revitalbarletz@gmail.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: reggie-k <regina.voloshin@codefresh.io>
Signed-off-by: asuforce <owata.sn@gmail.com>
Signed-off-by: Michele Baldessari <michele@acksyn.org>
Signed-off-by: Laurent Lavaud <laurent.lavaud@mirakl.com>
Signed-off-by: Prune <prune@lecentre.net>
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
Signed-off-by: Jacob Colvin <jacobcolvin1@gmail.com>
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Christopher J. Adkins <chris@cjadkins.com>
Signed-off-by: Almo Elda <almogldbh@gmail.com>
Signed-off-by: CI <ci@argoproj.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Rafal Pelczar <rafal@akuity.io>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tobias Lindberg <tobias.ehlert@gmail.com>
Co-authored-by: Afzal Ansari <afzal442@gmail.com>
Co-authored-by: Revital Barletz <revitalbarletz@gmail.com>
Co-authored-by: Regina Voloshin <reginakagan@gmail.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Regina Voloshin <regina.voloshin@codefresh.io>
Co-authored-by: Shun Nishitsuji <owata.sn@gmail.com>
Co-authored-by: Michele Baldessari <michele@acksyn.org>
Co-authored-by: Laurent Lavaud <llavaud@users.noreply.github.com>
Co-authored-by: Prune Sebastien THOMAS <prune@lecentre.net>
Co-authored-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
Co-authored-by: Jacob Colvin <jacobcolvin1@gmail.com>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
Co-authored-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Co-authored-by: Chris Adkins <chris@cjadkins.com>
Co-authored-by: almoelda <42950693+almoelda@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: CI <ci@argoproj.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Rafal <rafal@akuity.io>
2025-03-11 11:44:20 -04:00
Dillen Padhiar
fa0b5f56ab feat: add force promote actions for Numaplane rollouts (#22141)
Signed-off-by: Dillen Padhiar <dillen_padhiar@intuit.com>
2025-03-11 10:03:51 -04:00
kahou82
43e5941042 fix: Race condition occurs during initial sharding (#22264)
Signed-off-by: Kahou Lei <kahou82@gmail.com>
2025-03-11 01:20:20 -04:00
dependabot[bot]
2168221092 chore(deps): bump library/golang from 1.24.0 to 1.24.1 in /test/remote (#22184)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-11 01:18:44 -04:00
dependabot[bot]
64569e61a1 chore(deps): bump go.opentelemetry.io/otel from 1.34.0 to 1.35.0 (#22217)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-11 01:14:37 -04:00
Alexandre Gaudreault
cca7485917 feat!: update compareoptions default values (#22230)
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-03-11 01:14:17 -04:00
Keith Chong
74b35322a2 feat: Make certain Status panel items look more 'clickable' (#19698) (#22232)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2025-03-11 01:03:15 -04:00
Atif Ali
0ed7c5618f fix: Unable to edit http repo credentials from ArgoCD UI (#22065)
Signed-off-by: Atif Ali <atali@redhat.com>
Co-authored-by: Dan Garfield <dan@codefresh.io>
2025-03-10 20:16:04 +00:00
Michael Crenshaw
42219fd7b7 chore(lint): fix deep copy informers lint (#22290)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-10 15:31:17 -04:00
dependabot[bot]
111cf2ce9f chore(deps-dev): bump @types/node from 22.13.5 to 22.13.10 in /ui-test (#22272)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-10 08:35:36 -07:00
sivchari
d301b40c6b feat: Upgrade notifications engine (#22273)
Signed-off-by: sivchari <shibuuuu5@gmail.com>
2025-03-10 11:02:16 -04:00
rumstead
e3bd56972d feat(server): make deep copies of objects returned by informers (#22173) (#22179)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-03-10 14:29:07 +00:00
sivchari
922d080ae5 chore: upgrade Go to 1.24 (#22242)
Signed-off-by: sivchari <shibuuuu5@gmail.com>
2025-03-10 10:14:41 -04:00
Michael Crenshaw
bd1018af5e docs: fix tmp path and document Rancher caveat (#22252)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-10 10:10:47 -04:00
Matthieu MOREL
76dbaaa3e0 chore: bump to github.com/grpc-ecosystem/go-grpc-middleware/v2 (#22098)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-03-10 10:06:54 -04:00
Andrii Korotkov
376e8d5260 fix: Update haproxy version to match the chart (#22226) (#22236)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
2025-03-10 10:03:04 -04:00
dependabot[bot]
627da11384 chore(deps): bump github.com/Azure/kubelogin from 0.1.6 to 0.1.8 (#22271)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-10 06:28:41 -07:00
Gahl Peled
75cb7fc42d fix: issue 22206 - fixes overlapping lines in logs by increasing line height (#22207)
Signed-off-by: Gahl_Peled <gahl.peled@talentsystems.com>
2025-03-09 19:59:24 +02:00
Andrii Korotkov
a8f646e430 fix: Notifications on-deployed would now be delivered if sync didn't change the health status of the app in a process (#22203) (#22204)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
2025-03-09 19:58:52 +02:00
Linghao Su
4202168c44 fix(ui): reduce rerender in pod log view (#22241)
Signed-off-by: linghaoSu <linghao.su@daocloud.io>
2025-03-09 19:39:09 +02:00
sivchari
e3b333a860 fix: JSON format (#22237)
Signed-off-by: sivchari <shibuuuu5@gmail.com>
2025-03-09 19:28:58 +02:00
dependabot[bot]
cb135fdd0d chore(deps): bump axios from 1.7.4 to 1.8.2 in /ui-test (#22247)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-09 19:22:27 +02:00
Sven Schliesing
3c3410cf5d docs: fix typo in declarative-setup.md (#22256)
Signed-off-by: Sven Schliesing <muffl0n@raffts.net>
2025-03-09 19:21:12 +02:00
github-actions[bot]
5e9fc55783 [Bot] docs: Update Snyk report (#22263)
Signed-off-by: CI <ci@argoproj.com>
Co-authored-by: CI <ci@argoproj.com>
2025-03-09 19:12:18 +02:00
Andrii Korotkov
9d66e89d14 chore: Remove k8s 1.28 from e2e testing (#22245)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
2025-03-07 13:41:44 -05:00
Andrii Korotkov
14a09be652 chore(deps): Bump utfutil to v1.0.0 (#22228) (#22243)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
2025-03-07 15:52:22 +00:00
sivchari
fbd7f29056 feat: use errors.Join for debuggable (#22235)
Signed-off-by: sivchari <shibuuuu5@gmail.com>
2025-03-07 09:56:15 -05:00
dependabot[bot]
2cefcc5a36 chore(deps): bump chromedriver from 133.0.3 to 134.0.0 in /ui-test (#22218)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-07 06:06:05 -08:00
dependabot[bot]
683e4e0d95 chore(deps): bump selenium-webdriver from 4.27.0 to 4.29.0 in /ui-test (#22117)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2025-03-06 18:23:56 -05:00
Andrii Korotkov
8d1aeb58a2 chore: Update some dependencies and add some comments about old libs (#22104) (#22208)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
2025-03-06 16:17:14 -05:00
dependabot[bot]
4c27f73559 chore(deps): bump golang.org/x/oauth2 from 0.27.0 to 0.28.0 (#22211)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-06 15:55:03 -05:00
Dan Garfield
dc3286730a docs: Fix typos and grammar in tls.md (#22229)
Signed-off-by: Dan Garfield <dan@codefresh.io>
2025-03-06 15:54:38 -05:00
Andrii Korotkov
62ec9fef36 fix: Use t.Fatal instead of os.Exit in tests (part 2) (#21003) (#22187)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
2025-03-06 19:24:07 +00:00
dependabot[bot]
a8b76f2951 chore(deps): bump golang.org/x/net from 0.36.0 to 0.37.0 (#22209)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-06 11:13:03 -05:00
Michael Crenshaw
8a752a56d6 docs: document bearerToken in repo example doc (#22195)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-06 09:58:39 -05:00
dependabot[bot]
4f179a192d chore(deps): bump jinja2 from 3.1.5 to 3.1.6 in /docs (#22219)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-06 09:51:28 -05:00
dependabot[bot]
270b352cbd chore(deps): bump golang.org/x/time from 0.10.0 to 0.11.0 (#22212)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-06 09:47:00 -05:00
dependabot[bot]
2d994038be chore(deps): bump golang.org/x/sync from 0.11.0 to 0.12.0 (#22216)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-06 09:46:08 -05:00
Nitish Kumar
753f7b6e72 chore: enable parallel helm manifest generation by default (#22224)
Signed-off-by: nitishfy <justnitish06@gmail.com>
2025-03-06 09:43:14 -05:00
Soumya Ghosh Dastidar
6959e54f06 fix: have argocd server pass the appLabelKey for proper caching (#22186)
Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
2025-03-06 07:28:53 +00:00
Michael Crenshaw
7327093b66 docs: custom resource action UI tweaks (#22202)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-05 16:49:07 -05:00
Michael Crenshaw
74582e9965 chore: embed trivial rand string function (#22177)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-05 16:34:16 -05:00
Andrii Korotkov
29c69b3601 chore(deps): Bump argoproj repos versions (#22104) (#22198)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
2025-03-05 14:58:32 -05:00
Nitish Kumar
546383a8e5 fix(cli): log correct error message when updating a cluster that is not present (#22190)
Signed-off-by: nitishfy <justnitish06@gmail.com>
2025-03-05 11:48:35 -05:00
dependabot[bot]
0444fcdf37 chore(deps): bump github.com/prometheus/client_golang from 1.21.0 to 1.21.1 (#22180)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-05 11:46:55 -05:00
dependabot[bot]
527ef92c30 chore(deps): bump sigs.k8s.io/structured-merge-diff/v4 from 4.4.4-0.20241211184406-7bf59b3d70ee to 4.6.0 (#22181)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-05 11:46:11 -05:00
dependabot[bot]
2731c3f18d chore(deps): bump google.golang.org/grpc from 1.70.0 to 1.71.0 (#22183)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-05 11:45:22 -05:00
dependabot[bot]
9783c5ea24 chore(deps): bump golang.org/x/net from 0.35.0 to 0.36.0 (#22182)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-05 11:44:34 -05:00
Michael Crenshaw
db82e23ebb chore: use internal errors util instead of pkg's (#22174)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-05 11:40:56 -05:00
Regina Voloshin
04a1608643 docs: 3.0 release date on May 06 (#22189)
Signed-off-by: reggie-k <regina.voloshin@codefresh.io>
2025-03-05 10:13:38 -05:00
sivchari
6b002a5106 feat: upgrade to v1.32.2 (#22168)
Signed-off-by: sivchari <shibuuuu5@gmail.com>
2025-03-04 16:39:28 -05:00
Andrii Korotkov
5223ce546a chore: Upgrade Redis from 7.0.15-alpine to 7.2.7-alpine and haproxy (#22108) (#22110)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
2025-03-04 15:59:03 -05:00
renovate[bot]
95a43e0416 chore(deps): update module github.com/golangci/golangci-lint to v1.64.6 (#22115)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-04 15:57:44 -05:00
Michael Crenshaw
c6b00007f2 fix(actions): don't run empty Lua scripts (#22084) (#22161)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-04 14:25:36 -05:00
Michael Crenshaw
eb6732ec9e fix(ci): use pinned Helm version for init-release (#22164) (#22165)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-04 13:06:01 -05:00
Nitish Kumar
0b0c737af0 chore(deps): bump github.com/go-jose/go-jose/v3 to v4 (#22154)
Signed-off-by: nitishfy <justnitish06@gmail.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-03-04 12:30:12 -05:00
sivchari
c0b278738c feat: Support kube 1.32 (#21805)
Signed-off-by: sivchari <shibuuuu5@gmail.com>
2025-03-04 11:15:35 -05:00
rumstead
029927b25e feat(appcontroller): store application health status in redis by default (#10312) (#21532)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-03-04 11:29:23 +00:00
dependabot[bot]
f2490fccdd chore(deps): bump go.opentelemetry.io/otel/sdk from 1.33.0 to 1.34.0 (#21570)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-03 19:55:58 -05:00
Dag Andersen
898a126f10 docs: Add section on how to lock down/restrict the default project (#21757)
Signed-off-by: Dag Andersen <dagbjerreandersen@gmail.com>
2025-03-03 19:55:47 -05:00
Michael Crenshaw
bfb04ddf3e fix(ui): parameter tab null ref w/ hydrator (#22097) (#22131)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-03 16:16:32 -05:00
Andrii Korotkov
416b7d0c32 fix(test): Use t.Fatal instead of os.Exit in tests (part 1) (#21003) (#22114)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
2025-03-03 13:36:13 -05:00
Mike Cutsail
561cbef5cc feat: checking user defined roles and policies for referential integrity (#20825) (#22132)
Signed-off-by: Mike Cutsail <mcutsail15@apple.com>
2025-03-03 10:15:43 -08:00
rumstead
2bcaa19894 revert: add a check for user defined role referential integrity #21065 (#22130)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-03-03 22:03:27 +05:30
Soumya Ghosh Dastidar
228b86d3b5 chore: update mockery version (#22126)
Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
2025-03-03 16:57:20 +02:00
Andrii Korotkov
f542ae5158 fix: Revert "split arrays in yaml to fix ambiguous collapse when array items have nested objects (#21064)" (#22099) (#22128)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
2025-03-03 09:48:41 -05:00
Mike Cutsail
c71dd1a9e6 feat: add a check for user defined role referential integrity (#21065)
Signed-off-by: Mike Cutsail <mcutsail15@apple.com>
2025-03-03 06:09:25 -08:00
dependabot[bot]
f2c5093013 chore(deps): bump @types/selenium-webdriver from 4.1.27 to 4.1.28 in /ui-test (#21414)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-02 18:43:57 -05:00
dependabot[bot]
21ea59d600 chore(deps): bump go.opentelemetry.io/otel from 1.33.0 to 1.34.0 (#21569)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-02 18:35:32 -05:00
Karl Taylor
e2e6faa3b5 fix(ui): prevent parameter editor from resetting when props update (fixes #14351) (#21625)
Signed-off-by: Karl Taylor <16408267+k4r1@users.noreply.github.com>
2025-03-02 18:32:03 -05:00
renovate[bot]
42fa72d499 chore(deps): update dependency pymdown-extensions to v10.14.3 (#21619)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-02 18:25:06 -05:00
Linghao Su
6f9389c2ea feat(log): support match case in pod log search (#21919)
Signed-off-by: linghaoSu <linghao.su@daocloud.io>
Co-authored-by: Dan Garfield <dan@codefresh.io>
2025-03-02 18:21:51 -05:00
dependabot[bot]
98cd061ac9 chore(deps): bump library/golang from 2b1cbf2 to cd0c949 in /test/remote (#22020)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-02 18:04:34 -05:00
Michael Crenshaw
b9131c1802 feat(cmp): pass empty env vars to plugins (#18720) (#22096)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-03-02 18:01:50 -05:00
Blake Pettersson
e6f94f227c fix(appcontroller): selfhealattemptscount needs to be reset at times (#22095)
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
2025-03-02 17:46:39 -05:00
Abhinandh B G
74244323f8 fix: Rephrased sentence to a meaningfull one (#22113)
Signed-off-by: Abhinandh B G <97796199+babugeet@users.noreply.github.com>
2025-03-02 23:33:43 +05:30
github-actions[bot]
e38c7ae00f [Bot] docs: Update Snyk report (#22106)
Signed-off-by: CI <ci@argoproj.com>
Co-authored-by: CI <ci@argoproj.com>
2025-03-02 17:14:06 +00:00
Michael Crenshaw
261137df9d chore(health): report progressing status for AppSets (#22092)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-02-28 18:09:06 -05:00
dependabot[bot]
c47152d017 chore(deps): bump chromedriver from 133.0.2 to 133.0.3 in /ui-test (#22018)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-28 16:50:44 -05:00
BWagenerGenerali
7c7dda0e93 fix(grafanadashboard): add memory units to panels showing memory usage (#22078)
Signed-off-by: BWagenerGenerali <69955643+BWagenerGenerali@users.noreply.github.com>
2025-02-28 16:46:22 -05:00
Michael Crenshaw
806c5f6b6d fix: return cluster URL in error message, not full cluster object (#22094)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-02-28 21:10:00 +00:00
Matthieu MOREL
795bda5dd8 chore: use github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus (#21937)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-02-28 15:44:33 -05:00
Matias Reparaz
499f74dc27 docs: Update USERS.md (#22093)
Signed-off-by: Matias Reparaz <mreparaz@gmail.com>
2025-02-28 15:01:20 -05:00
Mathias Petermann
c4183aad76 docs: Document askpass socket sharing between reposerver and cmp sidecar (#22083)
Signed-off-by: Mathias Petermann <mathias.petermann@gmail.com>
2025-02-28 09:30:20 -07:00
Christian Hernandez
3f74b24c0a docs: Adding Argo CD CLI plugin support proposal (#19624)
Signed-off-by: Christian Hernandez <christian@chernand.io>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
2025-02-28 11:20:51 -05:00
Dale Haiducek
1905d127a5 fix: Check placement exists before length check (#22060) (#22057)
Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
2025-02-28 10:55:14 -05:00
Andrii Korotkov
07da3d41da chore: Option to disable sync with replace on API Server level (#21427) (#22073)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
2025-02-28 09:43:53 -05:00
dependabot[bot]
cbef55e566 chore(deps): bump github.com/go-git/go-git/v5 from 5.13.2 to 5.14.0 (#22076)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-28 09:27:16 -05:00
Michael Crenshaw
c6757573ae feat(kustomize): support --include-templates for labels (#15283) (#22069)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-02-28 09:26:26 -05:00
Xiaopeng Han
2b1220c600 chore: revise wrong resource customization usage example (#22074)
Signed-off-by: xiaopeng <hanxiaop8@outlook.com>
2025-02-28 09:36:05 +05:30
Peter Jiang
edbce2a524 chore(deps): bump gitops-engine to latest (#22071)
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
2025-02-27 22:12:15 +00:00
Atif Ali
55f8a434d0 feat(ui): split arrays in yaml to fix ambiguous collapse when array items have nested objects (#21064)
Signed-off-by: Atif Ali <atali@redhat.com>
2025-02-27 15:54:49 -05:00
Michael Crenshaw
8a97c1d138 fix(hydrator): refresh by annotation instead of work queue (#22016)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-02-27 14:22:03 -05:00
Michael Crenshaw
35009a7d1c fix(hydrator): don't use manifest-generate-paths (#22039) (#22015)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-02-27 12:15:45 -05:00
Gergely Fábián
94b34f88ec fix: upgrade x/crypto to v0.35.0 to solve CVE-2025-22869 (#22048)
Signed-off-by: Gergely Fábián <gergo.fb@gmail.com>
2025-02-27 12:07:10 -05:00
Richard Palm
ce819128f9 docs: fix project role docs (#21832)
Signed-off-by: Richard Palm <richard.palm@hellofresh.com>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
2025-02-27 10:35:18 +01:00
Nitish Kumar
e6e9255216 fix: correct lookup for the kustomization file when applying patches (#22024)
Signed-off-by: nitishfy <justnitish06@gmail.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-02-27 13:39:39 +05:30
Atif Ali
c09e6fa6ad feat: improve StatefulSet immutable field error messages (#21209)
Signed-off-by: Atif Ali <atali@redhat.com>
2025-02-26 23:47:51 +02:00
Michael Crenshaw
3baca9b696 fix(hydrator): don't get cluster or API versions for hydrator (#21985)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-02-26 13:36:48 -05:00
Taeyeop Kim
961147d387 docs: Update sync-kubectl.md - Correct kubectl command for a sample (#22030)
Signed-off-by: Taeyeop Kim <taeyeop.kim1@gmail.com>
2025-02-26 17:23:58 +00:00
Regina Voloshin
686964daaa fix: removed null security context from redis-ha values.yaml to placate helm 3.17.1 (#22035)
Signed-off-by: reggie-k <regina.voloshin@codefresh.io>
2025-02-26 17:16:39 +00:00
Suraj yadav
b88ad57986 fix(ui): Added SSV option to helm type repos (#22006)
Signed-off-by: Surajyadav <harrypotter1108@gmail.com>
2025-02-26 10:56:18 -05:00
Nitish Kumar
975e966e26 docs: add more info on what login --core does (#21487)
Signed-off-by: nitishfy <justnitish06@gmail.com>
Signed-off-by: Nitish Kumar <justnitish06@gmail.com>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
2025-02-26 20:13:43 +05:30
gussan
49a4b7f14f fix: fetch syncedRevision in UpdateRevisionForPaths (#21014) (#21015)
Signed-off-by: toyamagu2021 <toyamagu2021@gmail.com>
Signed-off-by: toyamagu-2021 <toyamagu2021@gmail.com>
2025-02-26 01:07:31 +05:30
Isaac Gaskin
644af54a7c chore: version bumping helm3 (#22009)
Signed-off-by: Isaac Gaskin <isaac.gaskin@circle.com>
2025-02-25 19:34:38 +00:00
dependabot[bot]
c897e944db chore(deps): bump github.com/go-jose/go-jose/v4 from 4.0.2 to 4.0.5 (#21989)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-25 14:10:35 -05:00
dependabot[bot]
94d3899038 chore(deps): bump golang.org/x/oauth2 from 0.26.0 to 0.27.0 (#21990)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-25 14:09:02 -05:00
Leonardo Luz Almeida
1823d8fcd2 docs: add applicationset controller doc to preserve annotations and labels (#22008)
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
2025-02-25 14:08:39 -05:00
Regina Voloshin
402802b089 feat!: Logs rbac enforce by default (#21678)
Signed-off-by: reggie-k <regina.voloshin@codefresh.io>
Signed-off-by: Regina Voloshin <reginakagan@gmail.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-02-25 18:27:32 +00:00
Alexandre Gaudreault
e784c47667 chore(deps): bump go 1.23.5 & tools (#21748)
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-02-25 17:04:57 +00:00
rumstead
e44ae96c07 fix(appset): generated app errors should use the default requeue (#21887) (#21936)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
2025-02-25 15:27:32 +00:00
Michael Crenshaw
be293fe9ed chore(hydrator): improve error message (#21987)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-02-24 22:01:01 +00:00
Michael Crenshaw
e18b4d7ac8 chore(deps): switch to new expr package (#21982)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-02-24 23:37:58 +02:00
dependabot[bot]
f32f69f7d2 chore(deps): bump github.com/google/go-cmp from 0.6.0 to 0.7.0 (#21956)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-24 14:32:18 -05:00
Michael Crenshaw
846503bb0e docs: note idle connections issue for cluster namespaces (#21978)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-02-24 18:43:21 +02:00
Michael Crenshaw
f63f5f954e docs: document source hydrator maturity (#21969)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-02-24 10:41:06 -05:00
Regina Voloshin
8044d68492 feat: add bearer token auth (#21462)
Signed-off-by: reggie-k <regina.voloshin@codefresh.io>
Co-authored-by: Pasha Kostohrys <pasha.kostohrys@gmail.com>
2025-02-24 12:44:07 +02:00
dependabot[bot]
33ad0a7ba7 chore(deps-dev): bump @types/node from 22.13.4 to 22.13.5 in /ui-test (#21960)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-24 10:37:47 +02:00
dependabot[bot]
0dddb9e6c8 chore(deps): bump library/busybox from a5d0ce4 to 498a000 in /test/e2e/multiarch-container (#21959)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-24 10:37:34 +02:00
dependabot[bot]
562fa065c6 chore(deps): bump github.com/redis/go-redis/v9 from 9.7.0 to 9.7.1 (#21957)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-24 10:37:22 +02:00
dependabot[bot]
ecee599640 chore(deps): bump github.com/bradleyfalzon/ghinstallation/v2 from 2.13.0 to 2.14.0 (#21955)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-24 10:37:06 +02:00
Suraj yadav
38b0fd5cd4 fix(ui): columns-adjusted for kind and Namespace in sync details. (#21038)
Signed-off-by: Surajyadav <harrypotter1108@gmail.com>
2025-02-23 16:38:57 -05:00
Soumya Ghosh Dastidar
87671f55c5 fix: ignore prune=false resources from PruningRequired count (#21941)
Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
2025-02-23 16:12:22 -05:00
dependabot[bot]
1f1c33983b chore(deps-dev): bump @types/node from 22.10.10 to 22.13.4 in /ui-test (#21874)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-23 20:43:50 +02:00
dependabot[bot]
ee83eea784 chore(deps): bump library/golang from 1.23.6 to 1.24.0 in /test/remote (#21868)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-23 20:43:08 +02:00
dependabot[bot]
9e6b28b8a2 chore(deps): bump library/golang from 1.23.6 to 1.24.0 in /test/container (#21866)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-23 20:42:41 +02:00
dependabot[bot]
84b49c84ca chore(deps): bump gitpod/workspace-full from bec45eb to a47a68e (#21843)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-23 20:40:28 +02:00
dependabot[bot]
6c64d5ff55 chore(deps): bump chromedriver from 132.0.1 to 133.0.2 in /ui-test (#21916)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-23 20:39:07 +02:00
Andrii Korotkov
7b1ed5218a fix: On deployed trigger must consider race between last transition time and sync finished time (#9070) (#21944)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
2025-02-23 17:44:24 +02:00
Fabián Sellés Rosa
079341c65c fix(applicationset): ApplicationSets with rolling sync stuck in Pending (#20230)
Signed-off-by: Fabián Sellés <fabian.selles@adevinta.com>
Co-authored-by: Thibault Jamet <tjamet@users.noreply.github.com>
Co-authored-by: Carlos Rejano <carlosrejanoromeu@gmail.com>
2025-02-22 09:14:49 -05:00
sivchari
9f81cd4798 fix: Use ARGOCD_SERVER for default value (#21930)
Signed-off-by: sivchari <shibuuuu5@gmail.com>
2025-02-22 12:20:15 +05:30
Matthieu MOREL
37aaeb3dd9 chore: enable usetesting linter (#21935)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-02-21 18:50:55 +00:00
dependabot[bot]
7870200461 chore(deps): bump github.com/prometheus/client_golang from 1.20.5 to 1.21.0 (#21915)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-20 11:46:47 -05:00
Marco Stuurman
167e122eba docs: Fix typo code-gen/codegen contributors-quickstart.md (#21922)
Signed-off-by: Marco Stuurman <marco@fe.ax>
2025-02-20 04:14:25 -10:00
Blake Pettersson
a1431bef4c fix(ui, rbac): project-roles (#21829)
Signed-off-by: wyttime04 <vanessa80332@gmail.com>
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
Co-authored-by: wyttime04 <vanessa80332@gmail.com>
2025-02-20 11:40:15 +01:00
Matthew Bennett
073ccf7c35 fix(#19314, #15700): allow ssh/altssh subdomains in repo URLs to match webhook payload (#21227) 2025-02-20 12:15:29 +05:30
Michael Crenshaw
feb7097fc9 feat(metrics): add more kubectl metrics (#21720)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-02-19 11:21:22 -05:00
appiepollo14
976a8498d4 ci: fixes #21862 Concurrency in pr-title-check (#21863)
Signed-off-by: appiepollo14 <asjer94@live.com>
2025-02-18 14:48:32 -05:00
renovate[bot]
36d563a3c2 chore(deps): update dependency gotestyourself/gotestsum to v1.12.0 (#21900)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-18 12:18:05 -05:00
Nitish Kumar
944f9f7b68 chore: add the Argo CD type definitions and method comments (#21854)
Signed-off-by: nitishfy <justnitish06@gmail.com>
2025-02-18 11:20:52 -05:00
github-actions[bot]
f78c7ee2ba [Bot] docs: Update Snyk report (#21883)
Signed-off-by: CI <ci@argoproj.com>
Co-authored-by: CI <ci@argoproj.com>
2025-02-18 11:03:15 -05:00
Matthieu MOREL
c1b2f78f46 chore: enable var-naming from revive (#21861)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-02-18 11:02:38 -05:00
Takumi Sue
38c2b34da0 chore: update gotestsum automatically (#21828)
Signed-off-by: mikutas <23391543+mikutas@users.noreply.github.com>
2025-02-18 10:53:13 -05:00
renovate[bot]
2e1db11ad9 chore(deps): update module github.com/golangci/golangci-lint to v1.64.5 (#21850)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-18 10:50:07 -05:00
dependabot[bot]
ab05f35507 chore(deps): bump github.com/dlclark/regexp2 from 1.11.4 to 1.11.5 (#21853)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-18 10:49:33 -05:00
dependabot[bot]
b3bf182a65 chore(deps): bump github.com/Azure/azure-sdk-for-go/sdk/azidentity from 1.8.1 to 1.8.2 (#21867)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-18 10:49:04 -05:00
Cheng Fang
563ccb20c7 fix: fix KustomizeImage Match function to pass added unit tests (#21872)
Signed-off-by: Cheng Fang <cfang@redhat.com>
2025-02-18 10:26:12 -05:00
dependabot[bot]
ca9da799d8 chore(deps): bump github.com/spf13/cobra from 1.8.1 to 1.9.1 (#21889)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-18 10:25:28 -05:00
dependabot[bot]
50fb7bcd21 chore(deps): bump golang.org/x/crypto from 0.32.0 to 0.33.0 (#21827)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-18 09:51:23 -05:00
Alexandre Gaudreault
eb6dd46e19 fix(cli): ignored resources should not be pruned during restore (#21894)
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-02-18 09:36:56 -05:00
Andrii Korotkov
e14d6b7bf9 chore: Update notifications to be less spammy (#20871) (#21884)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
2025-02-18 08:43:39 -05:00
Leonardo Luz Almeida
6daaac5924 chore: add log context to proxy extension requests (#21834) 2025-02-14 03:04:58 +00:00
Dan Garfield
65664ce5f3 docs: clarify wording on cluster secrets (#21865)
Signed-off-by: Dan Garfield <dan@codefresh.io>
2025-02-12 22:52:43 +01:00
Dejan Zele Pejchev
8a447d9ae0 chore: add e2e test for hook finalizer which prevents external resource deletion (#21113)
Signed-off-by: Dejan Zele Pejchev <pejcev.dejan@gmail.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-02-11 09:28:01 -05:00
Nitish Kumar
951d9d3f17 feat: add the --redis-compress as the global flag to set redis compression. (#21786)
Signed-off-by: nitishfy <justnitish06@gmail.com>
2025-02-10 17:38:20 -08:00
Nitish Kumar
967126860c test: add get cluster info test case (#21831)
Signed-off-by: nitishfy <justnitish06@gmail.com>
2025-02-10 16:02:22 -08:00
Dag Andersen
d19b02dcd0 docs: Ensure Argo CD Hydrator branch prefix consistency (#21836)
Signed-off-by: Dag Andersen <dagbjerreandersen@gmail.com>
2025-02-10 12:43:14 -06:00
ivanscai
d183d9c614 fix: dynamic cluster distribution issue 20965, update the shard… (#21042)
Signed-off-by: caijing <caijing.cai@alibaba-inc.com>
Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2025-02-09 22:25:34 -05:00
Brett Dudo
b600c5ec7d fix: make codegen permissions (#21667)
Signed-off-by: Brett C. Dudo <brett@dudo.io>
Signed-off-by: Brett Dudo <brett@dudo.io>
Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2025-02-09 22:18:12 -05:00
dependabot[bot]
8e91ce9b2b chore(deps): bump library/golang from 1.23.5 to 1.23.6 in /test/remote (#21799)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-09 22:10:40 -05:00
Matthieu MOREL
8507a87bfa chore: define apiextensionsv1 alias with importas (#21823)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-02-09 22:10:15 -05:00
dependabot[bot]
4e2902d972 chore(deps): bump google.golang.org/protobuf from 1.36.4 to 1.36.5 (#21813)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-09 22:07:39 -05:00
Michael Crenshaw
928fd19593 chore(appset): simplify cluster list code (#21820)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-02-09 22:07:21 -05:00
Andrii Korotkov
5b79c34c72 fix: New kube applier for server side diff dry run with refactoring (#21488) (#21749)
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
2025-02-07 12:26:03 -05:00
bradkwadsworth
0973409273 feat: Kustomize ignore missing components (#18634) (#21674)
Signed-off-by: Brad Wadsworth <wadsworth.brad@gmail.com>
2025-02-07 16:20:35 +00:00
Blake Pettersson
922dd771e3 fix(appset): improve git generator repo credential fallback (#21167)
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
2025-02-07 10:22:39 -05:00
teddy-wahle
4a1d0f3af5 fix: Switch default logging to JSON (issue: 20897) (#21656)
Signed-off-by: Teddy Wahle <teddy.wahle@verkada.com>
2025-02-06 18:32:26 +00:00
OpenGuidou
d1574c204f fix(rbac): Add rights on applicationsets for the application controller (#20352)
Signed-off-by: OpenGuidou <guillaume.doussin@gmail.com>
2025-02-06 12:10:11 -05:00
wanghonglei5181
4dcabb933e fix: Fix link about http middlewear and add adopter hetao101 (#21802)
Signed-off-by: wanghonglei5181 <wanghonglei5181@163.com>
2025-02-06 03:00:33 -07:00
Anand Francis Joseph
fa747f987c fix(tests): Improved the e2e tests for app sync with impersonation feature (#21792)
Signed-off-by: anandf <anjoseph@redhat.com>
2025-02-05 21:37:48 -05:00
Peter Jiang
71c7700f2e fix(ui): Show error message when max pods to view logs are reached (#21725)
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
2025-02-05 21:36:05 -05:00
dependabot[bot]
7efd2fe2eb chore(deps): bump library/golang from 1.23.5 to 1.23.6 in /test/container (#21774)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-05 21:27:35 -05:00
Peter Jiang
43822815f7 fix(docs): Fix syntax in e2e test docs (#21796)
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
2025-02-05 21:03:25 -05:00
Leonardo Luz Almeida
911a9c6776 fix: Add proxy registry key by dest server + name (#21791)
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
2025-02-05 14:47:24 -05:00
dependabot[bot]
73c3935031 chore(deps): bump golang.org/x/term from 0.28.0 to 0.29.0 (#21776)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-05 19:43:51 +00:00
dependabot[bot]
4641e802a4 chore(deps): bump golang.org/x/oauth2 from 0.25.0 to 0.26.0 (#21777)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-05 19:05:31 +00:00
dependabot[bot]
4b087089fb chore(deps): bump golang.org/x/sync from 0.10.0 to 0.11.0 (#21778)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-05 13:18:03 -05:00
dependabot[bot]
7d0c10e0d2 chore(deps): bump golang.org/x/time from 0.9.0 to 0.10.0 (#21779)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-05 13:17:42 -05:00
Matthieu MOREL
9843bfbdf8 chore: use testify instead of native testing (#21781)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-02-05 09:46:52 -05:00
Michael Crenshaw
5d147a3ae6 chore(appset)!: always apply nested selectors (#14152) (#21492)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-02-04 19:55:01 +00:00
rumstead
68d60cd092 fix(docs): update mkdocs for upgrade guide (#21768)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-02-04 18:55:14 +00:00
Ashu
99cd3c7650 fix(cli): add flags to admin import for retrying updates on conflicts and skipping resources with specific labels. (#21694)
Signed-off-by: asingh51 <ashutosh_singh@intuit.com>
Co-authored-by: asingh51 <ashutosh_singh@intuit.com>
2025-02-04 06:17:06 +00:00
rumstead
622847bcb5 docs(2.14): use 2.14.1 manifests as remote bases (#21759)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-02-03 21:37:23 +00:00
rumstead
ad09b9c744 fix(docs): 2.14 upgrading docs (#21756) 2025-02-03 23:08:19 +02:00
Michael Crenshaw
47bec8b438 chore!: remove legacy repo support (#19768) (#21249)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-02-03 20:15:15 +00:00
github-actions[bot]
95b8a4ab0b [Bot] docs: Update Snyk report (#21733)
Signed-off-by: CI <ci@argoproj.com>
Co-authored-by: CI <ci@argoproj.com>
2025-02-03 13:19:52 -05:00
Michael Crenshaw
c32afb4ee2 docs: endorse secrets operators, caution against plugins (#21629) (#21631)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-02-03 12:18:00 -05:00
adriananeci
c9c40684b7 feat: add AND operator opt-in option for sync windows matches (#16846)
Signed-off-by: Adrian Aneci <aneci@adobe.com>
2025-02-03 16:48:18 +00:00
rumstead
9a3cfcb71d docs(2.14): adding basic upgrading docs for 2.14 (#21744)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-02-03 18:31:21 +02:00
dependabot[bot]
1b1735f5f0 chore(deps): bump github.com/golang/glog from 1.2.2 to 1.2.4 (#21693)
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-02-03 16:22:01 +00:00
Amit Oren
854c62fc70 fix(ui): Solve issue with navigating with dropdown from an application's page (#21737)
Signed-off-by: Amit Oren <amit@coralogix.com>
2025-02-03 11:04:44 -05:00
dependabot[bot]
b4753d8d00 chore(deps): bump google.golang.org/grpc from 1.69.4 to 1.70.0 (#21657)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-03 09:58:01 -05:00
dependabot[bot]
1d47e1c7eb chore(deps): bump github.com/Azure/azure-sdk-for-go/sdk/azidentity from 1.8.0 to 1.8.1 (#21566)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2025-02-03 09:56:19 -05:00
rumstead
88e43cb730 feat(kubectl): upgrading kubectl to 1.32.1 (#21724)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-02-03 09:37:28 -05:00
Regina Voloshin
045a027753 chore: reggie-k as release champion for 3.0 (#21736)
Signed-off-by: reggie-k <regina.voloshin@codefresh.io>
2025-02-03 09:21:57 -05:00
Alexandre Gaudreault
b4a63aeba8 fix(dex): always request federated:id scope (#17908) (#21726)
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-01-31 17:12:59 +00:00
dependabot[bot]
b17c5e4e2a chore(deps): bump github.com/spf13/pflag from 1.0.5 to 1.0.6 (#21717)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-31 11:16:26 -05:00
rumstead
7edaef54d4 feat(helm): upgrading helm to 3.17.0 (#21722)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-01-31 10:54:51 -05:00
Atif Ali
85c6d267ba fix: override sub with federated_claims.user_id when dex is used (#20683)
Signed-off-by: Atif Ali <atali@redhat.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-01-30 10:06:36 -05:00
Jean Morais
40d86e7b18 docs: fix broken link in notifications overview (#21684)
Signed-off-by: Jean Morais <jeancdemorais@gmail.com>
2025-01-30 09:05:08 -05:00
Siddhesh Ghadi
6f5537bdf1 Merge commit from fork
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
2025-01-29 13:41:18 -05:00
Florian Blampey
e4311d8309 feat: add name and labels in cluster metrics (#17870) (#18453)
Signed-off-by: flbla <flbla@users.noreply.github.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-01-29 18:06:29 +00:00
Alexandre Gaudreault
e147247aaf ci: disable nolintlint linter (#21707)
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-01-29 17:10:17 +00:00
dependabot[bot]
b9f49df757 chore(deps): bump github.com/evanphx/json-patch from 5.9.0+incompatible to 5.9.11+incompatible (#21699)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-29 11:32:36 -05:00
dependabot[bot]
eb8f05a9fd chore(deps): bump github.com/cyphar/filepath-securejoin from 0.4.0 to 0.4.1 (#21700)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-29 11:32:06 -05:00
Michael Crenshaw
4e08b8dee6 chore(metrics)!: remove deprecated metrics (#21697)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-01-29 00:02:00 -05:00
dependabot[bot]
7333c75327 chore(deps): bump google.golang.org/protobuf from 1.36.3 to 1.36.4 (#21676)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-28 21:44:34 -05:00
dependabot[bot]
5e5ec1b021 chore(deps): bump github.com/bmatcuk/doublestar/v4 from 4.8.0 to 4.8.1 (#21677)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-28 21:44:13 -05:00
Keith Chong
e8a3f7aa33 fix: Update argo-ui dependency to pull in OCI icon (#18646) (#21698)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2025-01-28 21:42:33 -05:00
Jagpreet Singh Tamber
ecb9dbac42 feat: add support for azure workload identity in Microsoft Entra SSO (#21433)
Signed-off-by: Jagpreet Singh Tamber <jagpreetstamber@gmail.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-01-29 00:00:43 +00:00
maoqide
1698370363 feat: replace spdy with websocket for portforward and pod exec #21517 (#21518)
Signed-off-by: xinmei.mao <xinmei.mao@tuya.com>
Co-authored-by: xinmei.mao <xinmei.mao@tuya.com>
2025-01-28 10:09:29 -05:00
Julie Vogelman
e3bcc48bf2 chore: updates to Numaplane health checks (#21671)
Signed-off-by: Julie Vogelman <julievogelman0@gmail.com>
2025-01-27 10:29:44 -05:00
Rafal
544aea18c3 fix(ui): Cannot add an app that has both name and server destination (#21440)
Signed-off-by: Rafal Pelczar <rafal@akuity.io>
2025-01-24 16:58:00 -05:00
dependabot[bot]
75def4f2df chore(deps-dev): bump @types/node from 22.10.8 to 22.10.10 in /ui-test (#21658)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-24 08:28:45 -05:00
Regina Voloshin
c7e02eefdd fix: make test fails with exec format error (#21630)
Signed-off-by: reggie-k <regina.voloshin@codefresh.io>
2025-01-24 08:16:35 -05:00
Michael Crenshaw
bd9923fd75 chore(repo-server): simplify Kustomize/Helm version detection (#21540)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-01-24 08:15:02 -05:00
dependabot[bot]
bcf2143dfe chore(deps): bump github.com/go-git/go-git/v5 from 5.13.1 to 5.13.2 (#21641) 2025-01-23 06:12:44 -05:00
dependabot[bot]
770664411a chore(deps-dev): bump @types/node from 22.10.7 to 22.10.8 in /ui-test (#21644) 2025-01-23 06:12:14 -05:00
dependabot[bot]
cdb7995693 chore(deps): bump chromedriver from 132.0.0 to 132.0.1 in /ui-test (#21646) 2025-01-23 06:11:42 -05:00
Michael Crenshaw
3593f24491 chore: mark with-hydrator manifests as generated (#21639)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-01-22 21:59:09 +00:00
Matthieu MOREL
24893ad5e9 chore: enable several rules from revive (#21638)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-22 21:32:09 +00:00
Matthieu MOREL
bf082c26c2 chore: enable ifElseChain from gocritic (#21636)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-22 16:13:51 -05:00
Alexandre Gaudreault
8f285a5dd4 fix(in-cluster): do not allow the cluster to be used when disabled (#21208)
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-01-22 20:36:05 +00:00
Matthieu MOREL
35a174b956 chore: enable badCond from gocritic (#21632)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-22 18:25:33 +00:00
Alexandre Gaudreault
85684a8919 fix(cli): application cannot be refreshed when invalid and hangs (#21615)
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-01-22 11:39:55 -05:00
Matthieu MOREL
27915da5b0 chore: enable singleCaseSwitch and commentFormatting rules from gocritic (#21616)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-22 10:45:32 -05:00
github-actions[bot]
2cfaab335f [Bot] docs: Update Snyk report (#21558)
Signed-off-by: CI <ci@argoproj.com>
Co-authored-by: CI <ci@argoproj.com>
2025-01-22 09:22:28 +02:00
almoelda
f9ffb6ae35 feat: Added env reference objects to manifests for otlp.attrs (#21563)
Signed-off-by: Almo Elda <almogldbh@gmail.com>
2025-01-22 09:16:06 +02:00
Chris Adkins
91cb693164 chore: action docker warnings (#21556)
Signed-off-by: Christopher J. Adkins <chris@cjadkins.com>
2025-01-22 09:15:44 +02:00
Matthieu MOREL
5ef4faa8a4 chore: enable nolintlint (#21559)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-21 13:49:14 -05:00
Jacob Colvin
f258c450b8 feat: add ARGOCD_APP_PROJECT_NAME to the build environment (#15185) (#21586)
Signed-off-by: Jacob Colvin <jacobcolvin1@gmail.com>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
2025-01-21 13:16:40 -05:00
Alexander Matyushentsev
eed70eed6e fix: login return_url doesn't work with custom server paths (#21588)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2025-01-21 09:22:50 -08:00
Prune Sebastien THOMAS
55aab6efb6 fix(appset): reverted Gitlab SCM HasPath search and consider 404 errors as file not found (#16253) (#21597)
Signed-off-by: Prune <prune@lecentre.net>
2025-01-21 17:08:59 +00:00
Laurent Lavaud
9b91454968 chore: cleanup diff-cache testdata (#21600)
Signed-off-by: Laurent Lavaud <laurent.lavaud@mirakl.com>
2025-01-21 17:08:46 +00:00
Michael Crenshaw
9429275a91 fix(hydrator): UI nil checks (#21598)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-01-21 16:51:03 +00:00
Michele Baldessari
ed3cc48847 fix: Policy/policy.open-cluster-management.io stuck in progressing status when no clusters match the policy (#21296) (#21297)
Signed-off-by: Michele Baldessari <michele@acksyn.org>
2025-01-21 08:19:35 -05:00
Revital Barletz
87539aa558 docs: Surface blog with (actual) release notes better (#21572)
Signed-off-by: Revital Barletz <revitalbarletz@gmail.com>
2025-01-21 02:32:30 -10:00
Shun Nishitsuji
c687247ce8 docs: Add LY Corporation to list of users (#21592)
Signed-off-by: asuforce <owata.sn@gmail.com>
2025-01-21 02:19:32 -10:00
Regina Voloshin
6f38327647 fix: resolve the failing e2e appset tests for ksonnet applications (#21580)
Signed-off-by: reggie-k <regina.voloshin@codefresh.io>
2025-01-21 03:01:28 +00:00
Michael Crenshaw
e3caebae56 docs(hydrator): document signature verification limitation (#21504)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-01-20 20:19:06 -05:00
Revital Barletz
7ba7fc028e docs: Auto Sync toggle does not work for Applications created with an ApplicationSet (#21577)
Signed-off-by: Revital Barletz <revitalbarletz@gmail.com>
Co-authored-by: Regina Voloshin <reginakagan@gmail.com>
2025-01-20 16:22:04 +01:00
Afzal Ansari
1a56ea7417 docs: remove branch var outdated from the cluster param (#21549)
Signed-off-by: Afzal Ansari <afzal442@gmail.com>
2025-01-20 10:15:48 -05:00
Tobias Lindberg
9fd6beea7f docs: add statusbadge.url override information (#21529)
Signed-off-by: Tobias Lindberg <tobias.ehlert@gmail.com>
2025-01-20 10:06:14 -05:00
dependabot[bot]
3a29a745a3 chore(deps-dev): bump @types/node from 22.10.6 to 22.10.7 in /ui-test (#21511)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-18 21:56:45 +02:00
Matt Finkel
606bd5b043 feat(rbac)!: disable fine-grained inheritance by default (#19988) (#20671)
---------

Signed-off-by: Matt Finkel <finkel.matt@gmail.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-01-17 20:20:40 +00:00
Jagpreet Singh Tamber
89c4817213 feat: Add support for Azure workload identity for Git and OCI repositories. (#21118)
---------

Signed-off-by: Jagpreet Singh Tamber <jagpreetstamber@gmail.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-01-17 12:33:36 -05:00
Thomas Mueller
c93924b3cc fix: Wait for Subscription resources to reach AtLatestKnown (#21425)
If using the sync waves annotations currently ArgoCD does not wait
for the Subscription to be fully installed. Root cause is that
the first update that includes `.status` doesn't include the information
that the installation is still pending.

To be able to wait for the operator to be installed, the `.status.state`
can be checked.

Signed-off-by: Thomas Müller <thomas@chaschperli.ch>
2025-01-17 11:27:18 -05:00
rumstead
f3509d2f8a fix(appset): dont requeue appsets on status change (#21364)
* e2e

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* fix(appset): don't requeue on status changes

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* fix spelling

Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* merge in annotation changes

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* merge in annotation changes

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* add more tests

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* lint fix

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* Update applicationset/controllers/applicationset_controller.go

Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* fix linting

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

* fix linting

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>

---------

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2025-01-17 11:03:49 -05:00
almoelda
3e09f946f4 feat: resource customization for CustomResourceDefinition (#21416)
Signed-off-by: Almo Elda <almogldbh@gmail.com>
2025-01-17 11:02:13 -05:00
Marco Franssen
d765aabc1f chore: Upgrade ubuntu base image to latest 24.04 digest (#21524)
```shell
$ crane digest docker.io/library/ubuntu:24.04
sha256:80dd3c3b9c6cecb9f1667e9290b3bc61b78c2678c02cbdae5f0fea92cc6734ab
```

Signed-off-by: Marco Franssen <marco.franssen@gmail.com>
2025-01-17 10:50:41 -05:00
Regina Voloshin
070287cecc docs: update contributors guide with repo clone and make targets (#21473)
---------

Signed-off-by: reggie-k <regina.voloshin@codefresh.io>
Signed-off-by: Regina Voloshin <regina.voloshin@codefresh.io>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-01-17 15:31:58 +00:00
dependabot[bot]
d4d671316f chore(deps): bump google.golang.org/protobuf from 1.36.2 to 1.36.3 (#21513)
Bumps google.golang.org/protobuf from 1.36.2 to 1.36.3.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-17 09:22:25 -05:00
dependabot[bot]
dbf9393365 chore(deps): bump library/golang in /test/container (#21533)
Bumps library/golang from 1.23.4 to 1.23.5.

---
updated-dependencies:
- dependency-name: library/golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-17 09:21:08 -05:00
dependabot[bot]
780285b86e chore(deps): bump library/golang from 1.23.4 to 1.23.5 in /test/remote (#21535)
Bumps library/golang from 1.23.4 to 1.23.5.

---
updated-dependencies:
- dependency-name: library/golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-17 09:17:28 -05:00
rumstead
11b866578f fix: remove kustomize binary from git (#21526) 2025-01-16 15:58:52 +02:00
Adam Buran
9b17495bc2 chore: update go-github to use token (#21292)
* minor change to use WithAuthToken

Signed-off-by: aburan28@gmail.com <aburan28@gmail.com>

* minor change to use WithAuthToken

Signed-off-by: aburan28@gmail.com <aburan28@gmail.com>

* Update applicationset/services/scm_provider/github.go

Co-authored-by: Nitish Kumar <justnitish06@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>

* remove ctx from NewGithubProvider

Signed-off-by: aburan28 <aburan28@gmail.com>

* remove ctx from NewGithubProvider

Signed-off-by: aburan28 <aburan28@gmail.com>

* remove unused parameter

Signed-off-by: aburan28 <aburan28@gmail.com>

* update readthedogs.yml to allow for builds

Signed-off-by: aburan28 <aburan28@gmail.com>

---------

Signed-off-by: aburan28@gmail.com <aburan28@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>
Signed-off-by: aburan28 <aburan28@gmail.com>
Co-authored-by: Nitish Kumar <justnitish06@gmail.com>
2025-01-16 00:46:03 -05:00
Xiaonan Shen
f548fd7a24 fix: correctly set compareWith when requesting app refresh with delay (fixes #18998) (#21298)
* fix: correctly set compareWith when requesting app refresh with delay

Signed-off-by: Xiaonan Shen <s@sxn.dev>

* test: add UT

Signed-off-by: Xiaonan Shen <s@sxn.dev>

---------

Signed-off-by: Xiaonan Shen <s@sxn.dev>
Co-authored-by: 沈啸楠 <sxn@shenxiaonandeMacBook-Pro.local>
2025-01-16 00:42:25 -05:00
Suraj yadav
1ce0123fa5 fix(ui): Group Nodes breaks Kinds counts / views (#21337)
* groupview-filter-fix

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

* count-logic-change

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

* lint-fixes

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

---------

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>
2025-01-16 00:41:42 -05:00
Amit Oren
3f0a1552e6 Fix application url for custom base href (#21377)
Signed-off-by: Amit Oren <amit@coralogix.com>
2025-01-16 00:37:07 -05:00
dependabot[bot]
742d45a1f5 chore(deps): bump chromedriver from 131.0.5 to 132.0.0 in /ui-test (#21512)
Bumps [chromedriver](https://github.com/giggio/node-chromedriver) from 131.0.5 to 132.0.0.
- [Commits](https://github.com/giggio/node-chromedriver/compare/131.0.5...132.0.0)

---
updated-dependencies:
- dependency-name: chromedriver
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-16 00:22:58 -05:00
dependabot[bot]
219444313a chore(deps): bump github.com/aws/aws-sdk-go from 1.55.5 to 1.55.6 (#21514)
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.55.5 to 1.55.6.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG_PENDING.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.55.5...v1.55.6)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-16 00:22:37 -05:00
dependabot[bot]
901139795d chore(deps): bump library/redis in /test/container (#21494) 2025-01-15 23:49:24 -05:00
Prune Sebastien THOMAS
37a7231bd3 fix(appset): update gitlab SCM provider to search on parent folder (#16253) (#21491)
* (fix:appset) update gitlab SCM provider to search on parent folder

fix https://github.com/argoproj/argo-cd/issues/16253

Signed-off-by: Prune <prune@lecentre.net>

* adding test-case that replicated the new Gitlab API behaviour

Signed-off-by: Prune <prune@lecentre.net>

* add comments to the case

Signed-off-by: Prune <prune@lecentre.net>

---------

Signed-off-by: Prune <prune@lecentre.net>
2025-01-15 13:18:32 -05:00
dependabot[bot]
9a02f9bc2e chore(deps): bump google.golang.org/grpc from 1.69.2 to 1.69.4 (#21485)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.69.2 to 1.69.4.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.69.2...v1.69.4)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-15 12:57:19 -05:00
Eadred
e852142fb9 fix(appset): events not honouring configured namespaces (#21219) (#21241)
* fix: 21219 Honour ARGOCD_APPLICATIONSET_CONTROLLER_NAMESPACES for all ApplicationSet events

Namespace filtering is applied to Update, Delete and Generic events.

Fixes https://github.com/argoproj/argo-cd/issues/21219

Signed-off-by: eadred <eadred77@googlemail.com>

* fix: 21219 Add tests for ignoreNotAllowedNamespaces

Signed-off-by: eadred <eadred77@googlemail.com>

* fix: 21219 Remove redundant package import

Signed-off-by: eadred <eadred77@googlemail.com>

---------

Signed-off-by: eadred <eadred77@googlemail.com>
2025-01-15 11:35:49 -05:00
Linghao Su
922c9e9ccc feat(ui): support filter repo when input (#21451)
Signed-off-by: linghaoSu <linghao.su@daocloud.io>
2025-01-15 09:55:01 -05:00
Suraj yadav
72962014b5 feat(ui): Added link to start page in argo logo (#21461)
Signed-off-by: Surajyadav <harrypotter1108@gmail.com>
2025-01-14 21:11:40 +00:00
Michael Crenshaw
d23e6ac79b feat: configurable log timestamp format (#21478)
* feat: configurable log timestamp format

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* lint

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-01-14 16:10:14 +00:00
dependabot[bot]
9a51757049 chore(deps): bump github.com/cyphar/filepath-securejoin from 0.3.6 to 0.4.0 (#21484)
* chore(deps): bump github.com/cyphar/filepath-securejoin

Bumps [github.com/cyphar/filepath-securejoin](https://github.com/cyphar/filepath-securejoin) from 0.3.6 to 0.4.0.
- [Release notes](https://github.com/cyphar/filepath-securejoin/releases)
- [Changelog](https://github.com/cyphar/filepath-securejoin/blob/main/CHANGELOG.md)
- [Commits](https://github.com/cyphar/filepath-securejoin/compare/v0.3.6...v0.4.0)

---
updated-dependencies:
- dependency-name: github.com/cyphar/filepath-securejoin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* match new signature

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-01-14 10:41:32 -05:00
dependabot[bot]
c3600d240a chore(deps): bump chromedriver from 131.0.4 to 131.0.5 in /ui-test (#21415)
Bumps [chromedriver](https://github.com/giggio/node-chromedriver) from 131.0.4 to 131.0.5.
- [Commits](https://github.com/giggio/node-chromedriver/compare/131.0.4...131.0.5)

---
updated-dependencies:
- dependency-name: chromedriver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-14 07:37:06 -05:00
dependabot[bot]
b77d9d9f5f chore(deps-dev): bump typescript from 5.7.2 to 5.7.3 in /ui-test (#21443)
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.7.2 to 5.7.3.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.7.2...v5.7.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-14 07:16:41 -05:00
dependabot[bot]
2f579404f6 chore(deps-dev): bump @types/node from 22.10.5 to 22.10.6 in /ui-test (#21482)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.10.5 to 22.10.6.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-14 07:12:38 -05:00
dependabot[bot]
5d84eb4ff3 chore(deps): bump github.com/bmatcuk/doublestar/v4 from 4.7.1 to 4.8.0 (#21483)
Bumps [github.com/bmatcuk/doublestar/v4](https://github.com/bmatcuk/doublestar) from 4.7.1 to 4.8.0.
- [Release notes](https://github.com/bmatcuk/doublestar/releases)
- [Commits](https://github.com/bmatcuk/doublestar/compare/v4.7.1...v4.8.0)

---
updated-dependencies:
- dependency-name: github.com/bmatcuk/doublestar/v4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-14 07:12:11 -05:00
dependabot[bot]
d3dda53cf6 chore(deps): bump library/busybox in /test/e2e/multiarch-container (#21486)
Bumps library/busybox from `2919d01` to `a5d0ce4`.

---
updated-dependencies:
- dependency-name: library/busybox
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-14 07:11:29 -05:00
Amin Arefzadeh
613d06d0b1 fix(cli): use correct CA when adding kube-public clusters (#21326) (#21327)
Signed-off-by: Amin Arefzadeh <aminarefzadeh1376@gmail.com>
2025-01-13 19:07:45 -05:00
github-actions[bot]
ced84418d3 [Bot] docs: Update Snyk reports (#21459)
Signed-off-by: CI <ci@argoproj.com>
Co-authored-by: CI <ci@argoproj.com>
2025-01-13 13:19:44 -05:00
Michael Crenshaw
bd37458896 chore(refactor): remove app destination inferrence logic (#21189)
* refactor: remove app destination inferrence logic

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* simplify

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* more fixes

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* more fixes

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* codegen

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix mocks

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* simplify

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* clusters all the way down

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* simplify

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* test

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* lint

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* tidy

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* be less radical

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-01-13 13:15:42 -05:00
Daco
f6a84a470d fix(appset): Reconcile appset only once when appset is refreshed (fix 21171) (#21172)
Signed-off-by: Philippe Da Costa <pdacosta@gmail.com>
2025-01-13 10:46:41 -05:00
Michael Crenshaw
dbdc1e737a feat: use log format config for klog (#5715) (#21458)
* feat: use log format config for klog (#5715)

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* use init, remove test line

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* sort imports

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix comment

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-01-13 10:46:07 -05:00
Michael Crenshaw
fdf9a305b3 docs: 3.0 upgrade guide (#21457)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-01-13 10:45:52 -05:00
dependabot[bot]
5207508871 chore(deps): bump code.gitea.io/sdk/gitea from 0.19.0 to 0.20.0 (#21464)
Bumps code.gitea.io/sdk/gitea from 0.19.0 to 0.20.0.

---
updated-dependencies:
- dependency-name: code.gitea.io/sdk/gitea
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-13 09:33:27 -05:00
Regina Voloshin
2d10d4e785 docs: add mkdocs configuration stanza to .readthedocs.yaml (#21475)
Signed-off-by: reggie-k <regina.voloshin@codefresh.io>
2025-01-13 09:30:46 -05:00
github-actions[bot]
4d9835927d Bump major version to 3 (#21410)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
2025-01-10 16:14:00 -05:00
lrost
1645d576fd docs: add wildcard globbing example to docs (#21429)
* add wildcard globbing example

After searching for wildcard globbing, i could only find the following PR : https://github.com/argoproj/argo-cd/pull/1106. Now the docs have an example

Signed-off-by: lrost <luukrost@gmail.com>

* Update project.yaml

feedback

Signed-off-by: lrost <luukrost@gmail.com>

---------

Signed-off-by: lrost <luukrost@gmail.com>
2025-01-09 22:07:52 -10:00
Nitish Kumar
77ff8f0dd4 docs: add missing word (#21428)
Signed-off-by: nitishfy <justnitish06@gmail.com>
2025-01-09 22:02:32 -10:00
Atif Ali
b8508f2916 feat(ui): rename filter message status on SYNC STATUS view (#21061)
* rename filter message status

Signed-off-by: Atif Ali <atali@redhat.com>

* capitalize for cosistency with other filters

Signed-off-by: Atif Ali <atali@redhat.com>

* added tooltip for message filter

Signed-off-by: Atif Ali <atali@redhat.com>

* lint fix

Signed-off-by: Atif Ali <atali@redhat.com>

* Trigger workflow tests

Signed-off-by: Atif Ali <atali@redhat.com>

---------

Signed-off-by: Atif Ali <atali@redhat.com>
2025-01-08 17:17:27 -05:00
Atif Ali
6d27928965 feat(ui): highlight log lines by pod name (#21001)
* adding background colors for different pods

Signed-off-by: Atif Ali <atali@redhat.com>

* fix lint error

Signed-off-by: Atif Ali <atali@redhat.com>

* fix lint error new

Signed-off-by: Atif Ali <atali@redhat.com>

* resolved issues

Signed-off-by: Atif Ali <atali@redhat.com>

* color name and provide different backround only for selected pod

Signed-off-by: Atif Ali <atali@redhat.com>

* remove pod legend and make pod names clickable on the logs

Signed-off-by: Atif Ali <atali@redhat.com>

* added dropdown to select pods

Signed-off-by: Atif Ali <atali@redhat.com>

* use a marker icon instead to show the dropdown

Signed-off-by: Atif Ali <atali@redhat.com>

* incoorperate darkmode for dropdown

Signed-off-by: Atif Ali <atali@redhat.com>

* Trigger workflow tests

Signed-off-by: Atif Ali <atali@redhat.com>

---------

Signed-off-by: Atif Ali <atali@redhat.com>
2025-01-08 16:52:17 -05:00
Matthieu MOREL
6c45721730 chore: enable early-return from revive (#21423)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-08 15:26:02 -05:00
dependabot[bot]
2a497ef1fd chore(deps): bump google.golang.org/protobuf from 1.36.1 to 1.36.2 (#21412)
Bumps google.golang.org/protobuf from 1.36.1 to 1.36.2.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-08 10:27:29 -05:00
dependabot[bot]
871ed62000 chore(deps): bump sigs.k8s.io/controller-runtime from 0.19.3 to 0.19.4 (#21411)
Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.19.3 to 0.19.4.
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.19.3...v0.19.4)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-08 10:26:47 -05:00
Michael Crenshaw
1a9f22625d fix(controller): rename cluster batch param and add to argocd-cmd-params-cm (#21402)
* fix(controller): rename cluster batch param and add to argocd-cmd-params-cm

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* parameterize deployment too

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* consistency

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-01-08 07:34:29 -05:00
Michael Crenshaw
06bd2ad10f fix(ci): all version bump changes go in the PR (#21409)
* chore(ci): fix version bump codegen

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* link, not copy

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* make directory

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* maybe backwards

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* what's up

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* what's up

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* what's up

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* I give up

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* remove silliness

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* somehow

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* frustration

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* who knows

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* oops

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-01-07 22:46:31 +00:00
rumstead
05c76253f0 fix(ci): updating action-gh-release after upstream fix (#21407)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-01-07 21:39:14 +00:00
dependabot[bot]
fe8bab0406 chore(deps): bump library/redis from 7.4.1 to 7.4.2 in /test/container (#21395)
Bumps library/redis from 7.4.1 to 7.4.2.

---
updated-dependencies:
- dependency-name: library/redis
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-07 14:41:26 -05:00
Michael Crenshaw
77ad48aa09 chore(ci): run codegen as part of version bump job (#21404)
* chore(ci): run codegen as part of version bump

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* preserve go.mod changes

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* more logging

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* add more excluded paths

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* git status

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* more debugging

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* maybe

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* remove debugging stuff

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-01-07 19:38:51 +00:00
renovate[bot]
4fee6b51e0 chore(deps): update dependency pymdown-extensions to v10.14 (#21403)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-07 13:42:44 -05:00
dependabot[bot]
a807c0eb69 chore(deps): bump golang.org/x/net from 0.33.0 to 0.34.0 (#21396)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.33.0 to 0.34.0.
- [Commits](https://github.com/golang/net/compare/v0.33.0...v0.34.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2025-01-07 16:24:51 +00:00
Matthieu MOREL
947a7b84d7 chore: enable indent-error-flow from revive (#21394)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-07 10:25:22 -05:00
Matthieu MOREL
53bc19b5f2 chore: enable unused-parameter from revive (#21365)
* chore: enable unused-parameter from revive

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* apply recommandations

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

---------

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-07 10:12:56 -05:00
Matthieu MOREL
b04a7c101d chore: enable context-as-argument from revive (#21371)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-07 10:08:51 -05:00
Matthieu MOREL
50c49ec8f9 chore: enable unnecessary-stmt from revive (#21398)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-07 09:56:38 -05:00
nmirasch
f39b425fac fix: CVE-2024-21538 upgrading the indirect dep cross-spawn to greater than 7.0.5 (#21259)
* fix: CVE-2024-21538 upgrading the indirect dep cross-spawn to greater than 7.0.5

Signed-off-by: nmirasch <neus.miras@gmail.com>

* rebasing

Signed-off-by: nmirasch <neus.miras@gmail.com>

---------

Signed-off-by: nmirasch <neus.miras@gmail.com>
2025-01-07 09:52:35 -05:00
dependabot[bot]
cce74a33e1 chore(deps): bump golang.org/x/crypto from 0.31.0 to 0.32.0 (#21397)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.31.0 to 0.32.0.
- [Commits](https://github.com/golang/crypto/compare/v0.31.0...v0.32.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-07 09:49:51 -05:00
Matthieu MOREL
c739478b8b chore: enable receiver-naming from revive (#21372)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-06 14:45:11 -05:00
dependabot[bot]
76d28b50dd chore(deps): bump golang.org/x/time from 0.8.0 to 0.9.0 (#21385)
Bumps [golang.org/x/time](https://github.com/golang/time) from 0.8.0 to 0.9.0.
- [Commits](https://github.com/golang/time/compare/v0.8.0...v0.9.0)

---
updated-dependencies:
- dependency-name: golang.org/x/time
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-06 14:28:17 -05:00
Michael Crenshaw
43d2a3d937 fix(ci): proto references bump (#21391)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-01-06 19:09:00 +00:00
github-actions[bot]
b4912cf340 [Bot] docs: Update Snyk reports (#21376)
Signed-off-by: CI <ci@argoproj.com>
Co-authored-by: CI <ci@argoproj.com>
2025-01-06 13:45:59 -05:00
renovate[bot]
9cc52247c4 chore(deps): update dependency pygments to v2.19.1 (#21392)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-06 13:45:26 -05:00
Matthieu MOREL
cb3024c5ff chore: enable superfluous-else from revive (#21373)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-06 11:41:38 -05:00
renovate[bot]
10293889b7 chore(deps): update dependency pygments to v2.19.0 (#21379)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-06 11:39:44 -05:00
Matthieu MOREL
c80325737e chore: enable duplicated-imports from revive (#21378)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-06 11:34:32 -05:00
dependabot[bot]
0c1d218d88 chore(deps): bump golang.org/x/oauth2 from 0.24.0 to 0.25.0 (#21384)
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.24.0 to 0.25.0.
- [Commits](https://github.com/golang/oauth2/compare/v0.24.0...v0.25.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-06 11:31:40 -05:00
Matthieu MOREL
9f0dc9402f chore: enable redundant-import-alias from revive (#21386)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-06 11:30:42 -05:00
dependabot[bot]
41dec01c7c chore(deps-dev): bump @types/node from 22.10.2 to 22.10.5 in /ui-test (#21381)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.10.2 to 22.10.5.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-06 09:56:26 -05:00
dependabot[bot]
38ad4f4653 chore(deps): bump golang.org/x/term from 0.27.0 to 0.28.0 (#21382)
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.27.0 to 0.28.0.
- [Commits](https://github.com/golang/term/compare/v0.27.0...v0.28.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-06 09:25:17 -05:00
Keith Chong
1bf2ab5dc0 test: Update ui test to fix logic for headless mode, add logs (#21361) (#21362)
Signed-off-by: Keith Chong <kykchong@redhat.com>
2025-01-06 09:24:42 -05:00
dependabot[bot]
b3e31ed1f4 chore(deps): bump github.com/coreos/go-oidc/v3 from 3.11.0 to 3.12.0 (#21383)
Bumps [github.com/coreos/go-oidc/v3](https://github.com/coreos/go-oidc) from 3.11.0 to 3.12.0.
- [Release notes](https://github.com/coreos/go-oidc/releases)
- [Commits](https://github.com/coreos/go-oidc/compare/v3.11.0...v3.12.0)

---
updated-dependencies:
- dependency-name: github.com/coreos/go-oidc/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-06 09:22:59 -05:00
Matthieu MOREL
e66068c11b chore: enable var-declaration from revive (#21370)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-03 18:44:23 -05:00
Matthieu MOREL
4e5db16fbf chore: enable increment-decrement from revive (#21366)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-03 22:45:03 +00:00
renovate[bot]
8245cd90b3 chore(deps): update module github.com/golangci/golangci-lint to v1.63.4 (#21368)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-03 22:40:05 +00:00
Michael Crenshaw
acb47b418c chore: add script to bump major version (#21363)
* chore: add script to bump major version

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* add workflow to automatically bump the version

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* better PR

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* use new output mechanism

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix incorrect message

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-01-03 16:51:31 -05:00
Matthieu MOREL
5508d1feda chore: enable importas for k8s.io/apimachinery/pkg/api/errors (#21262)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-03 17:09:37 +00:00
Matthieu MOREL
ef55ba549b chore: use dario.cat/mergo instead of github.com/imdario/mergo (#21274)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-03 11:10:24 -05:00
Matthieu MOREL
ceb758c877 chore: import k8s.io/api/core/v1 as corev1 (#21345)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-03 11:10:00 -05:00
dependabot[bot]
4723abd0b4 chore(deps): bump github.com/bradleyfalzon/ghinstallation/v2 (#21353)
Bumps [github.com/bradleyfalzon/ghinstallation/v2](https://github.com/bradleyfalzon/ghinstallation) from 2.12.0 to 2.13.0.
- [Release notes](https://github.com/bradleyfalzon/ghinstallation/releases)
- [Commits](https://github.com/bradleyfalzon/ghinstallation/compare/v2.12.0...v2.13.0)

---
updated-dependencies:
- dependency-name: github.com/bradleyfalzon/ghinstallation/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-03 11:05:35 -05:00
dependabot[bot]
8200e3d315 chore(deps): bump github.com/go-git/go-git/v5 from 5.13.0 to 5.13.1 (#21352)
Bumps [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) from 5.13.0 to 5.13.1.
- [Release notes](https://github.com/go-git/go-git/releases)
- [Commits](https://github.com/go-git/go-git/compare/v5.13.0...v5.13.1)

---
updated-dependencies:
- dependency-name: github.com/go-git/go-git/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-03 11:05:07 -05:00
Matthieu MOREL
13235ad477 chore: use testify instead of testing.Fatal (#21258)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-02 18:27:41 -05:00
Matthieu MOREL
9ea979bbcd chore: enable use-any from revive (#21282)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-02 18:26:59 -05:00
Matthieu MOREL
6087b4f903 chore: use github.com/golang-jwt/jwt/v5 (#21276)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-01-02 18:23:28 -05:00
renovate[bot]
33f2a6fea1 chore(deps): update module github.com/golangci/golangci-lint to v1.63.3 (#21348)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-02 22:09:59 +00:00
Amin Arefzadeh
b6770bdb79 chore: Add divar.ir to USERS.md (#21344)
Signed-off-by: Amin Arefzadeh <aminarefzadeh1376@gmail.com>
2025-01-02 16:33:26 -05:00
renovate[bot]
065fc31a92 chore(deps): update module github.com/golangci/golangci-lint to v1.63.2 (#21343)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-02 16:32:46 -05:00
morre
db8d2f08d9 docs: add note about comments in policy.csv files (#21339)
I was wondering why our policy was valid even though it was not a valid CSV file.

Reading the code, I saw 812650847c/util/rbac/rbac.go (L492-L494) in the parsing and decided to add this note to document this behavior.

Signed-off-by: morre <mmeyer@anaconda.com>
2025-01-01 22:35:53 +01:00
Matthieu MOREL
812650847c chore: enable importas for k8s.io/apimachinery/pkg/apis/meta/v1 (#21284)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-12-31 10:34:11 +02:00
Matthieu MOREL
ffdbcb6f31 chore: reuse common PermissionDeniedAPIError (#21283)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-12-31 10:29:01 +02:00
github-actions[bot]
8bb2119a62 [Bot] docs: Update Snyk reports (#21322)
Signed-off-by: CI <ci@argoproj.com>
Co-authored-by: CI <ci@argoproj.com>
2024-12-30 11:02:58 +02:00
Matthieu MOREL
8a6f53d044 chore: enable errorf of perfsprint linter (#21280)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-12-30 10:56:41 +02:00
renovate[bot]
a415822614 chore(deps): update dependency pymdown-extensions to v10.13 (#21301)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-30 10:54:34 +02:00
Siddhesh Ghadi
9309688a8a Stabilize on-deployed notification trigger (#21333)
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
2024-12-30 10:51:55 +02:00
dependabot[bot]
635e592778 chore(deps): bump github.com/casbin/casbin/v2 from 2.102.0 to 2.103.0 (#21330)
Bumps [github.com/casbin/casbin/v2](https://github.com/casbin/casbin) from 2.102.0 to 2.103.0.
- [Release notes](https://github.com/casbin/casbin/releases)
- [Changelog](https://github.com/casbin/casbin/blob/master/.releaserc.json)
- [Commits](https://github.com/casbin/casbin/compare/v2.102.0...v2.103.0)

---
updated-dependencies:
- dependency-name: github.com/casbin/casbin/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-30 04:42:07 +00:00
dependabot[bot]
84f2ab850d chore(deps): bump github.com/casbin/govaluate from 1.2.0 to 1.3.0 (#21331)
Bumps [github.com/casbin/govaluate](https://github.com/casbin/govaluate) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/casbin/govaluate/releases)
- [Changelog](https://github.com/casbin/govaluate/blob/master/.releaserc.json)
- [Commits](https://github.com/casbin/govaluate/compare/v1.2.0...v1.3.0)

---
updated-dependencies:
- dependency-name: github.com/casbin/govaluate
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-30 03:59:23 +00:00
dependabot[bot]
dd366f56fa chore(deps): bump github.com/go-git/go-git/v5 from 5.12.0 to 5.13.0 (#21329)
Bumps [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) from 5.12.0 to 5.13.0.
- [Release notes](https://github.com/go-git/go-git/releases)
- [Commits](https://github.com/go-git/go-git/compare/v5.12.0...v5.13.0)

---
updated-dependencies:
- dependency-name: github.com/go-git/go-git/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-30 03:53:41 +00:00
Ali Abbas Jaffri
cce4a284be Update ingress.md (#21324)
Fixing spell error

Signed-off-by: Ali Abbas Jaffri <ali.abbasjaffri@live.com>
2024-12-29 20:32:10 +01:00
dependabot[bot]
728b31e5e9 chore(deps): bump google.golang.org/protobuf from 1.36.0 to 1.36.1 (#21303)
Bumps google.golang.org/protobuf from 1.36.0 to 1.36.1.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-27 20:04:27 +05:30
dependabot[bot]
87a7a6eb39 chore(deps): bump library/redis in /test/container (#21310)
Bumps library/redis from `ea96c43` to `05f9926`.

---
updated-dependencies:
- dependency-name: library/redis
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-27 20:03:59 +05:30
Nitish Kumar
afbde2a930 test: add unit test for read and write function for websocket (#19598)
* test: add unit test for read and write function for websocket

Signed-off-by: nitishfy <justnitish06@gmail.com>

* fix nil pointer reference

Signed-off-by: nitishfy <justnitish06@gmail.com>

* remove alternative read test for testing-purposes

Signed-off-by: nitishfy <justnitish06@gmail.com>

* modify test cases

Signed-off-by: nitishfy <justnitish06@gmail.com>

* fix failing test

Signed-off-by: nitishfy <justnitish06@gmail.com>

* remove read test

Signed-off-by: nitishfy <justnitish06@gmail.com>

---------

Signed-off-by: nitishfy <justnitish06@gmail.com>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
2024-12-26 20:47:10 +01:00
Ali Hamza Noor
c6893527a7 Fixing the link in the docs (#21316)
Signed-off-by: alihamzanoor <alihamzanoor99@gmail.com>
2024-12-26 13:11:42 +01:00
dependabot[bot]
f429352c0a chore(deps): bump github.com/gosimple/slug from 1.14.0 to 1.15.0 (#21304)
Bumps [github.com/gosimple/slug](https://github.com/gosimple/slug) from 1.14.0 to 1.15.0.
- [Release notes](https://github.com/gosimple/slug/releases)
- [Commits](https://github.com/gosimple/slug/compare/v1.14.0...v1.15.0)

---
updated-dependencies:
- dependency-name: github.com/gosimple/slug
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-23 22:50:12 -05:00
Amit Oren
644315ace1 fix: Change applicationset generate HTTP method to avoid route conflicts (#20758)
* Change applicationset generate HTTP method to avoid route conflicts

Signed-off-by: Amit Oren <amit@coralogix.com>

* Update server/applicationset/applicationset.proto

Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Amit Oren <github@amitoren.dev>

* Codegen

Signed-off-by: Amit Oren <amit@coralogix.com>

---------

Signed-off-by: Amit Oren <amit@coralogix.com>
Signed-off-by: Amit Oren <github@amitoren.dev>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2024-12-23 12:15:50 -05:00
github-actions[bot]
ac8e3f01e9 [Bot] docs: Update Snyk reports (#21290)
Signed-off-by: CI <ci@argoproj.com>
Co-authored-by: CI <ci@argoproj.com>
2024-12-22 13:02:07 +02:00
dependabot[bot]
812a9da62a chore(deps): bump chromedriver from 131.0.3 to 131.0.4 in /ui-test (#21268)
Bumps [chromedriver](https://github.com/giggio/node-chromedriver) from 131.0.3 to 131.0.4.
- [Commits](https://github.com/giggio/node-chromedriver/compare/131.0.3...131.0.4)

---
updated-dependencies:
- dependency-name: chromedriver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-22 12:59:20 +02:00
Suraj yadav
e5df999183 crepocreds-short-changed (#21285)
Signed-off-by: Surajyadav <harrypotter1108@gmail.com>
2024-12-22 12:59:03 +02:00
renovate[bot]
cf89ee6279 chore(deps): update dependency jinja2 to v3.1.5 (#21289)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-22 12:56:48 +02:00
dependabot[bot]
f15e1bc52c chore(deps): bump google.golang.org/grpc from 1.69.0 to 1.69.2 (#21270) 2024-12-21 18:58:23 +00:00
Jas
80edbfed80 Update toolchain-guide.md (#21288) 2024-12-22 00:21:22 +05:30
Afzal Ansari
0b542baacb add project missing field to spec (#21277)
Signed-off-by: Afzal Ansari <afzal442@gmail.com>
2024-12-21 12:44:55 +02:00
Matthieu MOREL
48334cfcd5 chore: use standard errors instead of github.com/pkg/errors (#21266)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-12-21 12:36:46 +02:00
Afzal Ansari
26ebb9bb5e fixed the broken link while version upgrade/degrade (#21279)
Signed-off-by: Afzal Ansari <afzal442@gmail.com>
2024-12-20 10:09:59 -07:00
Matthieu MOREL
f245e8beb5 chore: enable err-error and strconcat of perfsprint linter (#21267)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-12-20 16:22:28 +00:00
Eadred
12a4dabd1c chore: Fix data race detection failures in application tests (#21271)
* chore: Fix race detection failures in application tests

Signed-off-by: eadred <eadred77@googlemail.com>

* Fix failing TestGetCachedAppState tests

Signed-off-by: eadred <eadred77@googlemail.com>

---------

Signed-off-by: eadred <eadred77@googlemail.com>
2024-12-20 09:59:35 -05:00
Michal Ryšavý
8841b0dd1d fix: Fix calculating SelfHealBackOff delay when exceeding maximum (#20976) (#20978)
* test: fix TestSelfHealExponentialBackoff to test exceeding Backoff.Cap

Signed-off-by: Michal Ryšavý <michal.rysavy@ext.csas.cz>

* fix: fix calculating SelfHealBackOff delay when exceeding maximum

Signed-off-by: Michal Ryšavý <michal.rysavy@ext.csas.cz>

---------

Signed-off-by: Michal Ryšavý <michal.rysavy@ext.csas.cz>
Co-authored-by: Michal Ryšavý <michal.rysavy@ext.csas.cz>
2024-12-19 16:07:10 +02:00
dependabot[bot]
6b57b16324 chore(deps): bump google.golang.org/grpc from 1.68.1 to 1.69.0 (#21163)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.68.1 to 1.69.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.68.1...v1.69.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
Co-authored-by: Pasha Kostohrys <pasha.kostohrys@gmail.com>
2024-12-19 13:12:58 +02:00
George Wu
4d59154a88 Replace deprecated go-gitlab dependency with client-go. (#21175)
Signed-off-by: George Wu <gbw@users.noreply.github.com>
2024-12-19 12:03:39 +02:00
dependabot[bot]
e920e71cb5 chore(deps): bump library/redis in /test/container (#21253)
Bumps library/redis from `af0be38` to `ea96c43`.

---
updated-dependencies:
- dependency-name: library/redis
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-19 11:53:47 +02:00
dependabot[bot]
d84ac3a6b2 chore(deps-dev): bump @types/mocha from 10.0.9 to 10.0.10 in /ui-test (#21251) 2024-12-19 10:12:04 +02:00
dependabot[bot]
bf2c4e866a chore(deps): bump golang.org/x/net from 0.32.0 to 0.33.0 (#21254)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.32.0 to 0.33.0.
- [Commits](https://github.com/golang/net/compare/v0.32.0...v0.33.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-19 04:29:28 +00:00
Matthieu MOREL
d7ccf47057 chore: use testify instead of testing.Fatal or testing.Error in pkg (#20761)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-12-18 22:24:49 +00:00
Shav
fdf21f7763 Add pollinate to USERS.md (#21247)
Signed-off-by: Shav <shavgath.perumal@pollinate.co.uk>
2024-12-19 00:16:46 +02:00
Michael Crenshaw
566bc2e5e8 chore(test): simplify test assertions (#21242)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2024-12-19 00:16:14 +02:00
Michael Crenshaw
ab07b0aed5 chore(controller): simplify sharding code (#21244)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2024-12-19 00:15:41 +02:00
Michael Crenshaw
34fd7296b1 chore(refactor): remove unused function/file (#21245)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2024-12-19 00:15:08 +02:00
Eadred
0d34340c20 fix: 21062 Support GitLab "System Hook" webhooks for ApplicationSets (#21243)
Fixes https://github.com/argoproj/argo-cd/issues/21062

Signed-off-by: eadred <eadred77@googlemail.com>
2024-12-19 00:07:18 +02:00
dependabot[bot]
5e30858705 chore(deps): bump bitnami/kubectl from 1.31 to 1.32 in /test/container (#21234)
Bumps bitnami/kubectl from 1.31 to 1.32.

---
updated-dependencies:
- dependency-name: bitnami/kubectl
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-18 23:19:52 +05:30
dependabot[bot]
e052670c0b chore(deps): bump google.golang.org/protobuf from 1.35.2 to 1.36.0 (#21211)
Bumps google.golang.org/protobuf from 1.35.2 to 1.36.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-18 18:04:59 +02:00
dependabot[bot]
8ce1c33ce6 chore(deps): bump docker/setup-buildx-action from 3.7.1 to 3.8.0 (#21210)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 3.7.1 to 3.8.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](c47758b77c...6524bf65af)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-18 17:24:37 +02:00
Michael Crenshaw
75bbb50db3 chore(appset): use DB instead of kube client for cluster validation (#21190)
* chore(appset): use DB instead of kube client for cluster validation

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix tests

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* sort

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2024-12-18 15:11:57 +00:00
dependabot[bot]
5b482d738a chore(deps-dev): bump mocha from 10.7.3 to 11.0.1 in /ui-test (#21030)
Bumps [mocha](https://github.com/mochajs/mocha) from 10.7.3 to 11.0.1.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v10.7.3...v11.0.1)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-18 16:49:09 +02:00
dependabot[bot]
235470fb26 chore(deps-dev): bump @types/node from 22.9.3 to 22.10.2 in /ui-test (#21143)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.9.3 to 22.10.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-18 16:43:10 +02:00
dependabot[bot]
2a760e1fd1 chore(deps): bump github.com/alicebob/miniredis/v2 from 2.33.0 to 2.34.0 (#21232)
Bumps [github.com/alicebob/miniredis/v2](https://github.com/alicebob/miniredis) from 2.33.0 to 2.34.0.
- [Release notes](https://github.com/alicebob/miniredis/releases)
- [Changelog](https://github.com/alicebob/miniredis/blob/master/CHANGELOG.md)
- [Commits](https://github.com/alicebob/miniredis/compare/v2.33.0...v2.34.0)

---
updated-dependencies:
- dependency-name: github.com/alicebob/miniredis/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-18 16:34:49 +02:00
dependabot[bot]
e6b110d05b chore(deps): bump SonarSource/sonarqube-scan-action from 4.1.0 to 4.2.1 (#21230)
Bumps [SonarSource/sonarqube-scan-action](https://github.com/sonarsource/sonarqube-scan-action) from 4.1.0 to 4.2.1.
- [Release notes](https://github.com/sonarsource/sonarqube-scan-action/releases)
- [Commits](1b442ee39a...bfd4e558cd)

---
updated-dependencies:
- dependency-name: SonarSource/sonarqube-scan-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-18 16:31:12 +02:00
Alexandre Gaudreault
13b7b09668 fix(settings): race condition on settings configMap (#21225)
* fix(settings): race condition on settings configMap

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>

* fix secret update

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>

* simplify sync method usage

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>

* remove unnecessary lister usage

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>

* tests

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>

* fix cache nil ref

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>

---------

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2024-12-18 09:28:50 -05:00
Nathanael Liechti
f2ee9a62d2 fix(cli): wrong variable to store --no-proxy value (#21226)
Signed-off-by: Nathanael Liechti <technat@technat.ch>
2024-12-18 15:23:47 +01:00
dependabot[bot]
d29124fd3a chore(deps): bump github.com/cyphar/filepath-securejoin (#21233)
Bumps [github.com/cyphar/filepath-securejoin](https://github.com/cyphar/filepath-securejoin) from 0.3.5 to 0.3.6.
- [Release notes](https://github.com/cyphar/filepath-securejoin/releases)
- [Changelog](https://github.com/cyphar/filepath-securejoin/blob/main/CHANGELOG.md)
- [Commits](https://github.com/cyphar/filepath-securejoin/compare/v0.3.5...v0.3.6)

---
updated-dependencies:
- dependency-name: github.com/cyphar/filepath-securejoin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-18 09:18:02 -05:00
Josh Soref
ecd0bcdd58 chore(ui): resolve ts-jest config under globals is deprecated (#20036)
Signed-off-by: Josh Soref <jsoref@gmail.com>
2024-12-18 16:17:09 +02:00
Yusuke Abe
05cde71efc docs: fix aws sso documentation (#20681)
* docs: remove redundant dot of picture

Signed-off-by: chansuke <moonset20@gmail.com>

* fix: replace the wrong picture of creating IAM Identity Center application for ArgoCD SSO

Signed-off-by: chansuke <moonset20@gmail.com>

---------

Signed-off-by: chansuke <moonset20@gmail.com>
2024-12-18 16:15:47 +02:00
Matthieu MOREL
e7d909164c chore: use testify instead of testing.Fatal or testing.Error in reposerver (#20762)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-12-18 16:12:05 +02:00
dependabot[bot]
3639bfe700 chore(deps): bump library/registry in /test/container (#20775)
Bumps library/registry from `ac0192b` to `543dade`.

---
updated-dependencies:
- dependency-name: library/registry
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-18 16:10:30 +02:00
dependabot[bot]
f1083320a4 chore(deps): bump library/redis in /test/container (#20776)
Bumps library/redis from `a06cea9` to `af0be38`.

---
updated-dependencies:
- dependency-name: library/redis
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-18 16:02:49 +02:00
dependabot[bot]
d46f224e79 chore(deps): bump gitpod/workspace-full from 230285e to bec45eb (#20980)
Bumps gitpod/workspace-full from `230285e` to `bec45eb`.

---
updated-dependencies:
- dependency-name: gitpod/workspace-full
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-18 16:01:43 +02:00
Suraj yadav
1194766eba added-ACL (#21238)
Signed-off-by: Surajyadav <harrypotter1108@gmail.com>
2024-12-18 15:42:45 +02:00
Andrii Korotkov
45e488657b chore: Graceful shutdown for API Server (#18642) (#21224)
* fix: Graceful shutdown for the API server (#18642) (#20981)

* fix: Graceful shutdown for the API server (#18642)

Closes #18642

Implements a graceful shutdown the the API server. Without this, ArgoCD API server will eventually return 502 during rolling update. However, healthcheck would return 503 if the server is terminating.

Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
Co-authored-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* Init server only once, but keep re-initializing listeners

Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>

* Check error for SetParamInSettingConfigMap as needed after fresh master

Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>

* Prevent a data race

Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>

* Remove unused variable, don't pass lock when not necessary

Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>

* Try overriding URL instead of additional URLs

Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>

* Use a more specific url

Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>

---------

Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
Co-authored-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* Use a custom signal for graceful restart

Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>

* Re-run tests

Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>

---------

Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
Co-authored-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2024-12-17 16:51:18 -05:00
Pasha Kostohrys
46bfc10e4d Revert "fix: Graceful shutdown for the API server (#18642) (#20981)" (#21221) 2024-12-17 18:56:00 +02:00
Michael Crenshaw
9203dd16af chore(server): simplify project validation logic (#21191)
* chore(server): simplify project validation logic

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* improve tests

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2024-12-17 13:01:06 +05:30
Michael Crenshaw
0de5f60cdc chore(appset): reduce dupe code w/ DB (#21192)
* chore(appset): reduce dupe code w/ DB

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix imports

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2024-12-17 12:57:37 +05:30
AvivGuiser
1a69663a70 docs: add link to sprig website in the template docs site (#21184)
* add link to sprig website in the template docs site

Signed-off-by: AvivGuiser <avivguiser@gmail.com>

* Update docs/operator-manual/notifications/templates.md

Co-authored-by: Nitish Kumar <justnitish06@gmail.com>
Signed-off-by: AvivGuiser <avivguiser@gmail.com>

---------

Signed-off-by: AvivGuiser <avivguiser@gmail.com>
Co-authored-by: Nitish Kumar <justnitish06@gmail.com>
2024-12-16 16:34:09 -07:00
Michael Crenshaw
433b317c35 feat: source hydrator (#20345)
* feat(hydrator): add sourceHydrator types

Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Omer Azmon <omer_azmon@intuit.com>
Co-authored-by: daengdaengLee <gunho1020@gmail.com>
Co-authored-by: Juwon Hwang (Kevin) <juwon8891@gmail.com>
Co-authored-by: thisishwan2 <feel000617@gmail.com>
Co-authored-by: mirageoasis <kimhw0820@naver.com>
Co-authored-by: Robin Lieb <robin.j.lieb@gmail.com>
Co-authored-by: miiiinju1 <gms07073@ynu.ac.kr>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix(codegen): use kube_codegen.sh deepcopy and client gen correctly

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

deepcopy gen

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* feat(hydrator): add commit-server component

Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Omer Azmon <omer_azmon@intuit.com>
Co-authored-by: daengdaengLee <gunho1020@gmail.com>
Co-authored-by: Juwon Hwang (Kevin) <juwon8891@gmail.com>
Co-authored-by: thisishwan2 <feel000617@gmail.com>
Co-authored-by: mirageoasis <kimhw0820@naver.com>
Co-authored-by: Robin Lieb <robin.j.lieb@gmail.com>
Co-authored-by: miiiinju1 <gms07073@ynu.ac.kr>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

go mod tidy

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

one test file for both implementations

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

simplify

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix test for linux

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix git client mock

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix git client mock

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

address comments

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

unit tests

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

lint

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix image, fix health checks, fix merge issue

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix lint issues

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

remove code that doesn't work for GHE

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

changes from comments

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* feat(hydrator): enable controller

Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Omer Azmon <omer_azmon@intuit.com>
Co-authored-by: daengdaengLee <gunho1020@gmail.com>
Co-authored-by: Juwon Hwang (Kevin) <juwon8891@gmail.com>
Co-authored-by: thisishwan2 <feel000617@gmail.com>
Co-authored-by: mirageoasis <kimhw0820@naver.com>
Co-authored-by: Robin Lieb <robin.j.lieb@gmail.com>
Co-authored-by: miiiinju1 <gms07073@ynu.ac.kr>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

feat(hydrator): enable controller

Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Omer Azmon <omer_azmon@intuit.com>
Co-authored-by: daengdaengLee <gunho1020@gmail.com>
Co-authored-by: Juwon Hwang (Kevin) <juwon8891@gmail.com>
Co-authored-by: thisishwan2 <feel000617@gmail.com>
Co-authored-by: mirageoasis <kimhw0820@naver.com>
Co-authored-by: Robin Lieb <robin.j.lieb@gmail.com>
Co-authored-by: miiiinju1 <gms07073@ynu.ac.kr>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

allow opt-in

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

separation between app controller and hydrator

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

simplify diff

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

todos

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

simplify

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

add dry sha to logs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

add app name to logs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

more logging, no caching

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix cluster install

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

don't interrupt an ongoing hydrate operation

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

revert hydrate loop fix

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

handle project-scoped repo creds

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

codegen

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

improve docs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fixes from comments

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* set hydrator enabled key when using hydrator manifests

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix manifests

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

improve docs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* feat(hydrator): enable controller

Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Omer Azmon <omer_azmon@intuit.com>
Co-authored-by: daengdaengLee <gunho1020@gmail.com>
Co-authored-by: Juwon Hwang (Kevin) <juwon8891@gmail.com>
Co-authored-by: thisishwan2 <feel000617@gmail.com>
Co-authored-by: mirageoasis <kimhw0820@naver.com>
Co-authored-by: Robin Lieb <robin.j.lieb@gmail.com>
Co-authored-by: miiiinju1 <gms07073@ynu.ac.kr>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

feat(hydrator): enable controller

Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Omer Azmon <omer_azmon@intuit.com>
Co-authored-by: daengdaengLee <gunho1020@gmail.com>
Co-authored-by: Juwon Hwang (Kevin) <juwon8891@gmail.com>
Co-authored-by: thisishwan2 <feel000617@gmail.com>
Co-authored-by: mirageoasis <kimhw0820@naver.com>
Co-authored-by: Robin Lieb <robin.j.lieb@gmail.com>
Co-authored-by: miiiinju1 <gms07073@ynu.ac.kr>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

allow opt-in

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

separation between app controller and hydrator

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

simplify diff

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

todos

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

simplify

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

add dry sha to logs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

add app name to logs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

more logging, no caching

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix cluster install

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

don't interrupt an ongoing hydrate operation

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

revert hydrate loop fix

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

handle project-scoped repo creds

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

codegen

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

improve docs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fixes from comments

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* feat(hydrator): add sourceHydrator types

Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Omer Azmon <omer_azmon@intuit.com>
Co-authored-by: daengdaengLee <gunho1020@gmail.com>
Co-authored-by: Juwon Hwang (Kevin) <juwon8891@gmail.com>
Co-authored-by: thisishwan2 <feel000617@gmail.com>
Co-authored-by: mirageoasis <kimhw0820@naver.com>
Co-authored-by: Robin Lieb <robin.j.lieb@gmail.com>
Co-authored-by: miiiinju1 <gms07073@ynu.ac.kr>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix(codegen): use kube_codegen.sh deepcopy and client gen correctly

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

deepcopy gen

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* feat(hydrator): enable controller

Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Omer Azmon <omer_azmon@intuit.com>
Co-authored-by: daengdaengLee <gunho1020@gmail.com>
Co-authored-by: Juwon Hwang (Kevin) <juwon8891@gmail.com>
Co-authored-by: thisishwan2 <feel000617@gmail.com>
Co-authored-by: mirageoasis <kimhw0820@naver.com>
Co-authored-by: Robin Lieb <robin.j.lieb@gmail.com>
Co-authored-by: miiiinju1 <gms07073@ynu.ac.kr>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

feat(hydrator): enable controller

Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Omer Azmon <omer_azmon@intuit.com>
Co-authored-by: daengdaengLee <gunho1020@gmail.com>
Co-authored-by: Juwon Hwang (Kevin) <juwon8891@gmail.com>
Co-authored-by: thisishwan2 <feel000617@gmail.com>
Co-authored-by: mirageoasis <kimhw0820@naver.com>
Co-authored-by: Robin Lieb <robin.j.lieb@gmail.com>
Co-authored-by: miiiinju1 <gms07073@ynu.ac.kr>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

allow opt-in

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

separation between app controller and hydrator

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

simplify diff

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

todos

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

simplify

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

add dry sha to logs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

add app name to logs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

more logging, no caching

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix cluster install

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

don't interrupt an ongoing hydrate operation

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

revert hydrate loop fix

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

handle project-scoped repo creds

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

codegen

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* feat(hydrator): write credentials handling + UI

Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Omer Azmon <omer_azmon@intuit.com>
Co-authored-by: daengdaengLee <gunho1020@gmail.com>
Co-authored-by: Juwon Hwang (Kevin) <juwon8891@gmail.com>
Co-authored-by: thisishwan2 <feel000617@gmail.com>
Co-authored-by: mirageoasis <kimhw0820@naver.com>
Co-authored-by: Robin Lieb <robin.j.lieb@gmail.com>
Co-authored-by: miiiinju1 <gms07073@ynu.ac.kr>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

feat(hydrator): enable controller

Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Omer Azmon <omer_azmon@intuit.com>
Co-authored-by: daengdaengLee <gunho1020@gmail.com>
Co-authored-by: Juwon Hwang (Kevin) <juwon8891@gmail.com>
Co-authored-by: thisishwan2 <feel000617@gmail.com>
Co-authored-by: mirageoasis <kimhw0820@naver.com>
Co-authored-by: Robin Lieb <robin.j.lieb@gmail.com>
Co-authored-by: miiiinju1 <gms07073@ynu.ac.kr>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

allow opt-in

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

separation between app controller and hydrator

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

simplify diff

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

todos

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

simplify

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

add dry sha to logs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

add app name to logs

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

more logging, no caching

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix cluster install

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

don't interrupt an ongoing hydrate operation

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

revert hydrate loop fix

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

feat(hydrator): write credentials handling + UI

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

WIP: add new APIs for write creds

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

write api and template api

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix time function

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix lint issues

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

don't enrich with read creds

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

revert tls change

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

don't disable buttons in UI

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

ask repo server for specific revision

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fixes

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

lint ui

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

remove unnecessary change

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

fix test and lint

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

lint

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

enable hydrator for e2e tests

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* free disk space for e2e tests

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

don't free disk space

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* free disk space for e2e tests

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* remove comment that breaks auth

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* try removing extra function

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* cleanup from comments

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix test

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2024-12-16 16:59:09 -05:00
Mykola Pelekh
dc3f40c31e fix: avoid resources lock contention (#8172) (#20329)
* fix: avoid resources lock contention

Signed-off-by: Mykola Pelekh <mpelekh@demonware.net>

* feat: allow enabling batch events processing

Signed-off-by: Mykola Pelekh <mpelekh@demonware.net>

* fix: update ParseDurationFromEnv to handle duration in ms

Signed-off-by: Mykola Pelekh <mpelekh@demonware.net>

* feat: make eventProcessingInterval option configurable (default is 0.1s)

Signed-off-by: Mykola Pelekh <mpelekh@demonware.net>

* use upstream gitops-engine

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Mykola Pelekh <mpelekh@demonware.net>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2024-12-16 12:18:11 -05:00
Suraj yadav
c090f849b0 pruned-icon-changed-to-trash (#21088)
Signed-off-by: Surajyadav <harrypotter1108@gmail.com>
2024-12-16 16:59:31 +05:30
Suraj yadav
a94a07ecd6 feat(ui): Added title label for filters (#21149)
* added-filter-title

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

* text-color

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

---------

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>
2024-12-16 16:55:43 +05:30
dependabot[bot]
065700c5e1 chore(deps): bump nanoid from 3.3.7 to 3.3.8 in /ui (#21131)
Bumps [nanoid](https://github.com/ai/nanoid) from 3.3.7 to 3.3.8.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/3.3.7...3.3.8)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-16 15:44:49 +05:30
dependabot[bot]
8d4ae26686 chore(deps): bump library/busybox in /test/e2e/multiarch-container (#21145)
Bumps library/busybox from `768e5c6` to `2919d01`.

---
updated-dependencies:
- dependency-name: library/busybox
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-16 15:44:15 +05:30
GuySaar8
8a9de6a8d3 fix(ui): ArgoCD history tab shows latest values in all recent releases (#13006) (#21161)
* fix(ISSUE-13006): ArgoCD history tab shows latest values in all recent releases

Signed-off-by: Guy Saar <guysaar8@gmail.com>

* chore: added org to USER.md

Signed-off-by: Guy Saar <guysaar8@gmail.com>

chore: added org to USER.md

Signed-off-by: Guy Saar <guysaar8@gmail.com>

* chore: update USER.md based on PR review

Signed-off-by: Guy Saar <guysaar8@gmail.com>

chore: added newline to USER.md

Signed-off-by: Guy Saar <guysaar8@gmail.com>

---------

Signed-off-by: Guy Saar <guysaar8@gmail.com>
2024-12-16 15:43:34 +05:30
Yusuke Abe
4d17bf3d8b docs: update sync-wave documentation (#21155)
Signed-off-by: chansuke <moonset20@gmail.com>
2024-12-16 15:41:38 +05:30
dependabot[bot]
75b0b3c8ee chore(deps): bump go.opentelemetry.io/otel/sdk from 1.32.0 to 1.33.0 (#21165)
Bumps [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) from 1.32.0 to 1.33.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.32.0...v1.33.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-16 15:37:55 +05:30
OpenGuidou
bce16e9daf fix(appset): Fix appset generate in --core mode for cluster gen (#21170)
Signed-off-by: OpenGuidou <guillaume.doussin@gmail.com>
2024-12-16 14:52:44 +05:30
Michael Crenshaw
e878ad5f31 chore: remove unused defaults from image workflow (#21183)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2024-12-16 14:51:00 +05:30
dependabot[bot]
19eaeb9aca chore(deps): bump github.com/Azure/kubelogin from 0.1.5 to 0.1.6 (#21193)
Bumps [github.com/Azure/kubelogin](https://github.com/Azure/kubelogin) from 0.1.5 to 0.1.6.
- [Release notes](https://github.com/Azure/kubelogin/releases)
- [Changelog](https://github.com/Azure/kubelogin/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Azure/kubelogin/compare/v0.1.5...v0.1.6)

---
updated-dependencies:
- dependency-name: github.com/Azure/kubelogin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-16 14:50:09 +05:30
Michael Crenshaw
5cdb1a0a15 chore: use new fake k8s client constructor (#21186)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2024-12-16 14:49:30 +05:30
Michael Crenshaw
4471603de2 fix(api): send to closed channel in mergeLogStreams (#7006) (#21178)
* fix(api): send to closed channel in mergeLogStreams (#7006)

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* more intense test

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* even more intense

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* remove unnecessary comment

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* fix the race condition

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2024-12-15 19:44:34 -05:00
Clint Chester
99efafb55a feat: Confluent Connector Resource Health Checker - #17695 (#17697)
* Adding Synergy as a ArgoCD user

Signed-off-by: GitHub <noreply@github.com>

* Health checking Kafka Connector resources

Signed-off-by: Clint Chester <clint.chester@synergy.net.au>

* Includes Kafka Connect Task Failures

Signed-off-by: Clint Chester <clint.chester@synergy.net.au>

---------

Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Clint Chester <clint.chester@synergy.net.au>
2024-12-15 15:58:30 -05:00
1102
fdf539dc6a feat: add health check for ClusterResourceSet (#20746)
Signed-off-by: nueavv <nuguni@kakao.com>
2024-12-15 15:56:34 -05:00
github-actions[bot]
22fe65b4eb [Bot] docs: Update Snyk reports (#21180)
Signed-off-by: CI <ci@argoproj.com>
Co-authored-by: CI <ci@argoproj.com>
2024-12-15 20:49:57 +00:00
Michael Crenshaw
b60d28c71a docs(proposal): manifest hydrator (#17755)
* docs(proposal): manifest hydrator

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* whitespace

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* whitespace

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* remove old references to drySources as an array

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* rename fields

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* opinions

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* document limitations

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* updates

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* updates

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* multi-source is nondeterministic

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* Update docs/proposals/manifest-hydrator/commit-server/README.md

Co-authored-by: joe miller <joeym@joeym.net>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: joe miller <joeym@joeym.net>
2024-12-15 15:45:10 -05:00
1332 changed files with 169106 additions and 60795 deletions

5
.gitattributes vendored
View File

@@ -5,9 +5,14 @@ docs/operator-manual/resource_actions_builtin.md linguist-generated=true
docs/operator-manual/server-commands/argocd-*.md linguist-generated=true
docs/user-guide/commands/argocd_*.md linguist-generated=true
manifests/core-install.yaml linguist-generated=true
manifests/core-install-with-hydrator.yaml linguist-generated=true
manifests/crds/*-crd.yaml linguist-generated=true
manifests/ha/install.yaml linguist-generated=true
manifests/ha/install-with-hydrator.yaml linguist-generated=true
manifests/ha/namespace-install.yaml linguist-generated=true
manifests/ha/namespace-install-with-hydrator.yaml linguist-generated=true
manifests/install.yaml linguist-generated=true
manifests/install-with-hydrator.yaml linguist-generated=true
manifests/namespace-install.yaml linguist-generated=true
manifests/namespace-install-with-hydrator.yaml linguist-generated=true
pkg/apis/api-rules/violation_exceptions.list linguist-generated=true

View File

@@ -0,0 +1,89 @@
name: Bump major version
on:
workflow_dispatch: {}
permissions: {}
jobs:
prepare-release:
permissions:
contents: write # for peter-evans/create-pull-request to create branch
pull-requests: write # for peter-evans/create-pull-request to create a PR
name: Automatically update major version
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694 # v4.0.0
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
# Get the current major version from go.mod and save it as a variable.
- name: Get target version
id: get-target-version
run: |
set -ue
CURRENT_VERSION=$(grep 'module github.com/argoproj/argo-cd' go.mod | awk '{print $2}' | sed 's/.*\/v//')
echo "TARGET_VERSION=$((CURRENT_VERSION + 1))" >> $GITHUB_OUTPUT
- name: Copy source code to GOPATH
run: |
mkdir -p ~/go/src/github.com/argoproj
cp -a ../argo-cd ~/go/src/github.com/argoproj
- name: Run script to bump the version
run: |
hack/bump-major-version.sh
working-directory: /home/runner/go/src/github.com/argoproj/argo-cd
- name: Setup Golang
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: ${{ env.GOLANG_VERSION }}
- name: Add ~/go/bin to PATH
run: |
echo "/home/runner/go/bin" >> $GITHUB_PATH
- name: Add /usr/local/bin to PATH
run: |
echo "/usr/local/bin" >> $GITHUB_PATH
- name: Download & vendor dependencies
run: |
# We need to vendor go modules for codegen yet
go mod download
go mod vendor -v
working-directory: /home/runner/go/src/github.com/argoproj/argo-cd
- name: Install toolchain for codegen
run: |
make install-codegen-tools-local
make install-go-tools-local
working-directory: /home/runner/go/src/github.com/argoproj/argo-cd
# We install kustomize in the dist directory
- name: Add dist to PATH
run: |
echo "/home/runner/work/argo-cd/argo-cd/dist" >> $GITHUB_PATH
- name: Run codegen
run: |
set -x
export GOPATH=$(go env GOPATH)
make codegen-local
working-directory: /home/runner/go/src/github.com/argoproj/argo-cd
- name: Copy changes back
run: |
# Copy the contents back, but skip the .git directory
rsync -a --exclude=.git /home/runner/go/src/github.com/argoproj/argo-cd/ ../argo-cd
- name: Create pull request
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
commit-message: "Bump major version to ${{ steps.get-target-version.outputs.TARGET_VERSION }}"
title: "Bump major version to ${{ steps.get-target-version.outputs.TARGET_VERSION }}"
body: |
Congrats! You've just bumped the major version to ${{ steps.get-target-version.outputs.TARGET_VERSION }}.
Next steps:
- [ ] Merge this PR
- [ ] Add an upgrade guide to the docs for this version
branch: bump-major-version
branch-suffix: random
signoff: true

View File

@@ -14,7 +14,7 @@ on:
env:
# Golang version to use across CI steps
# renovate: datasource=golang-version packageName=golang
GOLANG_VERSION: '1.23.3'
GOLANG_VERSION: '1.24.6'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -39,7 +39,7 @@ jobs:
files_yaml: |
backend:
- '!ui/**'
- '!**.md'
- '!**.md'
- '!**/*.md'
- '!docs/**'
frontend:
@@ -94,8 +94,8 @@ jobs:
lint-go:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
name: Lint Go code
if: ${{ needs.changes.outputs.backend == 'true' }}
runs-on: ubuntu-22.04
@@ -112,7 +112,7 @@ jobs:
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
with:
# renovate: datasource=go packageName=github.com/golangci/golangci-lint versioning=regex:^v(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)?$
version: v1.62.2
version: v1.64.7
args: --verbose
test-go:
@@ -370,11 +370,11 @@ jobs:
path: test-results
- name: combine-go-coverage
# We generate coverage reports for all Argo CD components, but only the applicationset-controller,
# app-controller, and repo-server report contain coverage data. The other components currently don't shut down
# gracefully, so no coverage data is produced. Once those components are fixed, we can add references to their
# coverage output directories.
# app-controller, repo-server, and commit-server report contain coverage data. The other components currently
# don't shut down gracefully, so no coverage data is produced. Once those components are fixed, we can add
# references to their coverage output directories.
run: |
go tool covdata percent -i=test-results,e2e-code-coverage/applicationset-controller,e2e-code-coverage/repo-server,e2e-code-coverage/app-controller -o test-results/full-coverage.out
go tool covdata percent -i=test-results,e2e-code-coverage/applicationset-controller,e2e-code-coverage/repo-server,e2e-code-coverage/app-controller,e2e-code-coverage/commit-server -o test-results/full-coverage.out
- name: Upload code coverage information to codecov.io
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
@@ -393,7 +393,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
uses: SonarSource/sonarqube-scan-action@1b442ee39ac3fa7c2acdd410208dcb2bcfaae6c4 # v4.1.0
uses: SonarSource/sonarqube-scan-action@bfd4e558cda28cda6b5defafb9232d191be8c203 # v4.2.1
if: env.sonar_secret != ''
test-e2e:
name: Run end-to-end tests
@@ -402,33 +402,41 @@ jobs:
strategy:
fail-fast: false
matrix:
# latest: true means that this version mush upload the coverage report to codecov.io
# We designate the latest version because we only collect code coverage for that version.
k3s:
- version: v1.31.0
# We designate the latest version because we only collect code coverage for that version.
- version: v1.32.1
latest: true
- version: v1.31.0
latest: false
- version: v1.30.4
latest: false
- version: v1.29.8
latest: false
- version: v1.28.13
latest: false
needs:
- build-go
- changes
env:
GOPATH: /home/runner/go
ARGOCD_FAKE_IN_CLUSTER: "true"
ARGOCD_SSH_DATA_PATH: "/tmp/argo-e2e/app/config/ssh"
ARGOCD_TLS_DATA_PATH: "/tmp/argo-e2e/app/config/tls"
ARGOCD_E2E_SSH_KNOWN_HOSTS: "../fixture/certs/ssh_known_hosts"
ARGOCD_E2E_K3S: "true"
ARGOCD_IN_CI: "true"
ARGOCD_E2E_APISERVER_PORT: "8088"
ARGOCD_APPLICATION_NAMESPACES: "argocd-e2e-external,argocd-e2e-external-2"
ARGOCD_SERVER: "127.0.0.1:8088"
ARGOCD_FAKE_IN_CLUSTER: 'true'
ARGOCD_SSH_DATA_PATH: '/tmp/argo-e2e/app/config/ssh'
ARGOCD_TLS_DATA_PATH: '/tmp/argo-e2e/app/config/tls'
ARGOCD_E2E_SSH_KNOWN_HOSTS: '../fixture/certs/ssh_known_hosts'
ARGOCD_E2E_K3S: 'true'
ARGOCD_IN_CI: 'true'
ARGOCD_E2E_APISERVER_PORT: '8088'
ARGOCD_APPLICATION_NAMESPACES: 'argocd-e2e-external,argocd-e2e-external-2'
ARGOCD_SERVER: '127.0.0.1:8088'
GITHUB_TOKEN: ${{ secrets.E2E_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
GITLAB_TOKEN: ${{ secrets.E2E_TEST_GITLAB_TOKEN }}
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
with:
large-packages: false
docker-images: false
swap-storage: false
tool-cache: false
- name: Checkout code
uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694 # v4.0.0
- name: Setup Golang
@@ -479,7 +487,7 @@ jobs:
run: |
docker pull ghcr.io/dexidp/dex:v2.41.1
docker pull argoproj/argo-cd-ci-builder:v1.0.0
docker pull redis:7.0.15-alpine
docker pull redis:7.2.7-alpine
- name: Create target directory for binaries in the build-process
run: |
mkdir -p dist
@@ -542,4 +550,4 @@ jobs:
exit 0
else
exit 1
fi
fi

View File

@@ -17,11 +17,9 @@ on:
platforms:
required: true
type: string
default: linux/amd64
push:
required: true
type: boolean
default: false
target:
required: false
type: string
@@ -77,7 +75,7 @@ jobs:
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
- name: Setup tags for container image as a CSV type
run: |

View File

@@ -7,7 +7,7 @@ on:
pull_request:
branches:
- master
types: [ labeled, unlabeled, opened, synchronize, reopened ]
types: [labeled, unlabeled, opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -46,14 +46,14 @@ jobs:
needs: [set-vars]
permissions:
contents: read
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
id-token: write # for creating OIDC tokens for signing.
if: ${{ github.repository == 'argoproj/argo-cd' && github.event_name != 'push' }}
uses: ./.github/workflows/image-reuse.yaml
with:
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
# renovate: datasource=golang-version packageName=golang
go-version: 1.23.3
go-version: 1.24.6
platforms: ${{ needs.set-vars.outputs.platforms }}
push: false
@@ -61,7 +61,7 @@ jobs:
needs: [set-vars]
permissions:
contents: read
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
id-token: write # for creating OIDC tokens for signing.
if: ${{ github.repository == 'argoproj/argo-cd' && github.event_name == 'push' }}
uses: ./.github/workflows/image-reuse.yaml
@@ -70,7 +70,7 @@ jobs:
ghcr_image_name: ghcr.io/argoproj/argo-cd/argocd:${{ needs.set-vars.outputs.image-tag }}
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
# renovate: datasource=golang-version packageName=golang
go-version: 1.23.3
go-version: 1.24.6
platforms: ${{ needs.set-vars.outputs.platforms }}
push: true
secrets:
@@ -101,8 +101,8 @@ jobs:
- build-and-publish
- set-vars
permissions:
contents: write # for git to push upgrade commit if not already deployed
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
contents: write # for git to push upgrade commit if not already deployed
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
if: ${{ github.repository == 'argoproj/argo-cd' && github.event_name == 'push' }}
runs-on: ubuntu-22.04
steps:
@@ -116,4 +116,3 @@ jobs:
git config --global user.name 'CI'
git diff --exit-code && echo 'Already deployed' || (git commit -am 'Upgrade argocd to ${{ needs.set-vars.outputs.image-tag }}' && git push)
working-directory: argoproj-deployments/argocd

View File

@@ -12,8 +12,8 @@ permissions: {}
# workflow being trigger a number of times. This limits it
# to one run per PR.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
validate:

View File

@@ -11,7 +11,7 @@ permissions: {}
env:
# renovate: datasource=golang-version packageName=golang
GOLANG_VERSION: '1.23.3' # Note: go-version must also be set in job argocd-image.with.go-version
GOLANG_VERSION: '1.24.6' # Note: go-version must also be set in job argocd-image.with.go-version
jobs:
argocd-image:
@@ -25,7 +25,7 @@ jobs:
quay_image_name: quay.io/argoproj/argocd:${{ github.ref_name }}
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
# renovate: datasource=golang-version packageName=golang
go-version: 1.23.3
go-version: 1.24.6
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
push: true
secrets:
@@ -33,20 +33,20 @@ jobs:
quay_password: ${{ secrets.RELEASE_QUAY_TOKEN }}
argocd-image-provenance:
needs: [argocd-image]
permissions:
actions: read # for detecting the Github Actions environment.
id-token: write # for creating OIDC tokens for signing.
packages: write # for uploading attestations. (https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#known-issues)
# Must be refernced by a tag. https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#referencing-the-slsa-generator
if: github.repository == 'argoproj/argo-cd'
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.0.0
with:
image: quay.io/argoproj/argocd
digest: ${{ needs.argocd-image.outputs.image-digest }}
secrets:
registry-username: ${{ secrets.RELEASE_QUAY_USERNAME }}
registry-password: ${{ secrets.RELEASE_QUAY_TOKEN }}
needs: [argocd-image]
permissions:
actions: read # for detecting the Github Actions environment.
id-token: write # for creating OIDC tokens for signing.
packages: write # for uploading attestations. (https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#known-issues)
# Must be refernced by a tag. https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#referencing-the-slsa-generator
if: github.repository == 'argoproj/argo-cd'
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.0.0
with:
image: quay.io/argoproj/argocd
digest: ${{ needs.argocd-image.outputs.image-digest }}
secrets:
registry-username: ${{ secrets.RELEASE_QUAY_USERNAME }}
registry-password: ${{ secrets.RELEASE_QUAY_TOKEN }}
goreleaser:
needs:
@@ -77,7 +77,8 @@ jobs:
- name: Set GORELEASER_PREVIOUS_TAG # Workaround, GoReleaser uses 'git-describe' to determine a previous tag. Our tags are created in release branches.
run: |
set -xue
echo "GORELEASER_PREVIOUS_TAG=$(go run hack/get-previous-release/get-previous-version-for-release-notes.go ${{ github.ref_name }})" >> $GITHUB_ENV
GORELEASER_PREVIOUS_TAG=$(go run hack/get-previous-release/get-previous-version-for-release-notes.go ${{ github.ref_name }}) || exit 1
echo "GORELEASER_PREVIOUS_TAG=$GORELEASER_PREVIOUS_TAG" >> $GITHUB_ENV
- name: Set environment variables for ldflags
id: set_ldflag
@@ -107,7 +108,7 @@ jobs:
- name: Generate subject for provenance
id: hash
env:
ARTIFACTS: "${{ steps.run-goreleaser.outputs.artifacts }}"
ARTIFACTS: '${{ steps.run-goreleaser.outputs.artifacts }}'
run: |
set -euo pipefail
@@ -128,8 +129,8 @@ jobs:
# Must be refernced by a tag. https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#referencing-the-slsa-generator
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
with:
base64-subjects: "${{ needs.goreleaser.outputs.hashes }}"
provenance-name: "argocd-cli.intoto.jsonl"
base64-subjects: '${{ needs.goreleaser.outputs.hashes }}'
provenance-name: 'argocd-cli.intoto.jsonl'
upload-assets: true
generate-sbom:
@@ -164,7 +165,7 @@ jobs:
SIGS_BOM_VERSION: v0.2.1
# comma delimited list of project relative folders to inspect for package
# managers (gomod, yarn, npm).
PROJECT_FOLDERS: ".,./ui"
PROJECT_FOLDERS: '.,./ui'
# full qualified name of the docker image to be inspected
DOCKER_IMAGE: quay.io/argoproj/argocd:${{ github.ref_name }}
run: |
@@ -195,7 +196,7 @@ jobs:
echo "hashes=$(sha256sum /tmp/sbom.tar.gz | base64 -w0)" >> "$GITHUB_OUTPUT"
- name: Upload SBOM
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
@@ -212,8 +213,8 @@ jobs:
# Must be referenced by a tag. https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#referencing-the-slsa-generator
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
with:
base64-subjects: "${{ needs.generate-sbom.outputs.hashes }}"
provenance-name: "argocd-sbom.intoto.jsonl"
base64-subjects: '${{ needs.generate-sbom.outputs.hashes }}'
provenance-name: 'argocd-sbom.intoto.jsonl'
upload-assets: true
post-release:
@@ -296,7 +297,7 @@ jobs:
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
commit-message: Bump version in master
title: "chore: Bump version in master"
title: 'chore: Bump version in master'
body: All images built from master should indicate which version we are on track for.
signoff: true
branch: update-version

2
.gitpod.Dockerfile vendored
View File

@@ -1,4 +1,4 @@
FROM gitpod/workspace-full@sha256:230285e0b949e6d728d384b2029a4111db7b9c87c182f22f32a0be9e36b225df
FROM gitpod/workspace-full@sha256:a47a68ee7f9da10cd889ccce4661bc73f2c0d5a98d3d087e8bdfc0230b27964c
USER root

View File

@@ -14,46 +14,143 @@ linters:
- gocritic
- gofumpt
- goimports
- gomodguard
- gosimple
- govet
- importas
- ineffassign
- misspell
# Disabled because of https://github.com/argoproj/argo-cd/issues/21705
# - nolintlint
- perfsprint
- revive
- staticcheck
- testifylint
- thelper
- unparam
- unused
- usestdlibvars
- whitespace
- usetesting
- whitespace
linters-settings:
gocritic:
disabled-checks:
- appendAssign
- assignOp # Keep it disabled for readability
- badCond
- commentFormatting
- assignOp # Keep it disabled for readability
- exitAfterDefer
- ifElseChain
- mapKey
- singleCaseSwitch
- typeSwitchVar
goimports:
local-prefixes: github.com/argoproj/argo-cd/v2
local-prefixes: github.com/argoproj/argo-cd/v3
gomodguard:
blocked:
modules:
- github.com/golang-jwt/jwt/v4:
recommendations:
- github.com/golang-jwt/jwt/v5
- github.com/imdario/mergo:
recommendations:
- dario.cat/mergo
reason: '`github.com/imdario/mergo` has been renamed.'
- github.com/pkg/errors:
recommendations:
- errors
importas:
alias:
- alias: jwtgo
pkg: github.com/golang-jwt/jwt/v5
- alias: appsv1
pkg: k8s.io/api/apps/v1
- alias: corev1
pkg: k8s.io/api/core/v1
- alias: rbacv1
pkg: k8s.io/api/rbac/v1
- alias: apierrors
pkg: k8s.io/apimachinery/pkg/api/errors
- alias: apiextensionsv1
pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
- alias: metav1
pkg: k8s.io/apimachinery/pkg/apis/meta/v1
- alias: informersv1
pkg: k8s.io/client-go/informers/core/v1
- alias: stderrors
pkg: errors
nolintlint:
require-specific: true
perfsprint:
# Optimizes even if it requires an int or uint type cast.
int-conversion: true
# Optimizes into `err.Error()` even if it is only equivalent for non-nil errors.
err-error: false
err-error: true
# Optimizes `fmt.Errorf`.
errorf: false
errorf: true
# Optimizes `fmt.Sprintf` with only one argument.
sprintf1: true
# Optimizes into strings concatenation.
strconcat: false
strconcat: true
revive:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md
rules:
- name: bool-literal-in-expr
- name: blank-imports
disabled: true
- name: context-as-argument
arguments:
- allowTypesBefore: '*testing.T,testing.TB'
- name: context-keys-type
disabled: true
- name: dot-imports
disabled: true
- name: duplicated-imports
- name: early-return
arguments:
- 'preserveScope'
- name: empty-block
disabled: true
- name: error-naming
disabled: true
- name: error-return
- name: error-strings
disabled: true
- name: errorf
- name: identical-branches
- name: if-return
- name: increment-decrement
- name: indent-error-flow
arguments:
- 'preserveScope'
- name: modifies-parameter
- name: optimize-operands-order
- name: range
- name: receiver-naming
- name: redefines-builtin-id
disabled: true
- name: redundant-import-alias
- name: superfluous-else
arguments:
- 'preserveScope'
- name: time-equal
- name: time-naming
disabled: true
- name: unexported-return
disabled: true
- name: unnecessary-stmt
- name: unreachable-code
- name: unused-parameter
- name: use-any
- name: useless-break
- name: var-declaration
- name: var-naming
arguments:
- ["ID"]
- ["VM"]
- - skipPackageNameChecks: true
upperCaseConst: true
testifylint:
enable-all: true
disable:
- go-require
usetesting:
os-mkdir-temp: false
run:
timeout: 50m

View File

@@ -16,16 +16,16 @@ builds:
flags:
- -v
ldflags:
- -X github.com/argoproj/argo-cd/v2/common.version={{ .Version }}
- -X github.com/argoproj/argo-cd/v2/common.buildDate={{ .Date }}
- -X github.com/argoproj/argo-cd/v2/common.gitCommit={{ .FullCommit }}
- -X github.com/argoproj/argo-cd/v2/common.gitTreeState={{ .Env.GIT_TREE_STATE }}
- -X github.com/argoproj/argo-cd/v2/common.kubectlVersion={{ .Env.KUBECTL_VERSION }}
- -X github.com/argoproj/argo-cd/v3/common.version={{ .Version }}
- -X github.com/argoproj/argo-cd/v3/common.buildDate={{ .Date }}
- -X github.com/argoproj/argo-cd/v3/common.gitCommit={{ .FullCommit }}
- -X github.com/argoproj/argo-cd/v3/common.gitTreeState={{ .Env.GIT_TREE_STATE }}
- -X github.com/argoproj/argo-cd/v3/common.kubectlVersion={{ .Env.KUBECTL_VERSION }}
- -extldflags="-static"
goos:
- linux
- darwin
- windows
- darwin
goarch:
- amd64
- arm64
@@ -79,6 +79,8 @@ release:
All Argo CD container images are signed by cosign. A Provenance is generated for container images and CLI binaries which meet the SLSA Level 3 specifications. See the [documentation](https://argo-cd.readthedocs.io/en/stable/operator-manual/signed-release-assets) on how to verify.
## Release Notes Blog Post
For a detailed breakdown of the key changes and improvements in this release, check out the [official blog post](https://blog.argoproj.io/argo-cd-v2-14-release-candidate-57a664791e2a)
## Upgrading

View File

@@ -6,13 +6,13 @@ mockname: "{{.InterfaceName}}"
with-expecter: false
# individual interface config
packages:
github.com/argoproj/argo-cd/v2/applicationset/generators:
github.com/argoproj/argo-cd/v3/applicationset/generators:
interfaces:
Generator:
github.com/argoproj/argo-cd/v2/applicationset/services:
github.com/argoproj/argo-cd/v3/applicationset/services:
interfaces:
Repos:
github.com/argoproj/argo-cd/v2/applicationset/services/scm_provider:
github.com/argoproj/argo-cd/v3/applicationset/services/scm_provider:
config:
dir: "applicationset/services/scm_provider/aws_codecommit/mocks"
interfaces:
@@ -23,20 +23,27 @@ packages:
dir: "applicationset/services/scm_provider/azure_devops/git/mocks"
interfaces:
Client:
github.com/argoproj/argo-cd/v2/applicationset/utils:
github.com/argoproj/argo-cd/v3/applicationset/utils:
interfaces:
Renderer:
github.com/argoproj/argo-cd/v2/controller/cache:
github.com/argoproj/argo-cd/v3/commitserver/commit:
interfaces:
RepoClientFactory:
github.com/argoproj/argo-cd/v3/commitserver/apiclient:
interfaces:
CommitServiceClient:
Clientset:
github.com/argoproj/argo-cd/v3/controller/cache:
interfaces:
LiveStateCache:
github.com/argoproj/argo-cd/v2/reposerver/apiclient:
github.com/argoproj/argo-cd/v3/reposerver/apiclient:
interfaces:
RepoServerServiceClient:
RepoServerService_GenerateManifestWithFilesClient:
github.com/argoproj/argo-cd/v2/server/application:
github.com/argoproj/argo-cd/v3/server/application:
interfaces:
Broadcaster:
github.com/argoproj/argo-cd/v2/server/extension:
github.com/argoproj/argo-cd/v3/server/extension:
interfaces:
ApplicationGetter:
ExtensionMetricsRegistry:
@@ -44,26 +51,32 @@ packages:
RbacEnforcer:
SettingsGetter:
UserGetter:
github.com/argoproj/argo-cd/v2/util/db:
github.com/argoproj/argo-cd/v3/util/db:
interfaces:
ArgoDB:
github.com/argoproj/argo-cd/v2/util/git:
github.com/argoproj/argo-cd/v3/util/git:
interfaces:
Client:
github.com/argoproj/argo-cd/v2/util/helm:
github.com/argoproj/argo-cd/v3/util/helm:
interfaces:
Client:
github.com/argoproj/argo-cd/v2/util/io:
github.com/argoproj/argo-cd/v3/util/io:
interfaces:
TempPaths:
github.com/argoproj/argo-cd/v2/util/notification/argocd:
github.com/argoproj/argo-cd/v3/util/notification/argocd:
interfaces:
Service:
github.com/argoproj/argo-cd/v3/util/workloadidentity:
interfaces:
TokenProvider:
# These mocks are not currently used, but they are part of the public API of this package.
github.com/argoproj/argo-cd/v2/pkg/apiclient/session:
github.com/argoproj/argo-cd/v3/pkg/apiclient/session:
interfaces:
SessionServiceServer:
SessionServiceClient:
github.com/argoproj/argo-cd/v2/pkg/apiclient/cluster:
github.com/argoproj/argo-cd/v3/pkg/apiclient/cluster:
interfaces:
ClusterServiceServer:
github.com/argoproj/argo-cd/v3/pkg/client/clientset/versioned/typed/application/v1alpha1:
interfaces:
AppProjectInterface:

View File

@@ -2,6 +2,7 @@ version: 2
formats: all
mkdocs:
fail_on_warning: false
configuration: mkdocs.yml
python:
install:
- requirements: docs/requirements.txt

View File

@@ -1,10 +1,12 @@
ARG BASE_IMAGE=docker.io/library/ubuntu:24.04@sha256:3f85b7caad41a95462cf5b787d8a04604c8262cdcdf9a472b8c52ef83375fe15
ARG BASE_IMAGE=docker.io/library/ubuntu:24.04@sha256:80dd3c3b9c6cecb9f1667e9290b3bc61b78c2678c02cbdae5f0fea92cc6734ab
####################################################################################################
# Builder image
# Initial stage which pulls prepares build dependencies and CLI tooling we need for our final image
# Also used as the image in CI jobs so needs all dependencies
####################################################################################################
FROM docker.io/library/golang:1.23.3@sha256:d56c3e08fe5b27729ee3834854ae8f7015af48fd651cd25d1e3bcf3c19830174 AS builder
FROM docker.io/library/golang:1.24.6@sha256:2c89c41fb9efc3807029b59af69645867cfe978d2b877d475be0d72f6c6ce6f6 AS builder
WORKDIR /tmp
RUN echo 'deb http://archive.debian.org/debian buster-backports main' >> /etc/apt/sources.list
@@ -23,8 +25,6 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /tmp
COPY hack/install.sh hack/tool-versions.sh ./
COPY hack/installers installers
@@ -40,8 +40,8 @@ LABEL org.opencontainers.image.source="https://github.com/argoproj/argo-cd"
USER root
ENV ARGOCD_USER_ID=999
ENV DEBIAN_FRONTEND=noninteractive
ENV ARGOCD_USER_ID=999 \
DEBIAN_FRONTEND=noninteractive
RUN groupadd -g $ARGOCD_USER_ID argocd && \
useradd -r -u $ARGOCD_USER_ID -g argocd argocd && \
@@ -55,11 +55,13 @@ RUN groupadd -g $ARGOCD_USER_ID argocd && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY hack/gpg-wrapper.sh /usr/local/bin/gpg-wrapper.sh
COPY hack/git-verify-wrapper.sh /usr/local/bin/git-verify-wrapper.sh
COPY hack/gpg-wrapper.sh \
hack/git-verify-wrapper.sh \
entrypoint.sh \
/usr/local/bin/
COPY --from=builder /usr/local/bin/helm /usr/local/bin/helm
COPY --from=builder /usr/local/bin/kustomize /usr/local/bin/kustomize
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
# keep uid_entrypoint.sh for backward compatibility
RUN ln -s /usr/local/bin/entrypoint.sh /usr/local/bin/uid_entrypoint.sh
@@ -101,7 +103,7 @@ RUN HOST_ARCH=$TARGETARCH NODE_ENV='production' NODE_ONLINE_ENV='online' NODE_OP
####################################################################################################
# Argo CD Build stage which performs the actual build of Argo CD binaries
####################################################################################################
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.23.3@sha256:d56c3e08fe5b27729ee3834854ae8f7015af48fd651cd25d1e3bcf3c19830174 AS argocd-build
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.24.6@sha256:2c89c41fb9efc3807029b59af69645867cfe978d2b877d475be0d72f6c6ce6f6 AS argocd-build
WORKDIR /go/src/github.com/argoproj/argo-cd
@@ -111,13 +113,13 @@ RUN go mod download
# Perform the build
COPY . .
COPY --from=argocd-ui /src/dist/app /go/src/github.com/argoproj/argo-cd/ui/dist/app
ARG TARGETOS
ARG TARGETARCH
ARG TARGETOS \
TARGETARCH
# These build args are optional; if not specified the defaults will be taken from the Makefile
ARG GIT_TAG
ARG BUILD_DATE
ARG GIT_TREE_STATE
ARG GIT_COMMIT
ARG GIT_TAG \
BUILD_DATE \
GIT_TREE_STATE \
GIT_COMMIT
RUN GIT_COMMIT=$GIT_COMMIT \
GIT_TREE_STATE=$GIT_TREE_STATE \
GIT_TAG=$GIT_TAG \
@@ -130,6 +132,7 @@ RUN GIT_COMMIT=$GIT_COMMIT \
# Final image
####################################################################################################
FROM argocd-base
ENTRYPOINT ["/usr/bin/tini", "--"]
COPY --from=argocd-build /go/src/github.com/argoproj/argo-cd/dist/argocd* /usr/local/bin/
USER root
@@ -140,7 +143,7 @@ RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-server && \
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-dex && \
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-notifications && \
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-applicationset-controller && \
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-k8s-auth
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-k8s-auth && \
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-commit-server
USER $ARGOCD_USER_ID
ENTRYPOINT ["/usr/bin/tini", "--"]

View File

@@ -1,4 +1,4 @@
PACKAGE=github.com/argoproj/argo-cd/v2/common
PACKAGE=github.com/argoproj/argo-cd/v3/common
CURRENT_DIR=$(shell pwd)
DIST_DIR=${CURRENT_DIR}/dist
CLI_NAME=argocd
@@ -355,11 +355,6 @@ mod-vendor: test-tools-image
mod-vendor-local: mod-download-local
go mod vendor
# Deprecated - replace by install-tools-local
.PHONY: install-lint-tools
install-lint-tools:
./hack/install.sh lint-tools
# Run linter on the code
.PHONY: lint
lint: test-tools-image
@@ -435,7 +430,7 @@ test-e2e:
test-e2e-local: cli-local
# NO_PROXY ensures all tests don't go out through a proxy if one is configured on the test system
export GO111MODULE=off
DIST_DIR=${DIST_DIR} RERUN_FAILS=5 PACKAGES="./test/e2e" ARGOCD_E2E_RECORD=${ARGOCD_E2E_RECORD} ARGOCD_GPG_ENABLED=true NO_PROXY=* ./hack/test.sh -timeout $(ARGOCD_E2E_TEST_TIMEOUT) -v -args -test.gocoverdir="$(PWD)/test-results"
DIST_DIR=${DIST_DIR} RERUN_FAILS=5 PACKAGES="./test/e2e" ARGOCD_E2E_RECORD=${ARGOCD_E2E_RECORD} ARGOCD_CONFIG_DIR=$(HOME)/.config/argocd-e2e ARGOCD_GPG_ENABLED=true NO_PROXY=* ./hack/test.sh -timeout $(ARGOCD_E2E_TEST_TIMEOUT) -v -args -test.gocoverdir="$(PWD)/test-results"
# Spawns a shell in the test server container for debugging purposes
debug-test-server: test-tools-image
@@ -472,6 +467,7 @@ start-e2e-local: mod-vendor-local dep-ui-local cli-local
mkdir -p /tmp/coverage/repo-server
mkdir -p /tmp/coverage/applicationset-controller
mkdir -p /tmp/coverage/notification
mkdir -p /tmp/coverage/commit-server
# set paths for locally managed ssh known hosts and tls certs data
ARGOCD_SSH_DATA_PATH=/tmp/argo-e2e/app/config/ssh \
ARGOCD_TLS_DATA_PATH=/tmp/argo-e2e/app/config/tls \
@@ -489,6 +485,8 @@ start-e2e-local: mod-vendor-local dep-ui-local cli-local
ARGOCD_APPLICATIONSET_CONTROLLER_TOKENREF_STRICT_MODE=true \
ARGOCD_APPLICATIONSET_CONTROLLER_ALLOWED_SCM_PROVIDERS=http://127.0.0.1:8341,http://127.0.0.1:8342,http://127.0.0.1:8343,http://127.0.0.1:8344 \
ARGOCD_E2E_TEST=true \
ARGOCD_HYDRATOR_ENABLED=true \
ARGOCD_CLUSTER_CACHE_EVENTS_PROCESSING_INTERVAL=1ms \
goreman -f $(ARGOCD_PROCFILE) start ${ARGOCD_START}
ls -lrt /tmp/coverage
@@ -597,6 +595,7 @@ install-codegen-tools-local:
.PHONY: install-go-tools-local
install-go-tools-local:
./hack/install.sh codegen-go-tools
./hack/install.sh lint-tools
.PHONY: dep-ui
dep-ui: test-tools-image
@@ -677,7 +676,6 @@ help:
@echo 'debug:'
@echo ' list -- list all make targets'
@echo ' install-tools-local -- install all the tools below'
@echo ' install-lint-tools(-local)'
@echo
@echo 'codegen:'
@echo ' codegen(-local) -- if using -local, run the following targets first'

View File

@@ -1,9 +1,10 @@
controller: [ "$BIN_MODE" = 'true' ] && COMMAND=./dist/argocd || COMMAND='go run ./cmd/main.go' && sh -c "GOCOVERDIR=${ARGOCD_COVERAGE_DIR:-/tmp/coverage/app-controller} HOSTNAME=testappcontroller-1 FORCE_LOG_COLORS=1 ARGOCD_FAKE_IN_CLUSTER=true ARGOCD_TLS_DATA_PATH=${ARGOCD_TLS_DATA_PATH:-/tmp/argocd-local/tls} ARGOCD_SSH_DATA_PATH=${ARGOCD_SSH_DATA_PATH:-/tmp/argocd-local/ssh} ARGOCD_BINARY_NAME=argocd-application-controller $COMMAND --loglevel debug --redis localhost:${ARGOCD_E2E_REDIS_PORT:-6379} --repo-server localhost:${ARGOCD_E2E_REPOSERVER_PORT:-8081} --otlp-address=${ARGOCD_OTLP_ADDRESS} --application-namespaces=${ARGOCD_APPLICATION_NAMESPACES:-''} --server-side-diff-enabled=${ARGOCD_APPLICATION_CONTROLLER_SERVER_SIDE_DIFF:-'false'}"
api-server: [ "$BIN_MODE" = 'true' ] && COMMAND=./dist/argocd || COMMAND='go run ./cmd/main.go' && sh -c "GOCOVERDIR=${ARGOCD_COVERAGE_DIR:-/tmp/coverage/api-server} FORCE_LOG_COLORS=1 ARGOCD_FAKE_IN_CLUSTER=true ARGOCD_TLS_DATA_PATH=${ARGOCD_TLS_DATA_PATH:-/tmp/argocd-local/tls} ARGOCD_SSH_DATA_PATH=${ARGOCD_SSH_DATA_PATH:-/tmp/argocd-local/ssh} ARGOCD_BINARY_NAME=argocd-server $COMMAND --loglevel debug --redis localhost:${ARGOCD_E2E_REDIS_PORT:-6379} --disable-auth=${ARGOCD_E2E_DISABLE_AUTH:-'true'} --insecure --dex-server http://localhost:${ARGOCD_E2E_DEX_PORT:-5556} --repo-server localhost:${ARGOCD_E2E_REPOSERVER_PORT:-8081} --port ${ARGOCD_E2E_APISERVER_PORT:-8080} --otlp-address=${ARGOCD_OTLP_ADDRESS} --application-namespaces=${ARGOCD_APPLICATION_NAMESPACES:-''}"
dex: sh -c "ARGOCD_BINARY_NAME=argocd-dex go run github.com/argoproj/argo-cd/v2/cmd gendexcfg -o `pwd`/dist/dex.yaml && (test -f dist/dex.yaml || { echo 'Failed to generate dex configuration'; exit 1; }) && docker run --rm -p ${ARGOCD_E2E_DEX_PORT:-5556}:${ARGOCD_E2E_DEX_PORT:-5556} -v `pwd`/dist/dex.yaml:/dex.yaml ghcr.io/dexidp/dex:$(grep "image: ghcr.io/dexidp/dex" manifests/base/dex/argocd-dex-server-deployment.yaml | cut -d':' -f3) dex serve /dex.yaml"
controller: [ "$BIN_MODE" = 'true' ] && COMMAND=./dist/argocd || COMMAND='go run ./cmd/main.go' && sh -c "GOCOVERDIR=${ARGOCD_COVERAGE_DIR:-/tmp/coverage/app-controller} HOSTNAME=testappcontroller-1 FORCE_LOG_COLORS=1 ARGOCD_FAKE_IN_CLUSTER=true ARGOCD_TLS_DATA_PATH=${ARGOCD_TLS_DATA_PATH:-/tmp/argocd-local/tls} ARGOCD_SSH_DATA_PATH=${ARGOCD_SSH_DATA_PATH:-/tmp/argocd-local/ssh} ARGOCD_BINARY_NAME=argocd-application-controller $COMMAND --loglevel debug --redis localhost:${ARGOCD_E2E_REDIS_PORT:-6379} --repo-server localhost:${ARGOCD_E2E_REPOSERVER_PORT:-8081} --commit-server localhost:${ARGOCD_E2E_COMMITSERVER_PORT:-8086} --otlp-address=${ARGOCD_OTLP_ADDRESS} --application-namespaces=${ARGOCD_APPLICATION_NAMESPACES:-''} --server-side-diff-enabled=${ARGOCD_APPLICATION_CONTROLLER_SERVER_SIDE_DIFF:-'false'} --hydrator-enabled=${ARGOCD_HYDRATOR_ENABLED:='false'}"
api-server: [ "$BIN_MODE" = 'true' ] && COMMAND=./dist/argocd || COMMAND='go run ./cmd/main.go' && sh -c "GOCOVERDIR=${ARGOCD_COVERAGE_DIR:-/tmp/coverage/api-server} FORCE_LOG_COLORS=1 ARGOCD_FAKE_IN_CLUSTER=true ARGOCD_TLS_DATA_PATH=${ARGOCD_TLS_DATA_PATH:-/tmp/argocd-local/tls} ARGOCD_SSH_DATA_PATH=${ARGOCD_SSH_DATA_PATH:-/tmp/argocd-local/ssh} ARGOCD_BINARY_NAME=argocd-server $COMMAND --loglevel debug --redis localhost:${ARGOCD_E2E_REDIS_PORT:-6379} --disable-auth=${ARGOCD_E2E_DISABLE_AUTH:-'true'} --insecure --dex-server http://localhost:${ARGOCD_E2E_DEX_PORT:-5556} --repo-server localhost:${ARGOCD_E2E_REPOSERVER_PORT:-8081} --port ${ARGOCD_E2E_APISERVER_PORT:-8080} --otlp-address=${ARGOCD_OTLP_ADDRESS} --application-namespaces=${ARGOCD_APPLICATION_NAMESPACES:-''} --hydrator-enabled=${ARGOCD_HYDRATOR_ENABLED:='false'}"
dex: sh -c "ARGOCD_BINARY_NAME=argocd-dex go run github.com/argoproj/argo-cd/v3/cmd gendexcfg -o `pwd`/dist/dex.yaml && (test -f dist/dex.yaml || { echo 'Failed to generate dex configuration'; exit 1; }) && docker run --rm -p ${ARGOCD_E2E_DEX_PORT:-5556}:${ARGOCD_E2E_DEX_PORT:-5556} -v `pwd`/dist/dex.yaml:/dex.yaml ghcr.io/dexidp/dex:$(grep "image: ghcr.io/dexidp/dex" manifests/base/dex/argocd-dex-server-deployment.yaml | cut -d':' -f3) dex serve /dex.yaml"
redis: hack/start-redis-with-password.sh
repo-server: [ "$BIN_MODE" = 'true' ] && COMMAND=./dist/argocd || COMMAND='go run ./cmd/main.go' && sh -c "GOCOVERDIR=${ARGOCD_COVERAGE_DIR:-/tmp/coverage/repo-server} FORCE_LOG_COLORS=1 ARGOCD_FAKE_IN_CLUSTER=true ARGOCD_GNUPGHOME=${ARGOCD_GNUPGHOME:-/tmp/argocd-local/gpg/keys} ARGOCD_PLUGINSOCKFILEPATH=${ARGOCD_PLUGINSOCKFILEPATH:-./test/cmp} ARGOCD_GPG_DATA_PATH=${ARGOCD_GPG_DATA_PATH:-/tmp/argocd-local/gpg/source} ARGOCD_TLS_DATA_PATH=${ARGOCD_TLS_DATA_PATH:-/tmp/argocd-local/tls} ARGOCD_SSH_DATA_PATH=${ARGOCD_SSH_DATA_PATH:-/tmp/argocd-local/ssh} ARGOCD_BINARY_NAME=argocd-repo-server ARGOCD_GPG_ENABLED=${ARGOCD_GPG_ENABLED:-false} $COMMAND --loglevel debug --port ${ARGOCD_E2E_REPOSERVER_PORT:-8081} --redis localhost:${ARGOCD_E2E_REDIS_PORT:-6379} --otlp-address=${ARGOCD_OTLP_ADDRESS}"
cmp-server: [ "$ARGOCD_E2E_TEST" = 'true' ] && exit 0 || [ "$BIN_MODE" = 'true' ] && COMMAND=./dist/argocd || COMMAND='go run ./cmd/main.go' && sh -c "FORCE_LOG_COLORS=1 ARGOCD_FAKE_IN_CLUSTER=true ARGOCD_BINARY_NAME=argocd-cmp-server ARGOCD_PLUGINSOCKFILEPATH=${ARGOCD_PLUGINSOCKFILEPATH:-./test/cmp} $COMMAND --config-dir-path ./test/cmp --loglevel debug --otlp-address=${ARGOCD_OTLP_ADDRESS}"
commit-server: [ "$BIN_MODE" = 'true' ] && COMMAND=./dist/argocd || COMMAND='go run ./cmd/main.go' && sh -c "GOCOVERDIR=${ARGOCD_COVERAGE_DIR:-/tmp/coverage/commit-server} FORCE_LOG_COLORS=1 ARGOCD_BINARY_NAME=argocd-commit-server $COMMAND --loglevel debug --port ${ARGOCD_E2E_COMMITSERVER_PORT:-8086}"
ui: sh -c 'cd ui && ${ARGOCD_E2E_YARN_CMD:-yarn} start'
git-server: test/fixture/testrepos/start-git.sh
helm-registry: test/fixture/testrepos/start-helm-registry.sh

View File

@@ -30,7 +30,7 @@ Currently, the following organizations are **officially** using Argo CD:
1. [Ant Group](https://www.antgroup.com/)
1. [AppDirect](https://www.appdirect.com)
1. [Arctiq Inc.](https://www.arctiq.ca)
2. [Arturia](https://www.arturia.com)
1. [Arturia](https://www.arturia.com)
1. [ARZ Allgemeines Rechenzentrum GmbH](https://www.arz.at/)
1. [Augury](https://www.augury.com/)
1. [Autodesk](https://www.autodesk.com)
@@ -95,6 +95,7 @@ Currently, the following organizations are **officially** using Argo CD:
1. [Devopsi - Poland Software/DevOps Consulting](https://devopsi.pl/)
1. [Devtron Labs](https://github.com/devtron-labs/devtron)
1. [DigitalOcean](https://www.digitalocean.com)
1. [Divar](https://divar.ir)
1. [Divistant](https://divistant.com)
1. [Dott](https://ridedott.com)
1. [Doximity](https://www.doximity.com/)
@@ -146,6 +147,7 @@ Currently, the following organizations are **officially** using Argo CD:
1. [Hazelcast](https://hazelcast.com/)
1. [Healy](https://www.healyworld.net)
1. [Helio](https://helio.exchange)
1. [hetao101](https://www.hetao101.com/)
1. [Hetki](https://hetki.ai)
1. [hipages](https://hipages.com.au/)
1. [Hiya](https://hiya.com)
@@ -191,10 +193,10 @@ Currently, the following organizations are **officially** using Argo CD:
1. [Lian Chu Securities](https://lczq.com)
1. [Liatrio](https://www.liatrio.com)
1. [Lightricks](https://www.lightricks.com/)
1. [LINE](https://linecorp.com/en/)
1. [Loom](https://www.loom.com/)
1. [Lucid Motors](https://www.lucidmotors.com/)
1. [Lytt](https://www.lytt.co/)
1. [LY Corporation](https://www.lycorp.co.jp/en/)
1. [Magic Leap](https://www.magicleap.com/)
1. [Majid Al Futtaim](https://www.majidalfuttaim.com/)
1. [Major League Baseball](https://mlb.com)
@@ -268,6 +270,7 @@ Currently, the following organizations are **officially** using Argo CD:
1. [PITS Globale Datenrettungsdienste](https://www.pitsdatenrettung.de/)
1. [Platform9 Systems](https://platform9.com/)
1. [Polarpoint.io](https://polarpoint.io)
1. [Pollinate](https://www.pollinate.global)
1. [PostFinance](https://github.com/postfinance)
1. [Preferred Networks](https://preferred.jp/en/)
1. [Previder BV](https://previder.nl)
@@ -335,6 +338,7 @@ Currently, the following organizations are **officially** using Argo CD:
1. [Swisscom](https://www.swisscom.ch)
1. [Swissquote](https://github.com/swissquote)
1. [Syncier](https://syncier.com/)
1. [Synergy](https://synergy.net.au)
1. [Syself](https://syself.com)
1. [TableCheck](https://tablecheck.com/)
1. [Tailor Brands](https://www.tailorbrands.com)
@@ -373,6 +377,7 @@ Currently, the following organizations are **officially** using Argo CD:
1. [Vinted](https://vinted.com/)
1. [Virtuo](https://www.govirtuo.com/)
1. [VISITS Technologies](https://visits.world/en)
1. [Viya](https://viya.me)
1. [Volvo Cars](https://www.volvocars.com/)
1. [Voyager Digital](https://www.investvoyager.com/)
1. [VSHN - The DevOps Company](https://vshn.ch/)
@@ -387,6 +392,7 @@ Currently, the following organizations are **officially** using Argo CD:
1. [WooliesX](https://wooliesx.com.au/)
1. [Woolworths Group](https://www.woolworthsgroup.com.au/)
1. [WSpot](https://www.wspot.com.br/)
1. [X3M ads](https://x3mads.com)
1. [Yieldlab](https://www.yieldlab.de/)
1. [Youverify](https://youverify.co/)
1. [Yubo](https://www.yubo.live/)
@@ -394,3 +400,4 @@ Currently, the following organizations are **officially** using Argo CD:
1. [Zimpler](https://www.zimpler.com/)
1. [ZipRecuiter](https://www.ziprecruiter.com/)
1. [ZOZO](https://corp.zozo.com/)

View File

@@ -1 +1 @@
2.14.0
3.0.14

View File

@@ -28,7 +28,7 @@ import (
"github.com/google/go-cmp/cmp/cmpopts"
log "github.com/sirupsen/logrus"
corev1 "k8s.io/api/core/v1"
apierr "k8s.io/apimachinery/pkg/api/errors"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
@@ -45,19 +45,19 @@ import (
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"github.com/argoproj/argo-cd/v2/applicationset/controllers/template"
"github.com/argoproj/argo-cd/v2/applicationset/generators"
"github.com/argoproj/argo-cd/v2/applicationset/metrics"
"github.com/argoproj/argo-cd/v2/applicationset/status"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
"github.com/argoproj/argo-cd/v2/common"
"github.com/argoproj/argo-cd/v2/util/db"
"github.com/argoproj/argo-cd/v3/applicationset/controllers/template"
"github.com/argoproj/argo-cd/v3/applicationset/generators"
"github.com/argoproj/argo-cd/v3/applicationset/metrics"
"github.com/argoproj/argo-cd/v3/applicationset/status"
"github.com/argoproj/argo-cd/v3/applicationset/utils"
"github.com/argoproj/argo-cd/v3/common"
"github.com/argoproj/argo-cd/v3/util/db"
argov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
argoutil "github.com/argoproj/argo-cd/v2/util/argo"
"github.com/argoproj/argo-cd/v2/util/argo/normalizers"
argov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
argoutil "github.com/argoproj/argo-cd/v3/util/argo"
"github.com/argoproj/argo-cd/v3/util/argo/normalizers"
"github.com/argoproj/argo-cd/v2/pkg/apis/application"
"github.com/argoproj/argo-cd/v3/pkg/apis/application"
)
const (
@@ -155,6 +155,7 @@ func (r *ApplicationSetReconciler) Reconcile(ctx context.Context, req ctrl.Reque
// desiredApplications is the main list of all expected Applications from all generators in this appset.
desiredApplications, applicationSetReason, err := template.GenerateApplications(logCtx, applicationSetInfo, r.Generators, r.Renderer, r.Client)
if err != nil {
logCtx.Errorf("unable to generate applications: %v", err)
_ = r.setApplicationSetStatusCondition(ctx,
&applicationSetInfo,
argov1alpha1.ApplicationSetCondition{
@@ -164,7 +165,8 @@ func (r *ApplicationSetReconciler) Reconcile(ctx context.Context, req ctrl.Reque
Status: argov1alpha1.ApplicationSetConditionStatusTrue,
}, parametersGenerated,
)
return ctrl.Result{RequeueAfter: ReconcileRequeueOnValidationError}, err
// In order for the controller SDK to respect RequeueAfter, the error must be nil
return ctrl.Result{RequeueAfter: ReconcileRequeueOnValidationError}, nil
}
parametersGenerated = true
@@ -465,7 +467,7 @@ func (r *ApplicationSetReconciler) setApplicationSetStatusCondition(ctx context.
updatedAppset.DeepCopyInto(applicationSet)
return nil
})
if err != nil && !apierr.IsNotFound(err) {
if err != nil && !apierrors.IsNotFound(err) {
return fmt.Errorf("unable to set application set condition: %w", err)
}
}
@@ -479,24 +481,23 @@ func (r *ApplicationSetReconciler) validateGeneratedApplications(ctx context.Con
errorsByIndex := map[int]error{}
namesSet := map[string]bool{}
for i, app := range desiredApplications {
if !namesSet[app.Name] {
namesSet[app.Name] = true
} else {
if namesSet[app.Name] {
errorsByIndex[i] = fmt.Errorf("ApplicationSet %s contains applications with duplicate name: %s", applicationSetInfo.Name, app.Name)
continue
}
namesSet[app.Name] = true
appProject := &argov1alpha1.AppProject{}
err := r.Client.Get(ctx, types.NamespacedName{Name: app.Spec.Project, Namespace: r.ArgoCDNamespace}, appProject)
if err != nil {
if apierr.IsNotFound(err) {
if apierrors.IsNotFound(err) {
errorsByIndex[i] = fmt.Errorf("application references project %s which does not exist", app.Spec.Project)
continue
}
return nil, err
}
if err := utils.ValidateDestination(ctx, &app.Spec.Destination, r.KubeClientset, r.ArgoCDNamespace); err != nil {
if _, err = argoutil.GetDestinationCluster(ctx, app.Spec.Destination, r.ArgoDB); err != nil {
errorsByIndex[i] = fmt.Errorf("application destination spec is invalid: %s", err.Error())
continue
}
@@ -525,11 +526,9 @@ func (r *ApplicationSetReconciler) getMinRequeueAfter(applicationSetInfo *argov1
}
func ignoreNotAllowedNamespaces(namespaces []string) predicate.Predicate {
return predicate.Funcs{
CreateFunc: func(e event.CreateEvent) bool {
return utils.IsNamespaceAllowed(namespaces, e.Object.GetNamespace())
},
}
return predicate.NewPredicateFuncs(func(object client.Object) bool {
return utils.IsNamespaceAllowed(namespaces, object.GetNamespace())
})
}
func appControllerIndexer(rawObj client.Object) []string {
@@ -553,12 +552,13 @@ func (r *ApplicationSetReconciler) SetupWithManager(mgr ctrl.Manager, enableProg
return fmt.Errorf("error setting up with manager: %w", err)
}
ownsHandler := getOwnsHandlerPredicates(enableProgressiveSyncs)
appOwnsHandler := getApplicationOwnsHandler(enableProgressiveSyncs)
appSetOwnsHandler := getApplicationSetOwnsHandler(enableProgressiveSyncs)
return ctrl.NewControllerManagedBy(mgr).WithOptions(controller.Options{
MaxConcurrentReconciles: maxConcurrentReconciliations,
}).For(&argov1alpha1.ApplicationSet{}).
Owns(&argov1alpha1.Application{}, builder.WithPredicates(ownsHandler)).
}).For(&argov1alpha1.ApplicationSet{}, builder.WithPredicates(appSetOwnsHandler)).
Owns(&argov1alpha1.Application{}, builder.WithPredicates(appOwnsHandler)).
WithEventFilter(ignoreNotAllowedNamespaces(r.ApplicationSetNamespaces)).
Watches(
&corev1.Secret{},
@@ -566,7 +566,6 @@ func (r *ApplicationSetReconciler) SetupWithManager(mgr ctrl.Manager, enableProg
Client: mgr.GetClient(),
Log: log.WithField("type", "createSecretEventHandler"),
}).
// TODO: also watch Applications and respond on changes if we own them.
Complete(r)
}
@@ -721,9 +720,6 @@ func (r *ApplicationSetReconciler) getCurrentApplications(ctx context.Context, a
// deleteInCluster will delete Applications that are currently on the cluster, but not in appList.
// The function must be called after all generators had been called and generated applications
func (r *ApplicationSetReconciler) deleteInCluster(ctx context.Context, logCtx *log.Entry, applicationSet argov1alpha1.ApplicationSet, desiredApplications []argov1alpha1.Application) error {
// settingsMgr := settings.NewSettingsManager(context.TODO(), r.KubeClientset, applicationSet.Namespace)
// argoDB := db.NewDB(applicationSet.Namespace, settingsMgr, r.KubeClientset)
// clusterList, err := argoDB.ListClusters(ctx)
clusterList, err := utils.ListClusters(ctx, r.KubeClientset, r.ArgoCDNamespace)
if err != nil {
return fmt.Errorf("error listing clusters: %w", err)
@@ -774,7 +770,7 @@ func (r *ApplicationSetReconciler) deleteInCluster(ctx context.Context, logCtx *
}
// removeFinalizerOnInvalidDestination removes the Argo CD resources finalizer if the application contains an invalid target (eg missing cluster)
func (r *ApplicationSetReconciler) removeFinalizerOnInvalidDestination(ctx context.Context, applicationSet argov1alpha1.ApplicationSet, app *argov1alpha1.Application, clusterList *argov1alpha1.ClusterList, appLog *log.Entry) error {
func (r *ApplicationSetReconciler) removeFinalizerOnInvalidDestination(ctx context.Context, applicationSet argov1alpha1.ApplicationSet, app *argov1alpha1.Application, clusterList []utils.ClusterSpecifier, appLog *log.Entry) error {
// Only check if the finalizers need to be removed IF there are finalizers to remove
if len(app.Finalizers) == 0 {
return nil
@@ -783,21 +779,18 @@ func (r *ApplicationSetReconciler) removeFinalizerOnInvalidDestination(ctx conte
var validDestination bool
// Detect if the destination is invalid (name doesn't correspond to a matching cluster)
if err := utils.ValidateDestination(ctx, &app.Spec.Destination, r.KubeClientset, r.ArgoCDNamespace); err != nil {
if destCluster, err := argoutil.GetDestinationCluster(ctx, app.Spec.Destination, r.ArgoDB); err != nil {
appLog.Warnf("The destination cluster for %s couldn't be found: %v", app.Name, err)
validDestination = false
} else {
// Detect if the destination's server field does not match an existing cluster
matchingCluster := false
for _, cluster := range clusterList.Items {
// Server fields must match. Note that ValidateDestination ensures that the server field is set, if applicable.
if app.Spec.Destination.Server != cluster.Server {
for _, cluster := range clusterList {
if destCluster.Server != cluster.Server {
continue
}
// The name must match, if it is not empty
if app.Spec.Destination.Name != "" && cluster.Name != app.Spec.Destination.Name {
if destCluster.Name != cluster.Name {
continue
}
@@ -982,17 +975,16 @@ func (r *ApplicationSetReconciler) buildAppSyncMap(applicationSet argov1alpha1.A
}
appStatus := applicationSet.Status.ApplicationStatus[idx]
if app, ok := appMap[appName]; ok {
syncEnabled = appSyncEnabledForNextStep(&applicationSet, app, appStatus)
if !syncEnabled {
break
}
} else {
app, ok := appMap[appName]
if !ok {
// application name not found in the list of applications managed by this ApplicationSet, maybe because it's being deleted
syncEnabled = false
break
}
syncEnabled = appSyncEnabledForNextStep(&applicationSet, app, appStatus)
if !syncEnabled {
break
}
}
}
@@ -1062,19 +1054,20 @@ func (r *ApplicationSetReconciler) updateApplicationSetApplicationStatus(ctx con
Message: "No Application status found, defaulting status to Waiting.",
Status: "Waiting",
Step: strconv.Itoa(getAppStep(app.Name, appStepMap)),
TargetRevisions: app.Status.GetRevisions(),
}
} else {
// we have an existing AppStatus
currentAppStatus = applicationSet.Status.ApplicationStatus[idx]
// upgrade any existing AppStatus that might have been set by an older argo-cd version
// note: currentAppStatus.TargetRevisions may be set to empty list earlier during migrations,
// to prevent other usage of r.Client.Status().Update to fail before reaching here.
if len(currentAppStatus.TargetRevisions) == 0 {
currentAppStatus.TargetRevisions = app.Status.GetRevisions()
if !reflect.DeepEqual(currentAppStatus.TargetRevisions, app.Status.GetRevisions()) {
currentAppStatus.Message = "Application has pending changes, setting status to Waiting."
}
}
if !reflect.DeepEqual(currentAppStatus.TargetRevisions, app.Status.GetRevisions()) {
currentAppStatus.TargetRevisions = app.Status.GetRevisions()
currentAppStatus.Status = "Waiting"
currentAppStatus.LastTransitionTime = &now
currentAppStatus.Step = strconv.Itoa(getAppStep(currentAppStatus.Application, appStepMap))
}
appOutdated := false
if progressiveSyncsRollingSyncStrategyEnabled(applicationSet) {
@@ -1087,25 +1080,15 @@ func (r *ApplicationSetReconciler) updateApplicationSetApplicationStatus(ctx con
currentAppStatus.Status = "Waiting"
currentAppStatus.Message = "Application has pending changes, setting status to Waiting."
currentAppStatus.Step = strconv.Itoa(getAppStep(currentAppStatus.Application, appStepMap))
currentAppStatus.TargetRevisions = app.Status.GetRevisions()
}
if currentAppStatus.Status == "Pending" {
if operationPhaseString == "Succeeded" {
revisions := []string{}
if len(app.Status.OperationState.SyncResult.Revisions) > 0 {
revisions = app.Status.OperationState.SyncResult.Revisions
} else if app.Status.OperationState.SyncResult.Revision != "" {
revisions = append(revisions, app.Status.OperationState.SyncResult.Revision)
}
if reflect.DeepEqual(currentAppStatus.TargetRevisions, revisions) {
logCtx.Infof("Application %v has completed a sync successfully, updating its ApplicationSet status to Progressing", app.Name)
currentAppStatus.LastTransitionTime = &now
currentAppStatus.Status = "Progressing"
currentAppStatus.Message = "Application resource completed a sync successfully, updating status from Pending to Progressing."
currentAppStatus.Step = strconv.Itoa(getAppStep(currentAppStatus.Application, appStepMap))
}
if !appOutdated && operationPhaseString == "Succeeded" {
logCtx.Infof("Application %v has completed a sync successfully, updating its ApplicationSet status to Progressing", app.Name)
currentAppStatus.LastTransitionTime = &now
currentAppStatus.Status = "Progressing"
currentAppStatus.Message = "Application resource completed a sync successfully, updating status from Pending to Progressing."
currentAppStatus.Step = strconv.Itoa(getAppStep(currentAppStatus.Application, appStepMap))
} else if operationPhaseString == "Running" || healthStatusString == "Progressing" {
logCtx.Infof("Application %v has entered Progressing status, updating its ApplicationSet status to Progressing", app.Name)
currentAppStatus.LastTransitionTime = &now
@@ -1162,10 +1145,10 @@ func (r *ApplicationSetReconciler) updateApplicationSetApplicationStatusProgress
// populate updateCountMap with counts of existing Pending and Progressing Applications
for _, appStatus := range applicationSet.Status.ApplicationStatus {
totalCountMap[appStepMap[appStatus.Application]] += 1
totalCountMap[appStepMap[appStatus.Application]]++
if appStatus.Status == "Pending" || appStatus.Status == "Progressing" {
updateCountMap[appStepMap[appStatus.Application]] += 1
updateCountMap[appStepMap[appStatus.Application]]++
}
}
@@ -1201,7 +1184,7 @@ func (r *ApplicationSetReconciler) updateApplicationSetApplicationStatusProgress
appStatus.Message = "Application moved to Pending status, watching for the Application resource to start Progressing."
appStatus.Step = strconv.Itoa(getAppStep(appStatus.Application, appStepMap))
updateCountMap[appStepMap[appStatus.Application]] += 1
updateCountMap[appStepMap[appStatus.Application]]++
}
appStatuses = append(appStatuses, appStatus)
@@ -1302,7 +1285,7 @@ func (r *ApplicationSetReconciler) migrateStatus(ctx context.Context, appset *ar
updatedAppset.DeepCopyInto(appset)
return nil
})
if err != nil && !apierr.IsNotFound(err) {
if err != nil && !apierrors.IsNotFound(err) {
return fmt.Errorf("unable to set application set condition: %w", err)
}
}
@@ -1467,7 +1450,7 @@ func syncApplication(application argov1alpha1.Application, prune bool) argov1alp
return application
}
func getOwnsHandlerPredicates(enableProgressiveSyncs bool) predicate.Funcs {
func getApplicationOwnsHandler(enableProgressiveSyncs bool) predicate.Funcs {
return predicate.Funcs{
CreateFunc: func(e event.CreateEvent) bool {
// if we are the owner and there is a create event, we most likely created it and do not need to
@@ -1504,8 +1487,8 @@ func getOwnsHandlerPredicates(enableProgressiveSyncs bool) predicate.Funcs {
if !isApp {
return false
}
requeue := shouldRequeueApplicationSet(appOld, appNew, enableProgressiveSyncs)
logCtx.WithField("requeue", requeue).Debugf("requeue: %t caused by application %s", requeue, appNew.Name)
requeue := shouldRequeueForApplication(appOld, appNew, enableProgressiveSyncs)
logCtx.WithField("requeue", requeue).Debugf("requeue caused by application %s", appNew.Name)
return requeue
},
GenericFunc: func(e event.GenericEvent) bool {
@@ -1522,13 +1505,13 @@ func getOwnsHandlerPredicates(enableProgressiveSyncs bool) predicate.Funcs {
}
}
// shouldRequeueApplicationSet determines when we want to requeue an ApplicationSet for reconciling based on an owned
// shouldRequeueForApplication determines when we want to requeue an ApplicationSet for reconciling based on an owned
// application change
// The applicationset controller owns a subset of the Application CR.
// We do not need to re-reconcile if parts of the application change outside the applicationset's control.
// An example being, Application.ApplicationStatus.ReconciledAt which gets updated by the application controller.
// Additionally, Application.ObjectMeta.ResourceVersion and Application.ObjectMeta.Generation which are set by K8s.
func shouldRequeueApplicationSet(appOld *argov1alpha1.Application, appNew *argov1alpha1.Application, enableProgressiveSyncs bool) bool {
func shouldRequeueForApplication(appOld *argov1alpha1.Application, appNew *argov1alpha1.Application, enableProgressiveSyncs bool) bool {
if appOld == nil || appNew == nil {
return false
}
@@ -1561,4 +1544,90 @@ func shouldRequeueApplicationSet(appOld *argov1alpha1.Application, appNew *argov
return false
}
func getApplicationSetOwnsHandler(enableProgressiveSyncs bool) predicate.Funcs {
return predicate.Funcs{
CreateFunc: func(e event.CreateEvent) bool {
appSet, isApp := e.Object.(*argov1alpha1.ApplicationSet)
if !isApp {
return false
}
log.WithField("applicationset", appSet.QualifiedName()).Debugln("received create event")
// Always queue a new applicationset
return true
},
DeleteFunc: func(e event.DeleteEvent) bool {
appSet, isApp := e.Object.(*argov1alpha1.ApplicationSet)
if !isApp {
return false
}
log.WithField("applicationset", appSet.QualifiedName()).Debugln("received delete event")
// Always queue for the deletion of an applicationset
return true
},
UpdateFunc: func(e event.UpdateEvent) bool {
appSetOld, isAppSet := e.ObjectOld.(*argov1alpha1.ApplicationSet)
if !isAppSet {
return false
}
appSetNew, isAppSet := e.ObjectNew.(*argov1alpha1.ApplicationSet)
if !isAppSet {
return false
}
requeue := shouldRequeueForApplicationSet(appSetOld, appSetNew, enableProgressiveSyncs)
log.WithField("applicationset", appSetNew.QualifiedName()).
WithField("requeue", requeue).Debugln("received update event")
return requeue
},
GenericFunc: func(e event.GenericEvent) bool {
appSet, isApp := e.Object.(*argov1alpha1.ApplicationSet)
if !isApp {
return false
}
log.WithField("applicationset", appSet.QualifiedName()).Debugln("received generic event")
// Always queue for the generic of an applicationset
return true
},
}
}
// shouldRequeueForApplicationSet determines when we need to requeue an applicationset
func shouldRequeueForApplicationSet(appSetOld, appSetNew *argov1alpha1.ApplicationSet, enableProgressiveSyncs bool) bool {
if appSetOld == nil || appSetNew == nil {
return false
}
// Requeue if any ApplicationStatus.Status changed for Progressive sync strategy
if enableProgressiveSyncs {
if !cmp.Equal(appSetOld.Status.ApplicationStatus, appSetNew.Status.ApplicationStatus, cmpopts.EquateEmpty()) {
return true
}
}
// only compare the applicationset spec, annotations, labels and finalizers, deletionTimestamp, specifically avoiding
// the status field. status is owned by the applicationset controller,
// and we do not need to requeue when it does bookkeeping
// NB: the ApplicationDestination comes from the ApplicationSpec being embedded
// in the ApplicationSetTemplate from the generators
if !cmp.Equal(appSetOld.Spec, appSetNew.Spec, cmpopts.EquateEmpty(), cmpopts.EquateComparable(argov1alpha1.ApplicationDestination{})) ||
!cmp.Equal(appSetOld.GetLabels(), appSetNew.GetLabels(), cmpopts.EquateEmpty()) ||
!cmp.Equal(appSetOld.GetFinalizers(), appSetNew.GetFinalizers(), cmpopts.EquateEmpty()) ||
!cmp.Equal(appSetOld.DeletionTimestamp, appSetNew.DeletionTimestamp, cmpopts.EquateEmpty()) {
return true
}
// Requeue only when the refresh annotation is newly added to the ApplicationSet.
// Changes to other annotations made simultaneously might be missed, but such cases are rare.
if !cmp.Equal(appSetOld.ObjectMeta.GetAnnotations(), appSetNew.ObjectMeta.GetAnnotations(), cmpopts.EquateEmpty()) {
_, oldHasRefreshAnnotation := appSetOld.Annotations[common.AnnotationApplicationSetRefresh]
_, newHasRefreshAnnotation := appSetNew.Annotations[common.AnnotationApplicationSetRefresh]
if oldHasRefreshAnnotation && !newHasRefreshAnnotation {
return false
}
return true
}
return false
}
var _ handler.EventHandler = &clusterSecretEventHandler{}

File diff suppressed because it is too large Load Diff

View File

@@ -14,8 +14,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/event"
"github.com/argoproj/argo-cd/v2/common"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/common"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
// clusterSecretEventHandler is used when watching Secrets to check if they are ArgoCD Cluster Secrets, and if so

View File

@@ -1,24 +1,23 @@
package controllers
import (
"context"
"testing"
argocommon "github.com/argoproj/argo-cd/v2/common"
argocommon "github.com/argoproj/argo-cd/v3/common"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
argov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
argov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func TestClusterEventHandler(t *testing.T) {
@@ -39,7 +38,7 @@ func TestClusterEventHandler(t *testing.T) {
name: "no application sets should mean no requests",
items: []argov1alpha1.ApplicationSet{},
secret: corev1.Secret{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: "argocd",
Name: "my-secret",
Labels: map[string]string{
@@ -53,7 +52,7 @@ func TestClusterEventHandler(t *testing.T) {
name: "a cluster generator should produce a request",
items: []argov1alpha1.ApplicationSet{
{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "my-app-set",
Namespace: "argocd",
},
@@ -67,7 +66,7 @@ func TestClusterEventHandler(t *testing.T) {
},
},
secret: corev1.Secret{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: "argocd",
Name: "my-secret",
Labels: map[string]string{
@@ -83,7 +82,7 @@ func TestClusterEventHandler(t *testing.T) {
name: "multiple cluster generators should produce multiple requests",
items: []argov1alpha1.ApplicationSet{
{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "my-app-set",
Namespace: "argocd",
},
@@ -96,7 +95,7 @@ func TestClusterEventHandler(t *testing.T) {
},
},
{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "my-app-set2",
Namespace: "argocd",
},
@@ -110,7 +109,7 @@ func TestClusterEventHandler(t *testing.T) {
},
},
secret: corev1.Secret{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: "argocd",
Name: "my-secret",
Labels: map[string]string{
@@ -127,7 +126,7 @@ func TestClusterEventHandler(t *testing.T) {
name: "non-cluster generator should not match",
items: []argov1alpha1.ApplicationSet{
{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "my-app-set",
Namespace: "another-namespace",
},
@@ -140,7 +139,7 @@ func TestClusterEventHandler(t *testing.T) {
},
},
{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "app-set-non-cluster",
Namespace: "argocd",
},
@@ -154,7 +153,7 @@ func TestClusterEventHandler(t *testing.T) {
},
},
secret: corev1.Secret{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: "argocd",
Name: "my-secret",
Labels: map[string]string{
@@ -170,7 +169,7 @@ func TestClusterEventHandler(t *testing.T) {
name: "non-argo cd secret should not match",
items: []argov1alpha1.ApplicationSet{
{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "my-app-set",
Namespace: "another-namespace",
},
@@ -184,7 +183,7 @@ func TestClusterEventHandler(t *testing.T) {
},
},
secret: corev1.Secret{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: "argocd",
Name: "my-non-argocd-secret",
},
@@ -195,7 +194,7 @@ func TestClusterEventHandler(t *testing.T) {
name: "a matrix generator with a cluster generator should produce a request",
items: []argov1alpha1.ApplicationSet{
{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "my-app-set",
Namespace: "argocd",
},
@@ -215,7 +214,7 @@ func TestClusterEventHandler(t *testing.T) {
},
},
secret: corev1.Secret{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: "argocd",
Name: "my-secret",
Labels: map[string]string{
@@ -231,7 +230,7 @@ func TestClusterEventHandler(t *testing.T) {
name: "a matrix generator with non cluster generator should not match",
items: []argov1alpha1.ApplicationSet{
{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "my-app-set",
Namespace: "argocd",
},
@@ -251,7 +250,7 @@ func TestClusterEventHandler(t *testing.T) {
},
},
secret: corev1.Secret{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: "argocd",
Name: "my-secret",
Labels: map[string]string{
@@ -265,7 +264,7 @@ func TestClusterEventHandler(t *testing.T) {
name: "a matrix generator with a nested matrix generator containing a cluster generator should produce a request",
items: []argov1alpha1.ApplicationSet{
{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "my-app-set",
Namespace: "argocd",
},
@@ -301,7 +300,7 @@ func TestClusterEventHandler(t *testing.T) {
},
},
secret: corev1.Secret{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: "argocd",
Name: "my-secret",
Labels: map[string]string{
@@ -317,7 +316,7 @@ func TestClusterEventHandler(t *testing.T) {
name: "a matrix generator with a nested matrix generator containing non cluster generator should not match",
items: []argov1alpha1.ApplicationSet{
{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "my-app-set",
Namespace: "argocd",
},
@@ -352,7 +351,7 @@ func TestClusterEventHandler(t *testing.T) {
},
},
secret: corev1.Secret{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: "argocd",
Name: "my-secret",
Labels: map[string]string{
@@ -366,7 +365,7 @@ func TestClusterEventHandler(t *testing.T) {
name: "a merge generator with a cluster generator should produce a request",
items: []argov1alpha1.ApplicationSet{
{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "my-app-set",
Namespace: "argocd",
},
@@ -386,7 +385,7 @@ func TestClusterEventHandler(t *testing.T) {
},
},
secret: corev1.Secret{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: "argocd",
Name: "my-secret",
Labels: map[string]string{
@@ -402,7 +401,7 @@ func TestClusterEventHandler(t *testing.T) {
name: "a matrix generator with non cluster generator should not match",
items: []argov1alpha1.ApplicationSet{
{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "my-app-set",
Namespace: "argocd",
},
@@ -422,7 +421,7 @@ func TestClusterEventHandler(t *testing.T) {
},
},
secret: corev1.Secret{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: "argocd",
Name: "my-secret",
Labels: map[string]string{
@@ -436,7 +435,7 @@ func TestClusterEventHandler(t *testing.T) {
name: "a merge generator with a nested merge generator containing a cluster generator should produce a request",
items: []argov1alpha1.ApplicationSet{
{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "my-app-set",
Namespace: "argocd",
},
@@ -472,7 +471,7 @@ func TestClusterEventHandler(t *testing.T) {
},
},
secret: corev1.Secret{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: "argocd",
Name: "my-secret",
Labels: map[string]string{
@@ -488,7 +487,7 @@ func TestClusterEventHandler(t *testing.T) {
name: "a merge generator with a nested merge generator containing non cluster generator should not match",
items: []argov1alpha1.ApplicationSet{
{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "my-app-set",
Namespace: "argocd",
},
@@ -523,7 +522,7 @@ func TestClusterEventHandler(t *testing.T) {
},
},
secret: corev1.Secret{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: "argocd",
Name: "my-secret",
Labels: map[string]string{
@@ -550,7 +549,7 @@ func TestClusterEventHandler(t *testing.T) {
mockAddRateLimitingInterface := mockAddRateLimitingInterface{}
handler.queueRelatedAppGenerators(context.Background(), &mockAddRateLimitingInterface, &test.secret)
handler.queueRelatedAppGenerators(t.Context(), &mockAddRateLimitingInterface, &test.secret)
assert.ElementsMatch(t, mockAddRateLimitingInterface.addedItems, test.expectedRequests)
})

View File

@@ -1,7 +1,6 @@
package controllers
import (
"context"
"testing"
"time"
@@ -16,15 +15,15 @@ import (
"k8s.io/client-go/tools/record"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"github.com/argoproj/argo-cd/v2/applicationset/generators"
appsetmetrics "github.com/argoproj/argo-cd/v2/applicationset/metrics"
"github.com/argoproj/argo-cd/v2/applicationset/services/mocks"
argov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/applicationset/generators"
appsetmetrics "github.com/argoproj/argo-cd/v3/applicationset/metrics"
"github.com/argoproj/argo-cd/v3/applicationset/services/mocks"
argov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func TestRequeueAfter(t *testing.T) {
mockServer := &mocks.Repos{}
ctx := context.Background()
ctx := t.Context()
scheme := runtime.NewScheme()
err := argov1alpha1.AddToScheme(scheme)
require.NoError(t, err)
@@ -36,20 +35,20 @@ func TestRequeueAfter(t *testing.T) {
appClientset := kubefake.NewSimpleClientset()
k8sClient := fake.NewClientBuilder().Build()
duckType := &unstructured.Unstructured{
Object: map[string]interface{}{
Object: map[string]any{
"apiVersion": "v2quack",
"kind": "Duck",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"name": "mightyduck",
"namespace": "namespace",
"labels": map[string]interface{}{"duck": "all-species"},
"labels": map[string]any{"duck": "all-species"},
},
"status": map[string]interface{}{
"decisions": []interface{}{
map[string]interface{}{
"status": map[string]any{
"decisions": []any{
map[string]any{
"clusterName": "staging-01",
},
map[string]interface{}{
map[string]any{
"clusterName": "production-01",
},
},
@@ -60,7 +59,7 @@ func TestRequeueAfter(t *testing.T) {
scmConfig := generators.NewSCMConfig("", []string{""}, true, nil, true)
terminalGenerators := map[string]generators.Generator{
"List": generators.NewListGenerator(),
"Clusters": generators.NewClusterGenerator(k8sClient, ctx, appClientset, "argocd"),
"Clusters": generators.NewClusterGenerator(ctx, k8sClient, appClientset, "argocd"),
"Git": generators.NewGitGenerator(mockServer, "namespace"),
"SCMProvider": generators.NewSCMProviderGenerator(fake.NewClientBuilder().WithObjects(&corev1.Secret{}).Build(), scmConfig),
"ClusterDecisionResource": generators.NewDuckTypeGenerator(ctx, fakeDynClient, appClientset, "argocd"),
@@ -90,7 +89,7 @@ func TestRequeueAfter(t *testing.T) {
}
client := fake.NewClientBuilder().WithScheme(scheme).Build()
metrics := appsetmetrics.NewFakeAppsetMetrics(client)
metrics := appsetmetrics.NewFakeAppsetMetrics()
r := ApplicationSetReconciler{
Client: client,
Scheme: scheme,

View File

@@ -6,8 +6,8 @@ import (
"k8s.io/apimachinery/pkg/util/strategicpatch"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
appv1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/applicationset/utils"
appv1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func applyTemplatePatch(app *appv1.Application, templatePatch string) (*appv1.Application, error) {

View File

@@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
appv1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
appv1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func Test_ApplyTemplatePatch(t *testing.T) {

View File

@@ -7,10 +7,10 @@ import (
log "github.com/sirupsen/logrus"
"github.com/argoproj/argo-cd/v2/applicationset/generators"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
"github.com/argoproj/argo-cd/v3/applicationset/generators"
"github.com/argoproj/argo-cd/v3/applicationset/utils"
argov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
argov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func GenerateApplications(logCtx *log.Entry, applicationSetInfo argov1alpha1.ApplicationSet, g map[string]generators.Generator, renderer utils.Renderer, client client.Client) ([]argov1alpha1.Application, argov1alpha1.ApplicationSetReasonType, error) {
@@ -20,7 +20,7 @@ func GenerateApplications(logCtx *log.Entry, applicationSetInfo argov1alpha1.App
var applicationSetReason argov1alpha1.ApplicationSetReasonType
for _, requestedGenerator := range applicationSetInfo.Spec.Generators {
t, err := generators.Transform(requestedGenerator, g, applicationSetInfo.Spec.Template, &applicationSetInfo, map[string]interface{}{}, client)
t, err := generators.Transform(requestedGenerator, g, applicationSetInfo.Spec.Template, &applicationSetInfo, map[string]any{}, client)
if err != nil {
logCtx.WithError(err).WithField("generator", requestedGenerator).
Error("error generating application from params")
@@ -79,7 +79,7 @@ func GenerateApplications(logCtx *log.Entry, applicationSetInfo argov1alpha1.App
return res, applicationSetReason, firstError
}
func renderTemplatePatch(r utils.Renderer, app *argov1alpha1.Application, applicationSetInfo argov1alpha1.ApplicationSet, params map[string]interface{}) (*argov1alpha1.Application, error) {
func renderTemplatePatch(r utils.Renderer, app *argov1alpha1.Application, applicationSetInfo argov1alpha1.ApplicationSet, params map[string]any) (*argov1alpha1.Application, error) {
replacedTemplate, err := r.Replace(*applicationSetInfo.Spec.TemplatePatch, params, applicationSetInfo.Spec.GoTemplate, applicationSetInfo.Spec.GoTemplateOptions)
if err != nil {
return nil, fmt.Errorf("error replacing values in templatePatch: %w", err)

View File

@@ -1,7 +1,7 @@
package template
import (
"fmt"
"errors"
"maps"
"testing"
@@ -13,12 +13,12 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"github.com/argoproj/argo-cd/v2/applicationset/generators"
genmock "github.com/argoproj/argo-cd/v2/applicationset/generators/mocks"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
rendmock "github.com/argoproj/argo-cd/v2/applicationset/utils/mocks"
"github.com/argoproj/argo-cd/v2/pkg/apis/application"
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/applicationset/generators"
genmock "github.com/argoproj/argo-cd/v3/applicationset/generators/mocks"
"github.com/argoproj/argo-cd/v3/applicationset/utils"
rendmock "github.com/argoproj/argo-cd/v3/applicationset/utils/mocks"
"github.com/argoproj/argo-cd/v3/pkg/apis/application"
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func TestGenerateApplications(t *testing.T) {
@@ -31,7 +31,7 @@ func TestGenerateApplications(t *testing.T) {
for _, c := range []struct {
name string
params []map[string]interface{}
params []map[string]any
template v1alpha1.ApplicationSetTemplate
generateParamsError error
rendererError error
@@ -40,7 +40,7 @@ func TestGenerateApplications(t *testing.T) {
}{
{
name: "Generate two applications",
params: []map[string]interface{}{{"name": "app1"}, {"name": "app2"}},
params: []map[string]any{{"name": "app1"}, {"name": "app2"}},
template: v1alpha1.ApplicationSetTemplate{
ApplicationSetTemplateMeta: v1alpha1.ApplicationSetTemplateMeta{
Name: "name",
@@ -53,13 +53,13 @@ func TestGenerateApplications(t *testing.T) {
},
{
name: "Handles error from the generator",
generateParamsError: fmt.Errorf("error"),
generateParamsError: errors.New("error"),
expectErr: true,
expectedReason: v1alpha1.ApplicationSetReasonApplicationParamsGenerationError,
},
{
name: "Handles error from the render",
params: []map[string]interface{}{{"name": "app1"}, {"name": "app2"}},
params: []map[string]any{{"name": "app1"}, {"name": "app2"}},
template: v1alpha1.ApplicationSetTemplate{
ApplicationSetTemplateMeta: v1alpha1.ApplicationSetTemplateMeta{
Name: "name",
@@ -68,7 +68,7 @@ func TestGenerateApplications(t *testing.T) {
},
Spec: v1alpha1.ApplicationSpec{},
},
rendererError: fmt.Errorf("error"),
rendererError: errors.New("error"),
expectErr: true,
expectedReason: v1alpha1.ApplicationSetReasonRenderTemplateParamsError,
},
@@ -153,7 +153,7 @@ func TestGenerateApplications(t *testing.T) {
func TestMergeTemplateApplications(t *testing.T) {
for _, c := range []struct {
name string
params []map[string]interface{}
params []map[string]any
template v1alpha1.ApplicationSetTemplate
overrideTemplate v1alpha1.ApplicationSetTemplate
expectedMerged v1alpha1.ApplicationSetTemplate
@@ -161,7 +161,7 @@ func TestMergeTemplateApplications(t *testing.T) {
}{
{
name: "Generate app",
params: []map[string]interface{}{{"name": "app1"}},
params: []map[string]any{{"name": "app1"}},
template: v1alpha1.ApplicationSetTemplate{
ApplicationSetTemplateMeta: v1alpha1.ApplicationSetTemplateMeta{
Name: "name",
@@ -245,13 +245,13 @@ func TestMergeTemplateApplications(t *testing.T) {
func TestGenerateAppsUsingPullRequestGenerator(t *testing.T) {
for _, cases := range []struct {
name string
params []map[string]interface{}
params []map[string]any
template v1alpha1.ApplicationSetTemplate
expectedApp []v1alpha1.Application
}{
{
name: "Generate an application from a go template application set manifest using a pull request generator",
params: []map[string]interface{}{
params: []map[string]any{
{
"number": "1",
"title": "title1",

View File

@@ -14,7 +14,7 @@ spec:
app: guestbook-ui
spec:
containers:
- image: gcr.io/heptio-images/ks-guestbook-demo:0.2
- image: quay.io/argoprojlabs/argocd-e2e-container:0.2
name: guestbook-ui
ports:
- containerPort: 80

View File

@@ -14,7 +14,7 @@ spec:
app: guestbook-ui
spec:
containers:
- image: gcr.io/heptio-images/ks-guestbook-demo:0.2
- image: quay.io/argoprojlabs/argocd-e2e-container:0.2
name: guestbook-ui
ports:
- containerPort: 80

View File

@@ -5,7 +5,7 @@
replicaCount: 1
image:
repository: gcr.io/heptio-images/ks-guestbook-demo
repository: quay.io/argoprojlabs/argocd-e2e-container
tag: 0.1
pullPolicy: IfNotPresent

View File

@@ -14,7 +14,7 @@ spec:
app: guestbook-ui
spec:
containers:
- image: gcr.io/heptio-images/ks-guestbook-demo:0.2
- image: quay.io/argoprojlabs/argocd-e2e-container:0.2
name: guestbook-ui
ports:
- containerPort: 80

View File

@@ -14,7 +14,7 @@ spec:
app: guestbook-ui
spec:
containers:
- image: gcr.io/heptio-images/ks-guestbook-demo:0.2
- image: quay.io/argoprojlabs/argocd-e2e-container:0.2
name: guestbook-ui
ports:
- containerPort: 80

View File

@@ -14,7 +14,7 @@ spec:
app: guestbook-ui
spec:
containers:
- image: gcr.io/heptio-images/ks-guestbook-demo:0.2
- image: quay.io/argoprojlabs/argocd-e2e-container:0.2
name: guestbook-ui
ports:
- containerPort: 80

View File

@@ -14,7 +14,7 @@ spec:
app: guestbook-ui
spec:
containers:
- image: gcr.io/heptio-images/ks-guestbook-demo:0.2
- image: quay.io/argoprojlabs/argocd-e2e-container:0.2
name: guestbook-ui
ports:
- containerPort: 80

View File

@@ -14,7 +14,7 @@ spec:
app: guestbook-ui
spec:
containers:
- image: gcr.io/heptio-images/ks-guestbook-demo:0.2
- image: quay.io/argoprojlabs/argocd-e2e-container:0.2
name: guestbook-ui
ports:
- containerPort: 80

View File

@@ -7,16 +7,16 @@ import (
log "github.com/sirupsen/logrus"
"github.com/argoproj/argo-cd/v2/util/settings"
"github.com/argoproj/argo-cd/v3/util/settings"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
"github.com/argoproj/argo-cd/v2/common"
argoappsetv1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/applicationset/utils"
"github.com/argoproj/argo-cd/v3/common"
argoappsetv1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
var _ Generator = (*ClusterGenerator)(nil)
@@ -33,7 +33,7 @@ type ClusterGenerator struct {
var render = &utils.Render{}
func NewClusterGenerator(c client.Client, ctx context.Context, clientset kubernetes.Interface, namespace string) Generator {
func NewClusterGenerator(ctx context.Context, c client.Client, clientset kubernetes.Interface, namespace string) Generator {
settingsManager := settings.NewSettingsManager(ctx, clientset, namespace)
g := &ClusterGenerator{
@@ -56,7 +56,7 @@ func (g *ClusterGenerator) GetTemplate(appSetGenerator *argoappsetv1alpha1.Appli
return &appSetGenerator.Clusters.Template
}
func (g *ClusterGenerator) GenerateParams(appSetGenerator *argoappsetv1alpha1.ApplicationSetGenerator, appSet *argoappsetv1alpha1.ApplicationSet, _ client.Client) ([]map[string]interface{}, error) {
func (g *ClusterGenerator) GenerateParams(appSetGenerator *argoappsetv1alpha1.ApplicationSetGenerator, appSet *argoappsetv1alpha1.ApplicationSet, _ client.Client) ([]map[string]any, error) {
logCtx := log.WithField("applicationset", appSet.GetName()).WithField("namespace", appSet.GetNamespace())
if appSetGenerator == nil {
return nil, EmptyAppSetGeneratorError
@@ -70,7 +70,7 @@ func (g *ClusterGenerator) GenerateParams(appSetGenerator *argoappsetv1alpha1.Ap
// - Since local clusters do not have secrets, they do not have labels to match against
ignoreLocalClusters := len(appSetGenerator.Clusters.Selector.MatchExpressions) > 0 || len(appSetGenerator.Clusters.Selector.MatchLabels) > 0
// ListCluster from Argo CD's util/db package will include the local cluster in the list of clusters
// ListCluster will include the local cluster in the list of clusters
clustersFromArgoCD, err := utils.ListClusters(g.ctx, g.clientset, g.namespace)
if err != nil {
return nil, fmt.Errorf("error listing clusters: %w", err)
@@ -85,22 +85,22 @@ func (g *ClusterGenerator) GenerateParams(appSetGenerator *argoappsetv1alpha1.Ap
return nil, fmt.Errorf("error getting cluster secrets: %w", err)
}
res := []map[string]interface{}{}
res := []map[string]any{}
secretsFound := []corev1.Secret{}
isFlatMode := appSetGenerator.Clusters.FlatList
logCtx.Debugf("Using flat mode = %t for cluster generator", isFlatMode)
clustersParams := make([]map[string]interface{}, 0)
clustersParams := make([]map[string]any, 0)
for _, cluster := range clustersFromArgoCD.Items {
for _, cluster := range clustersFromArgoCD {
// If there is a secret for this cluster, then it's a non-local cluster, so it will be
// handled by the next step.
if secretForCluster, exists := clusterSecrets[cluster.Name]; exists {
secretsFound = append(secretsFound, secretForCluster)
} else if !ignoreLocalClusters {
// If there is no secret for the cluster, it's the local cluster, so handle it here.
params := map[string]interface{}{}
params := map[string]any{}
params["name"] = cluster.Name
params["nameNormalized"] = cluster.Name
params["server"] = cluster.Server
@@ -123,7 +123,7 @@ func (g *ClusterGenerator) GenerateParams(appSetGenerator *argoappsetv1alpha1.Ap
// For each matching cluster secret (non-local clusters only)
for _, cluster := range secretsFound {
params := map[string]interface{}{}
params := map[string]any{}
params["name"] = string(cluster.Data["name"])
params["nameNormalized"] = utils.SanitizeName(string(cluster.Data["name"]))
@@ -137,7 +137,7 @@ func (g *ClusterGenerator) GenerateParams(appSetGenerator *argoappsetv1alpha1.Ap
}
if appSet.Spec.GoTemplate {
meta := map[string]interface{}{}
meta := map[string]any{}
if len(cluster.ObjectMeta.Annotations) > 0 {
meta["annotations"] = cluster.ObjectMeta.Annotations
@@ -149,11 +149,11 @@ func (g *ClusterGenerator) GenerateParams(appSetGenerator *argoappsetv1alpha1.Ap
params["metadata"] = meta
} else {
for key, value := range cluster.ObjectMeta.Annotations {
params[fmt.Sprintf("metadata.annotations.%s", key)] = value
params["metadata.annotations."+key] = value
}
for key, value := range cluster.ObjectMeta.Labels {
params[fmt.Sprintf("metadata.labels.%s", key)] = value
params["metadata.labels."+key] = value
}
}
@@ -172,7 +172,7 @@ func (g *ClusterGenerator) GenerateParams(appSetGenerator *argoappsetv1alpha1.Ap
}
if isFlatMode {
res = append(res, map[string]interface{}{
res = append(res, map[string]any{
"clusters": clustersParams,
})
}

View File

@@ -2,7 +2,7 @@ package generators
import (
"context"
"fmt"
"errors"
"testing"
corev1 "k8s.io/api/core/v1"
@@ -13,8 +13,8 @@ import (
kubefake "k8s.io/client-go/kubernetes/fake"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/applicationset/utils"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -27,7 +27,7 @@ type possiblyErroringFakeCtrlRuntimeClient struct {
func (p *possiblyErroringFakeCtrlRuntimeClient) List(ctx context.Context, secretList client.ObjectList, opts ...client.ListOption) error {
if p.shouldError {
return fmt.Errorf("could not list Secrets")
return errors.New("could not list Secrets")
}
return p.Client.List(ctx, secretList, opts...)
}
@@ -89,7 +89,7 @@ func TestGenerateParams(t *testing.T) {
selector metav1.LabelSelector
isFlatMode bool
values map[string]string
expected []map[string]interface{}
expected []map[string]any
// clientError is true if a k8s client error should be simulated
clientError bool
expectedError error
@@ -106,7 +106,7 @@ func TestGenerateParams(t *testing.T) {
"bat": "{{ metadata.labels.environment }}",
"aaa": "{{ server }}",
"no-op": "{{ this-does-not-exist }}",
}, expected: []map[string]interface{}{
}, expected: []map[string]any{
{"values.lol1": "lol", "values.lol2": "{{values.lol1}}{{values.lol1}}", "values.lol3": "{{values.lol2}}{{values.lol2}}{{values.lol2}}", "values.foo": "bar", "values.bar": "{{ metadata.annotations.foo.argoproj.io }}", "values.no-op": "{{ this-does-not-exist }}", "values.bat": "{{ metadata.labels.environment }}", "values.aaa": "https://kubernetes.default.svc", "nameNormalized": "in-cluster", "name": "in-cluster", "server": "https://kubernetes.default.svc", "project": ""},
{
"values.lol1": "lol", "values.lol2": "{{values.lol1}}{{values.lol1}}", "values.lol3": "{{values.lol2}}{{values.lol2}}{{values.lol2}}", "values.foo": "bar", "values.bar": "production", "values.no-op": "{{ this-does-not-exist }}", "values.bat": "production", "values.aaa": "https://production-01.example.com", "name": "production_01/west", "nameNormalized": "production-01-west", "server": "https://production-01.example.com", "metadata.labels.environment": "production", "metadata.labels.org": "bar",
@@ -129,7 +129,7 @@ func TestGenerateParams(t *testing.T) {
},
},
values: nil,
expected: []map[string]interface{}{
expected: []map[string]any{
{
"name": "production_01/west", "nameNormalized": "production-01-west", "server": "https://production-01.example.com", "metadata.labels.environment": "production", "metadata.labels.org": "bar",
"metadata.labels.argocd.argoproj.io/secret-type": "cluster", "metadata.annotations.foo.argoproj.io": "production", "project": "prod-project",
@@ -153,7 +153,7 @@ func TestGenerateParams(t *testing.T) {
values: map[string]string{
"foo": "bar",
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"values.foo": "bar", "name": "production_01/west", "nameNormalized": "production-01-west", "server": "https://production-01.example.com", "metadata.labels.environment": "production", "metadata.labels.org": "bar",
"metadata.labels.argocd.argoproj.io/secret-type": "cluster", "metadata.annotations.foo.argoproj.io": "production", "project": "prod-project",
@@ -179,7 +179,7 @@ func TestGenerateParams(t *testing.T) {
values: map[string]string{
"foo": "bar",
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"values.foo": "bar", "name": "staging-01", "nameNormalized": "staging-01", "server": "https://staging-01.example.com", "metadata.labels.environment": "staging", "metadata.labels.org": "foo",
"metadata.labels.argocd.argoproj.io/secret-type": "cluster", "metadata.annotations.foo.argoproj.io": "staging", "project": "",
@@ -212,7 +212,7 @@ func TestGenerateParams(t *testing.T) {
values: map[string]string{
"name": "baz",
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"values.name": "baz", "name": "staging-01", "nameNormalized": "staging-01", "server": "https://staging-01.example.com", "metadata.labels.environment": "staging", "metadata.labels.org": "foo",
"metadata.labels.argocd.argoproj.io/secret-type": "cluster", "metadata.annotations.foo.argoproj.io": "staging", "project": "",
@@ -227,7 +227,7 @@ func TestGenerateParams(t *testing.T) {
values: nil,
expected: nil,
clientError: true,
expectedError: fmt.Errorf("error getting cluster secrets: could not list Secrets"),
expectedError: errors.New("error getting cluster secrets: could not list Secrets"),
},
{
name: "flat mode without selectors",
@@ -242,9 +242,9 @@ func TestGenerateParams(t *testing.T) {
"aaa": "{{ server }}",
"no-op": "{{ this-does-not-exist }}",
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"clusters": []map[string]interface{}{
"clusters": []map[string]any{
{"values.lol1": "lol", "values.lol2": "{{values.lol1}}{{values.lol1}}", "values.lol3": "{{values.lol2}}{{values.lol2}}{{values.lol2}}", "values.foo": "bar", "values.bar": "{{ metadata.annotations.foo.argoproj.io }}", "values.no-op": "{{ this-does-not-exist }}", "values.bat": "{{ metadata.labels.environment }}", "values.aaa": "https://kubernetes.default.svc", "nameNormalized": "in-cluster", "name": "in-cluster", "server": "https://kubernetes.default.svc", "project": ""},
{
"values.lol1": "lol", "values.lol2": "{{values.lol1}}{{values.lol1}}", "values.lol3": "{{values.lol2}}{{values.lol2}}{{values.lol2}}", "values.foo": "bar", "values.bar": "production", "values.no-op": "{{ this-does-not-exist }}", "values.bat": "production", "values.aaa": "https://production-01.example.com", "name": "production_01/west", "nameNormalized": "production-01-west", "server": "https://production-01.example.com", "metadata.labels.environment": "production", "metadata.labels.org": "bar",
@@ -280,9 +280,9 @@ func TestGenerateParams(t *testing.T) {
values: map[string]string{
"foo": "bar",
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"clusters": []map[string]interface{}{
"clusters": []map[string]any{
{
"values.foo": "bar", "name": "production_01/west", "nameNormalized": "production-01-west", "server": "https://production-01.example.com", "metadata.labels.environment": "production", "metadata.labels.org": "bar",
"metadata.labels.argocd.argoproj.io/secret-type": "cluster", "metadata.annotations.foo.argoproj.io": "production", "project": "prod-project",
@@ -315,7 +315,7 @@ func TestGenerateParams(t *testing.T) {
testCase.clientError,
}
clusterGenerator := NewClusterGenerator(cl, context.Background(), appClientset, "namespace")
clusterGenerator := NewClusterGenerator(t.Context(), cl, appClientset, "namespace")
applicationSetInfo := argoprojiov1alpha1.ApplicationSet{
ObjectMeta: metav1.ObjectMeta{
@@ -398,7 +398,7 @@ func TestGenerateParamsGoTemplate(t *testing.T) {
selector metav1.LabelSelector
values map[string]string
isFlatMode bool
expected []map[string]interface{}
expected []map[string]any
// clientError is true if a k8s client error should be simulated
clientError bool
expectedError error
@@ -415,13 +415,13 @@ func TestGenerateParamsGoTemplate(t *testing.T) {
"bat": "{{ if not (empty .metadata) }}{{.metadata.labels.environment}}{{ end }}",
"aaa": "{{ .server }}",
"no-op": "{{ .thisDoesNotExist }}",
}, expected: []map[string]interface{}{
}, expected: []map[string]any{
{
"name": "production_01/west",
"nameNormalized": "production-01-west",
"server": "https://production-01.example.com",
"project": "",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"labels": map[string]string{
"argocd.argoproj.io/secret-type": "cluster",
"environment": "production",
@@ -447,7 +447,7 @@ func TestGenerateParamsGoTemplate(t *testing.T) {
"nameNormalized": "staging-01",
"server": "https://staging-01.example.com",
"project": "",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"labels": map[string]string{
"argocd.argoproj.io/secret-type": "cluster",
"environment": "staging",
@@ -496,13 +496,13 @@ func TestGenerateParamsGoTemplate(t *testing.T) {
},
},
values: nil,
expected: []map[string]interface{}{
expected: []map[string]any{
{
"name": "production_01/west",
"nameNormalized": "production-01-west",
"server": "https://production-01.example.com",
"project": "",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"labels": map[string]string{
"argocd.argoproj.io/secret-type": "cluster",
"environment": "production",
@@ -518,7 +518,7 @@ func TestGenerateParamsGoTemplate(t *testing.T) {
"nameNormalized": "staging-01",
"server": "https://staging-01.example.com",
"project": "",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"labels": map[string]string{
"argocd.argoproj.io/secret-type": "cluster",
"environment": "staging",
@@ -543,13 +543,13 @@ func TestGenerateParamsGoTemplate(t *testing.T) {
values: map[string]string{
"foo": "bar",
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"name": "production_01/west",
"nameNormalized": "production-01-west",
"server": "https://production-01.example.com",
"project": "",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"labels": map[string]string{
"argocd.argoproj.io/secret-type": "cluster",
"environment": "production",
@@ -584,13 +584,13 @@ func TestGenerateParamsGoTemplate(t *testing.T) {
values: map[string]string{
"foo": "bar",
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"name": "production_01/west",
"nameNormalized": "production-01-west",
"server": "https://production-01.example.com",
"project": "",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"labels": map[string]string{
"argocd.argoproj.io/secret-type": "cluster",
"environment": "production",
@@ -609,7 +609,7 @@ func TestGenerateParamsGoTemplate(t *testing.T) {
"nameNormalized": "staging-01",
"server": "https://staging-01.example.com",
"project": "",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"labels": map[string]string{
"argocd.argoproj.io/secret-type": "cluster",
"environment": "staging",
@@ -647,13 +647,13 @@ func TestGenerateParamsGoTemplate(t *testing.T) {
values: map[string]string{
"name": "baz",
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"name": "staging-01",
"nameNormalized": "staging-01",
"server": "https://staging-01.example.com",
"project": "",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"labels": map[string]string{
"argocd.argoproj.io/secret-type": "cluster",
"environment": "staging",
@@ -677,7 +677,7 @@ func TestGenerateParamsGoTemplate(t *testing.T) {
values: nil,
expected: nil,
clientError: true,
expectedError: fmt.Errorf("error getting cluster secrets: could not list Secrets"),
expectedError: errors.New("error getting cluster secrets: could not list Secrets"),
},
{
name: "Clusters with flat list mode and no selector",
@@ -693,9 +693,9 @@ func TestGenerateParamsGoTemplate(t *testing.T) {
"aaa": "{{ .server }}",
"no-op": "{{ .thisDoesNotExist }}",
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"clusters": []map[string]interface{}{
"clusters": []map[string]any{
{
"nameNormalized": "in-cluster",
"name": "in-cluster",
@@ -717,7 +717,7 @@ func TestGenerateParamsGoTemplate(t *testing.T) {
"nameNormalized": "production-01-west",
"server": "https://production-01.example.com",
"project": "",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"labels": map[string]string{
"argocd.argoproj.io/secret-type": "cluster",
"environment": "production",
@@ -743,7 +743,7 @@ func TestGenerateParamsGoTemplate(t *testing.T) {
"nameNormalized": "staging-01",
"server": "https://staging-01.example.com",
"project": "",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"labels": map[string]string{
"argocd.argoproj.io/secret-type": "cluster",
"environment": "staging",
@@ -788,15 +788,15 @@ func TestGenerateParamsGoTemplate(t *testing.T) {
values: map[string]string{
"foo": "bar",
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"clusters": []map[string]interface{}{
"clusters": []map[string]any{
{
"name": "production_01/west",
"nameNormalized": "production-01-west",
"server": "https://production-01.example.com",
"project": "",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"labels": map[string]string{
"argocd.argoproj.io/secret-type": "cluster",
"environment": "production",
@@ -815,7 +815,7 @@ func TestGenerateParamsGoTemplate(t *testing.T) {
"nameNormalized": "staging-01",
"server": "https://staging-01.example.com",
"project": "",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"labels": map[string]string{
"argocd.argoproj.io/secret-type": "cluster",
"environment": "staging",
@@ -853,7 +853,7 @@ func TestGenerateParamsGoTemplate(t *testing.T) {
testCase.clientError,
}
clusterGenerator := NewClusterGenerator(cl, context.Background(), appClientset, "namespace")
clusterGenerator := NewClusterGenerator(t.Context(), cl, appClientset, "namespace")
applicationSetInfo := argoprojiov1alpha1.ApplicationSet{
ObjectMeta: metav1.ObjectMeta{

View File

@@ -2,6 +2,7 @@ package generators
import (
"context"
"errors"
"fmt"
"strings"
"time"
@@ -9,7 +10,7 @@ import (
log "github.com/sirupsen/logrus"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/argoproj/argo-cd/v2/util/settings"
"github.com/argoproj/argo-cd/v3/util/settings"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
@@ -17,8 +18,8 @@ import (
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/applicationset/utils"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
var _ Generator = (*DuckTypeGenerator)(nil)
@@ -59,7 +60,7 @@ func (g *DuckTypeGenerator) GetTemplate(appSetGenerator *argoprojiov1alpha1.Appl
return &appSetGenerator.ClusterDecisionResource.Template
}
func (g *DuckTypeGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet, _ client.Client) ([]map[string]interface{}, error) {
func (g *DuckTypeGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet, _ client.Client) ([]map[string]any, error) {
if appSetGenerator == nil {
return nil, EmptyAppSetGeneratorError
}
@@ -96,13 +97,13 @@ func (g *DuckTypeGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.A
// Validate the fields
if kind == "" || versionIdx < 1 {
log.Warningf("kind=%v, resourceName=%v, versionIdx=%v", kind, resourceName, versionIdx)
return nil, fmt.Errorf("There is a problem with the apiVersion, kind or resourceName provided")
return nil, errors.New("There is a problem with the apiVersion, kind or resourceName provided")
}
if (resourceName == "" && labelSelector.MatchLabels == nil && labelSelector.MatchExpressions == nil) ||
(resourceName != "" && (labelSelector.MatchExpressions != nil || labelSelector.MatchLabels != nil)) {
log.Warningf("You must choose either resourceName=%v, labelSelector.matchLabels=%v or labelSelect.matchExpressions=%v", resourceName, labelSelector.MatchLabels, labelSelector.MatchExpressions)
return nil, fmt.Errorf("There is a problem with the definition of the ClusterDecisionResource generator")
return nil, errors.New("There is a problem with the definition of the ClusterDecisionResource generator")
}
// Split up the apiVersion
@@ -130,7 +131,7 @@ func (g *DuckTypeGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.A
if len(duckResources.Items) == 0 {
log.Warning("no resource found, make sure you clusterDecisionResource is defined correctly")
return nil, fmt.Errorf("no clusterDecisionResources found")
return nil, errors.New("no clusterDecisionResources found")
}
// Override the duck type in the status of the resource
@@ -146,81 +147,77 @@ func (g *DuckTypeGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.A
return nil, nil
}
res := []map[string]interface{}{}
clusterDecisions := []interface{}{}
res := []map[string]any{}
clusterDecisions := []any{}
// Build the decision slice
for _, duckResource := range duckResources.Items {
log.WithField("duckResourceName", duckResource.GetName()).Debug("found resource")
if duckResource.Object["status"] == nil || len(duckResource.Object["status"].(map[string]interface{})) == 0 {
if duckResource.Object["status"] == nil || len(duckResource.Object["status"].(map[string]any)) == 0 {
log.Warningf("clusterDecisionResource: %s, has no status", duckResource.GetName())
continue
}
log.WithField("duckResourceStatus", duckResource.Object["status"]).Debug("found resource")
clusterDecisions = append(clusterDecisions, duckResource.Object["status"].(map[string]interface{})[statusListKey].([]interface{})...)
clusterDecisions = append(clusterDecisions, duckResource.Object["status"].(map[string]any)[statusListKey].([]any)...)
}
log.Infof("Number of decisions found: %v", len(clusterDecisions))
// Read this outside the loop to improve performance
argoClusters := clustersFromArgoCD.Items
if len(clusterDecisions) > 0 {
for _, cluster := range clusterDecisions {
// generated instance of cluster params
params := map[string]interface{}{}
log.Infof("cluster: %v", cluster)
matchValue := cluster.(map[string]interface{})[matchKey]
if matchValue == nil || matchValue.(string) == "" {
log.Warningf("matchKey=%v not found in \"%v\" list: %v\n", matchKey, statusListKey, cluster.(map[string]interface{}))
continue
}
strMatchValue := matchValue.(string)
log.WithField(matchKey, strMatchValue).Debug("validate against ArgoCD")
found := false
for _, argoCluster := range argoClusters {
if argoCluster.Name == strMatchValue {
log.WithField(matchKey, argoCluster.Name).Info("matched cluster in ArgoCD")
params["name"] = argoCluster.Name
params["server"] = argoCluster.Server
found = true
break // Stop looking
}
}
if !found {
log.WithField(matchKey, strMatchValue).Warning("unmatched cluster in ArgoCD")
continue
}
for key, value := range cluster.(map[string]interface{}) {
params[key] = value.(string)
}
for key, value := range appSetGenerator.ClusterDecisionResource.Values {
if appSet.Spec.GoTemplate {
if params["values"] == nil {
params["values"] = map[string]string{}
}
params["values"].(map[string]string)[key] = value
} else {
params[fmt.Sprintf("values.%s", key)] = value
}
}
res = append(res, params)
}
} else {
if len(clusterDecisions) == 0 {
log.Warningf("clusterDecisionResource status.%s missing", statusListKey)
return nil, nil
}
for _, cluster := range clusterDecisions {
// generated instance of cluster params
params := map[string]any{}
log.Infof("cluster: %v", cluster)
matchValue := cluster.(map[string]any)[matchKey]
if matchValue == nil || matchValue.(string) == "" {
log.Warningf("matchKey=%v not found in \"%v\" list: %v\n", matchKey, statusListKey, cluster.(map[string]any))
continue
}
strMatchValue := matchValue.(string)
log.WithField(matchKey, strMatchValue).Debug("validate against ArgoCD")
found := false
for _, argoCluster := range clustersFromArgoCD {
if argoCluster.Name == strMatchValue {
log.WithField(matchKey, argoCluster.Name).Info("matched cluster in ArgoCD")
params["name"] = argoCluster.Name
params["server"] = argoCluster.Server
found = true
break // Stop looking
}
}
if !found {
log.WithField(matchKey, strMatchValue).Warning("unmatched cluster in ArgoCD")
continue
}
for key, value := range cluster.(map[string]any) {
params[key] = value.(string)
}
for key, value := range appSetGenerator.ClusterDecisionResource.Values {
if appSet.Spec.GoTemplate {
if params["values"] == nil {
params["values"] = map[string]string{}
}
params["values"].(map[string]string)[key] = value
} else {
params["values."+key] = value
}
}
res = append(res, params)
}
return res, nil
}

View File

@@ -1,8 +1,7 @@
package generators
import (
"context"
"fmt"
"errors"
"testing"
"github.com/stretchr/testify/assert"
@@ -16,11 +15,11 @@ import (
kubefake "k8s.io/client-go/kubernetes/fake"
"sigs.k8s.io/controller-runtime/pkg/client"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
const (
resourceApiVersion = "mallard.io/v1"
resourceAPIVersion = "mallard.io/v1"
resourceKind = "ducks"
resourceName = "quak"
)
@@ -78,20 +77,20 @@ func TestGenerateParamsForDuckType(t *testing.T) {
}
duckType := &unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersion": resourceApiVersion,
Object: map[string]any{
"apiVersion": resourceAPIVersion,
"kind": "Duck",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"name": resourceName,
"namespace": "namespace",
"labels": map[string]interface{}{"duck": "all-species"},
"labels": map[string]any{"duck": "all-species"},
},
"status": map[string]interface{}{
"decisions": []interface{}{
map[string]interface{}{
"status": map[string]any{
"decisions": []any{
map[string]any{
"clusterName": "staging-01",
},
map[string]interface{}{
map[string]any{
"clusterName": "production-01",
},
},
@@ -100,17 +99,17 @@ func TestGenerateParamsForDuckType(t *testing.T) {
}
duckTypeProdOnly := &unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersion": resourceApiVersion,
Object: map[string]any{
"apiVersion": resourceAPIVersion,
"kind": "Duck",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"name": resourceName,
"namespace": "namespace",
"labels": map[string]interface{}{"duck": "spotted"},
"labels": map[string]any{"duck": "spotted"},
},
"status": map[string]interface{}{
"decisions": []interface{}{
map[string]interface{}{
"status": map[string]any{
"decisions": []any{
map[string]any{
"clusterName": "production-01",
},
},
@@ -119,15 +118,15 @@ func TestGenerateParamsForDuckType(t *testing.T) {
}
duckTypeEmpty := &unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersion": resourceApiVersion,
Object: map[string]any{
"apiVersion": resourceAPIVersion,
"kind": "Duck",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"name": resourceName,
"namespace": "namespace",
"labels": map[string]interface{}{"duck": "canvasback"},
"labels": map[string]any{"duck": "canvasback"},
},
"status": map[string]interface{}{},
"status": map[string]any{},
},
}
@@ -137,7 +136,7 @@ func TestGenerateParamsForDuckType(t *testing.T) {
Namespace: "namespace",
},
Data: map[string]string{
"apiVersion": resourceApiVersion,
"apiVersion": resourceAPIVersion,
"kind": resourceKind,
"statusListKey": "decisions",
"matchKey": "clusterName",
@@ -151,7 +150,7 @@ func TestGenerateParamsForDuckType(t *testing.T) {
labelSelector metav1.LabelSelector
resource *unstructured.Unstructured
values map[string]string
expected []map[string]interface{}
expected []map[string]any
expectedError error
}{
{
@@ -159,8 +158,8 @@ func TestGenerateParamsForDuckType(t *testing.T) {
resourceName: "",
resource: duckType,
values: nil,
expected: []map[string]interface{}{},
expectedError: fmt.Errorf("There is a problem with the definition of the ClusterDecisionResource generator"),
expected: []map[string]any{},
expectedError: errors.New("There is a problem with the definition of the ClusterDecisionResource generator"),
},
/*** This does not work with the FAKE runtime client, fieldSelectors are broken.
{
@@ -177,7 +176,7 @@ func TestGenerateParamsForDuckType(t *testing.T) {
resourceName: resourceName,
resource: duckType,
values: nil,
expected: []map[string]interface{}{
expected: []map[string]any{
{"clusterName": "production-01", "name": "production-01", "server": "https://production-01.example.com"},
{"clusterName": "staging-01", "name": "staging-01", "server": "https://staging-01.example.com"},
@@ -191,7 +190,7 @@ func TestGenerateParamsForDuckType(t *testing.T) {
values: map[string]string{
"foo": "bar",
},
expected: []map[string]interface{}{
expected: []map[string]any{
{"clusterName": "production-01", "values.foo": "bar", "name": "production-01", "server": "https://production-01.example.com"},
},
expectedError: nil,
@@ -219,7 +218,7 @@ func TestGenerateParamsForDuckType(t *testing.T) {
labelSelector: metav1.LabelSelector{MatchLabels: map[string]string{"duck": "all-species"}},
resource: duckType,
values: nil,
expected: []map[string]interface{}{
expected: []map[string]any{
{"clusterName": "production-01", "name": "production-01", "server": "https://production-01.example.com"},
{"clusterName": "staging-01", "name": "staging-01", "server": "https://staging-01.example.com"},
@@ -234,7 +233,7 @@ func TestGenerateParamsForDuckType(t *testing.T) {
values: map[string]string{
"foo": "bar",
},
expected: []map[string]interface{}{
expected: []map[string]any{
{"clusterName": "production-01", "values.foo": "bar", "name": "production-01", "server": "https://production-01.example.com"},
},
expectedError: nil,
@@ -251,7 +250,7 @@ func TestGenerateParamsForDuckType(t *testing.T) {
}},
resource: duckType,
values: nil,
expected: []map[string]interface{}{
expected: []map[string]any{
{"clusterName": "production-01", "name": "production-01", "server": "https://production-01.example.com"},
{"clusterName": "staging-01", "name": "staging-01", "server": "https://staging-01.example.com"},
@@ -271,7 +270,7 @@ func TestGenerateParamsForDuckType(t *testing.T) {
resource: duckType,
values: nil,
expected: nil,
expectedError: fmt.Errorf("There is a problem with the definition of the ClusterDecisionResource generator"),
expectedError: errors.New("There is a problem with the definition of the ClusterDecisionResource generator"),
},
}
@@ -293,7 +292,7 @@ func TestGenerateParamsForDuckType(t *testing.T) {
fakeDynClient := dynfake.NewSimpleDynamicClientWithCustomListKinds(runtime.NewScheme(), gvrToListKind, testCase.resource)
duckTypeGenerator := NewDuckTypeGenerator(context.Background(), fakeDynClient, appClientset, "namespace")
duckTypeGenerator := NewDuckTypeGenerator(t.Context(), fakeDynClient, appClientset, "namespace")
applicationSetInfo := argoprojiov1alpha1.ApplicationSet{
ObjectMeta: metav1.ObjectMeta{
@@ -374,20 +373,20 @@ func TestGenerateParamsForDuckTypeGoTemplate(t *testing.T) {
}
duckType := &unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersion": resourceApiVersion,
Object: map[string]any{
"apiVersion": resourceAPIVersion,
"kind": "Duck",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"name": resourceName,
"namespace": "namespace",
"labels": map[string]interface{}{"duck": "all-species"},
"labels": map[string]any{"duck": "all-species"},
},
"status": map[string]interface{}{
"decisions": []interface{}{
map[string]interface{}{
"status": map[string]any{
"decisions": []any{
map[string]any{
"clusterName": "staging-01",
},
map[string]interface{}{
map[string]any{
"clusterName": "production-01",
},
},
@@ -396,17 +395,17 @@ func TestGenerateParamsForDuckTypeGoTemplate(t *testing.T) {
}
duckTypeProdOnly := &unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersion": resourceApiVersion,
Object: map[string]any{
"apiVersion": resourceAPIVersion,
"kind": "Duck",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"name": resourceName,
"namespace": "namespace",
"labels": map[string]interface{}{"duck": "spotted"},
"labels": map[string]any{"duck": "spotted"},
},
"status": map[string]interface{}{
"decisions": []interface{}{
map[string]interface{}{
"status": map[string]any{
"decisions": []any{
map[string]any{
"clusterName": "production-01",
},
},
@@ -415,15 +414,15 @@ func TestGenerateParamsForDuckTypeGoTemplate(t *testing.T) {
}
duckTypeEmpty := &unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersion": resourceApiVersion,
Object: map[string]any{
"apiVersion": resourceAPIVersion,
"kind": "Duck",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"name": resourceName,
"namespace": "namespace",
"labels": map[string]interface{}{"duck": "canvasback"},
"labels": map[string]any{"duck": "canvasback"},
},
"status": map[string]interface{}{},
"status": map[string]any{},
},
}
@@ -433,7 +432,7 @@ func TestGenerateParamsForDuckTypeGoTemplate(t *testing.T) {
Namespace: "namespace",
},
Data: map[string]string{
"apiVersion": resourceApiVersion,
"apiVersion": resourceAPIVersion,
"kind": resourceKind,
"statusListKey": "decisions",
"matchKey": "clusterName",
@@ -447,7 +446,7 @@ func TestGenerateParamsForDuckTypeGoTemplate(t *testing.T) {
labelSelector metav1.LabelSelector
resource *unstructured.Unstructured
values map[string]string
expected []map[string]interface{}
expected []map[string]any
expectedError error
}{
{
@@ -455,8 +454,8 @@ func TestGenerateParamsForDuckTypeGoTemplate(t *testing.T) {
resourceName: "",
resource: duckType,
values: nil,
expected: []map[string]interface{}{},
expectedError: fmt.Errorf("There is a problem with the definition of the ClusterDecisionResource generator"),
expected: []map[string]any{},
expectedError: errors.New("There is a problem with the definition of the ClusterDecisionResource generator"),
},
/*** This does not work with the FAKE runtime client, fieldSelectors are broken.
{
@@ -473,7 +472,7 @@ func TestGenerateParamsForDuckTypeGoTemplate(t *testing.T) {
resourceName: resourceName,
resource: duckType,
values: nil,
expected: []map[string]interface{}{
expected: []map[string]any{
{"clusterName": "production-01", "name": "production-01", "server": "https://production-01.example.com"},
{"clusterName": "staging-01", "name": "staging-01", "server": "https://staging-01.example.com"},
@@ -487,7 +486,7 @@ func TestGenerateParamsForDuckTypeGoTemplate(t *testing.T) {
values: map[string]string{
"foo": "bar",
},
expected: []map[string]interface{}{
expected: []map[string]any{
{"clusterName": "production-01", "values": map[string]string{"foo": "bar"}, "name": "production-01", "server": "https://production-01.example.com"},
},
expectedError: nil,
@@ -515,7 +514,7 @@ func TestGenerateParamsForDuckTypeGoTemplate(t *testing.T) {
labelSelector: metav1.LabelSelector{MatchLabels: map[string]string{"duck": "all-species"}},
resource: duckType,
values: nil,
expected: []map[string]interface{}{
expected: []map[string]any{
{"clusterName": "production-01", "name": "production-01", "server": "https://production-01.example.com"},
{"clusterName": "staging-01", "name": "staging-01", "server": "https://staging-01.example.com"},
@@ -530,7 +529,7 @@ func TestGenerateParamsForDuckTypeGoTemplate(t *testing.T) {
values: map[string]string{
"foo": "bar",
},
expected: []map[string]interface{}{
expected: []map[string]any{
{"clusterName": "production-01", "values": map[string]string{"foo": "bar"}, "name": "production-01", "server": "https://production-01.example.com"},
},
expectedError: nil,
@@ -547,7 +546,7 @@ func TestGenerateParamsForDuckTypeGoTemplate(t *testing.T) {
}},
resource: duckType,
values: nil,
expected: []map[string]interface{}{
expected: []map[string]any{
{"clusterName": "production-01", "name": "production-01", "server": "https://production-01.example.com"},
{"clusterName": "staging-01", "name": "staging-01", "server": "https://staging-01.example.com"},
@@ -567,7 +566,7 @@ func TestGenerateParamsForDuckTypeGoTemplate(t *testing.T) {
resource: duckType,
values: nil,
expected: nil,
expectedError: fmt.Errorf("There is a problem with the definition of the ClusterDecisionResource generator"),
expectedError: errors.New("There is a problem with the definition of the ClusterDecisionResource generator"),
},
}
@@ -589,7 +588,7 @@ func TestGenerateParamsForDuckTypeGoTemplate(t *testing.T) {
fakeDynClient := dynfake.NewSimpleDynamicClientWithCustomListKinds(runtime.NewScheme(), gvrToListKind, testCase.resource)
duckTypeGenerator := NewDuckTypeGenerator(context.Background(), fakeDynClient, appClientset, "namespace")
duckTypeGenerator := NewDuckTypeGenerator(t.Context(), fakeDynClient, appClientset, "namespace")
applicationSetInfo := argoprojiov1alpha1.ApplicationSet{
ObjectMeta: metav1.ObjectMeta{

View File

@@ -7,13 +7,13 @@ import (
"github.com/jeremywohl/flatten"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
"github.com/argoproj/argo-cd/v3/applicationset/utils"
"k8s.io/apimachinery/pkg/labels"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
"github.com/imdario/mergo"
"dario.cat/mergo"
log "github.com/sirupsen/logrus"
)
@@ -22,12 +22,12 @@ const (
)
type TransformResult struct {
Params []map[string]interface{}
Params []map[string]any
Template argoprojiov1alpha1.ApplicationSetTemplate
}
// Transform a spec generator to list of paramSets and a template
func Transform(requestedGenerator argoprojiov1alpha1.ApplicationSetGenerator, allGenerators map[string]Generator, baseTemplate argoprojiov1alpha1.ApplicationSetTemplate, appSet *argoprojiov1alpha1.ApplicationSet, genParams map[string]interface{}, client client.Client) ([]TransformResult, error) {
func Transform(requestedGenerator argoprojiov1alpha1.ApplicationSetGenerator, allGenerators map[string]Generator, baseTemplate argoprojiov1alpha1.ApplicationSetTemplate, appSet *argoprojiov1alpha1.ApplicationSet, genParams map[string]any, client client.Client) ([]TransformResult, error) {
// This is a custom version of the `LabelSelectorAsSelector` that is in k8s.io/apimachinery. This has been copied
// verbatim from that package, with the difference that we do not have any restrictions on label values. This is done
// so that, among other things, we can match on cluster urls.
@@ -52,7 +52,7 @@ func Transform(requestedGenerator argoprojiov1alpha1.ApplicationSetGenerator, al
}
continue
}
var params []map[string]interface{}
var params []map[string]any
if len(genParams) != 0 {
tempInterpolatedGenerator, err := InterpolateGenerator(&requestedGenerator, genParams, appSet.Spec.GoTemplate, appSet.Spec.GoTemplateOptions)
interpolatedGenerator = &tempInterpolatedGenerator
@@ -74,7 +74,7 @@ func Transform(requestedGenerator argoprojiov1alpha1.ApplicationSetGenerator, al
}
continue
}
var filterParams []map[string]interface{}
var filterParams []map[string]any
for _, param := range params {
flatParam, err := flattenParameters(param)
if err != nil {
@@ -123,7 +123,7 @@ func GetRelevantGenerators(requestedGenerator *argoprojiov1alpha1.ApplicationSet
return res
}
func flattenParameters(in map[string]interface{}) (map[string]string, error) {
func flattenParameters(in map[string]any) (map[string]string, error) {
flat, err := flatten.Flatten(in, "", flatten.DotStyle)
if err != nil {
return nil, fmt.Errorf("error flatenning parameters: %w", err)
@@ -149,7 +149,7 @@ func mergeGeneratorTemplate(g Generator, requestedGenerator *argoprojiov1alpha1.
// InterpolateGenerator allows interpolating the matrix's 2nd child generator with values from the 1st child generator
// "params" parameter is an array, where each index corresponds to a generator. Each index contains a map w/ that generator's parameters.
func InterpolateGenerator(requestedGenerator *argoprojiov1alpha1.ApplicationSetGenerator, params map[string]interface{}, useGoTemplate bool, goTemplateOptions []string) (argoprojiov1alpha1.ApplicationSetGenerator, error) {
func InterpolateGenerator(requestedGenerator *argoprojiov1alpha1.ApplicationSetGenerator, params map[string]any, useGoTemplate bool, goTemplateOptions []string) (argoprojiov1alpha1.ApplicationSetGenerator, error) {
render := utils.Render{}
interpolatedGenerator, err := render.RenderGeneratorParams(requestedGenerator, params, useGoTemplate, goTemplateOptions)
if err != nil {
@@ -159,16 +159,3 @@ func InterpolateGenerator(requestedGenerator *argoprojiov1alpha1.ApplicationSetG
return *interpolatedGenerator, nil
}
// Fixes https://github.com/argoproj/argo-cd/issues/11982 while ensuring backwards compatibility.
// This is only a short-term solution and should be removed in a future major version.
func dropDisabledNestedSelectors(generators []argoprojiov1alpha1.ApplicationSetNestedGenerator) bool {
var foundSelector bool
for i := range generators {
if generators[i].Selector != nil {
foundSelector = true
generators[i].Selector = nil
}
}
return foundSelector
}

View File

@@ -10,9 +10,9 @@ import (
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/argoproj/argo-cd/v2/applicationset/services/mocks"
"github.com/argoproj/argo-cd/v3/applicationset/services/mocks"
argov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
argov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
"github.com/stretchr/testify/mock"
corev1 "k8s.io/api/core/v1"
@@ -27,19 +27,19 @@ func TestMatchValues(t *testing.T) {
name string
elements []apiextensionsv1.JSON
selector *metav1.LabelSelector
expected []map[string]interface{}
expected []map[string]any
}{
{
name: "no filter",
elements: []apiextensionsv1.JSON{{Raw: []byte(`{"cluster": "cluster","url": "url"}`)}},
selector: &metav1.LabelSelector{},
expected: []map[string]interface{}{{"cluster": "cluster", "url": "url"}},
expected: []map[string]any{{"cluster": "cluster", "url": "url"}},
},
{
name: "nil",
elements: []apiextensionsv1.JSON{{Raw: []byte(`{"cluster": "cluster","url": "url"}`)}},
selector: nil,
expected: []map[string]interface{}{{"cluster": "cluster", "url": "url"}},
expected: []map[string]any{{"cluster": "cluster", "url": "url"}},
},
{
name: "values.foo should be foo but is ignore element",
@@ -49,7 +49,7 @@ func TestMatchValues(t *testing.T) {
"values.foo": "foo",
},
},
expected: []map[string]interface{}{},
expected: []map[string]any{},
},
{
name: "values.foo should be bar",
@@ -59,7 +59,7 @@ func TestMatchValues(t *testing.T) {
"values.foo": "bar",
},
},
expected: []map[string]interface{}{{"cluster": "cluster", "url": "url", "values.foo": "bar"}},
expected: []map[string]any{{"cluster": "cluster", "url": "url", "values.foo": "bar"}},
},
}
@@ -101,19 +101,19 @@ func TestMatchValuesGoTemplate(t *testing.T) {
name string
elements []apiextensionsv1.JSON
selector *metav1.LabelSelector
expected []map[string]interface{}
expected []map[string]any
}{
{
name: "no filter",
elements: []apiextensionsv1.JSON{{Raw: []byte(`{"cluster": "cluster","url": "url"}`)}},
selector: &metav1.LabelSelector{},
expected: []map[string]interface{}{{"cluster": "cluster", "url": "url"}},
expected: []map[string]any{{"cluster": "cluster", "url": "url"}},
},
{
name: "nil",
elements: []apiextensionsv1.JSON{{Raw: []byte(`{"cluster": "cluster","url": "url"}`)}},
selector: nil,
expected: []map[string]interface{}{{"cluster": "cluster", "url": "url"}},
expected: []map[string]any{{"cluster": "cluster", "url": "url"}},
},
{
name: "values.foo should be foo but is ignore element",
@@ -123,7 +123,7 @@ func TestMatchValuesGoTemplate(t *testing.T) {
"values.foo": "foo",
},
},
expected: []map[string]interface{}{},
expected: []map[string]any{},
},
{
name: "values.foo should be bar",
@@ -133,7 +133,7 @@ func TestMatchValuesGoTemplate(t *testing.T) {
"values.foo": "bar",
},
},
expected: []map[string]interface{}{{"cluster": "cluster", "url": "url", "values": map[string]interface{}{"foo": "bar"}}},
expected: []map[string]any{{"cluster": "cluster", "url": "url", "values": map[string]any{"foo": "bar"}}},
},
{
name: "values.0 should be bar",
@@ -143,7 +143,7 @@ func TestMatchValuesGoTemplate(t *testing.T) {
"values.0": "bar",
},
},
expected: []map[string]interface{}{{"cluster": "cluster", "url": "url", "values": []interface{}{"bar"}}},
expected: []map[string]any{{"cluster": "cluster", "url": "url", "values": []any{"bar"}}},
},
}
@@ -184,14 +184,14 @@ func TestTransForm(t *testing.T) {
testCases := []struct {
name string
selector *metav1.LabelSelector
expected []map[string]interface{}
expected []map[string]any
}{
{
name: "server filter",
selector: &metav1.LabelSelector{
MatchLabels: map[string]string{"server": "https://production-01.example.com"},
},
expected: []map[string]interface{}{{
expected: []map[string]any{{
"metadata.annotations.foo.argoproj.io": "production",
"metadata.labels.argocd.argoproj.io/secret-type": "cluster",
"metadata.labels.environment": "production",
@@ -207,7 +207,7 @@ func TestTransForm(t *testing.T) {
selector: &metav1.LabelSelector{
MatchLabels: map[string]string{"server": "https://some-really-long-url-that-will-exceed-63-characters.com"},
},
expected: []map[string]interface{}{{
expected: []map[string]any{{
"metadata.annotations.foo.argoproj.io": "production",
"metadata.labels.argocd.argoproj.io/secret-type": "cluster",
"metadata.labels.environment": "production",
@@ -342,7 +342,7 @@ func getMockClusterGenerator() Generator {
appClientset := kubefake.NewSimpleClientset(runtimeClusters...)
fakeClient := fake.NewClientBuilder().WithObjects(clusters...).Build()
return NewClusterGenerator(fakeClient, context.Background(), appClientset, "namespace")
return NewClusterGenerator(context.Background(), fakeClient, appClientset, "namespace")
}
func getMockGitGenerator() Generator {
@@ -413,7 +413,7 @@ func TestInterpolateGenerator(t *testing.T) {
},
},
}
gitGeneratorParams := map[string]interface{}{
gitGeneratorParams := map[string]any{
"path": "p1/p2/app3",
"path.basename": "app3",
"path[0]": "p1",
@@ -442,7 +442,7 @@ func TestInterpolateGenerator(t *testing.T) {
Template: argov1alpha1.ApplicationSetTemplate{},
},
}
clusterGeneratorParams := map[string]interface{}{
clusterGeneratorParams := map[string]any{
"name": "production_01/west", "server": "https://production-01.example.com",
}
interpolatedGenerator, err = InterpolateGenerator(requestedGenerator, clusterGeneratorParams, false, nil)
@@ -468,8 +468,8 @@ func TestInterpolateGenerator_go(t *testing.T) {
},
},
}
gitGeneratorParams := map[string]interface{}{
"path": map[string]interface{}{
gitGeneratorParams := map[string]any{
"path": map[string]any{
"path": "p1/p2/app3",
"segments": []string{"p1", "p2", "app3"},
},
@@ -497,7 +497,7 @@ func TestInterpolateGenerator_go(t *testing.T) {
Template: argov1alpha1.ApplicationSetTemplate{},
},
}
clusterGeneratorParams := map[string]interface{}{
clusterGeneratorParams := map[string]any{
"name": "production_01/west", "server": "https://production-01.example.com",
}
interpolatedGenerator, err = InterpolateGenerator(requestedGenerator, clusterGeneratorParams, true, nil)
@@ -512,7 +512,7 @@ func TestInterpolateGenerator_go(t *testing.T) {
func TestInterpolateGeneratorError(t *testing.T) {
type args struct {
requestedGenerator *argov1alpha1.ApplicationSetGenerator
params map[string]interface{}
params map[string]any
useGoTemplate bool
goTemplateOptions []string
}
@@ -530,7 +530,7 @@ func TestInterpolateGeneratorError(t *testing.T) {
}, want: argov1alpha1.ApplicationSetGenerator{}, expectedErrStr: "generator is empty"},
{name: "No Params", args: args{
requestedGenerator: &argov1alpha1.ApplicationSetGenerator{},
params: map[string]interface{}{},
params: map[string]any{},
useGoTemplate: false,
goTemplateOptions: nil,
}, want: argov1alpha1.ApplicationSetGenerator{}, expectedErrStr: ""},
@@ -545,7 +545,7 @@ func TestInterpolateGeneratorError(t *testing.T) {
"resolved": "{{ index .rmap (default .override .test) }}",
},
}},
params: map[string]interface{}{
params: map[string]any{
"name": "in-cluster",
"override": "foo",
},

View File

@@ -15,10 +15,10 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/yaml"
"github.com/argoproj/argo-cd/v2/applicationset/services"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v2/util/gpg"
"github.com/argoproj/argo-cd/v3/applicationset/services"
"github.com/argoproj/argo-cd/v3/applicationset/utils"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/util/gpg"
)
var _ Generator = (*GitGenerator)(nil)
@@ -51,7 +51,7 @@ func (g *GitGenerator) GetRequeueAfter(appSetGenerator *argoprojiov1alpha1.Appli
return getDefaultRequeueAfter()
}
func (g *GitGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet, client client.Client) ([]map[string]interface{}, error) {
func (g *GitGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet, client client.Client) ([]map[string]any, error) {
if appSetGenerator == nil {
return nil, EmptyAppSetGeneratorError
}
@@ -81,13 +81,18 @@ func (g *GitGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.Applic
verifyCommit = len(appProject.Spec.SignatureKeys) > 0 && gpg.IsGPGEnabled()
}
// If the project field is templated, we cannot resolve the project name, so we pass an empty string to the repo-server.
// This means only "globally-scoped" repo credentials can be used for such appsets.
project := resolveProjectName(appSet.Spec.Template.Spec.Project)
var err error
var res []map[string]interface{}
if len(appSetGenerator.Git.Directories) != 0 {
res, err = g.generateParamsForGitDirectories(appSetGenerator, noRevisionCache, verifyCommit, appSet.Spec.GoTemplate, appSet.Spec.GoTemplateOptions)
} else if len(appSetGenerator.Git.Files) != 0 {
res, err = g.generateParamsForGitFiles(appSetGenerator, noRevisionCache, verifyCommit, appSet.Spec.GoTemplate, appSet.Spec.GoTemplateOptions)
} else {
var res []map[string]any
switch {
case len(appSetGenerator.Git.Directories) != 0:
res, err = g.generateParamsForGitDirectories(appSetGenerator, noRevisionCache, verifyCommit, appSet.Spec.GoTemplate, project, appSet.Spec.GoTemplateOptions)
case len(appSetGenerator.Git.Files) != 0:
res, err = g.generateParamsForGitFiles(appSetGenerator, noRevisionCache, verifyCommit, appSet.Spec.GoTemplate, project, appSet.Spec.GoTemplateOptions)
default:
return nil, EmptyAppSetGeneratorError
}
if err != nil {
@@ -97,9 +102,9 @@ func (g *GitGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.Applic
return res, nil
}
func (g *GitGenerator) generateParamsForGitDirectories(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, noRevisionCache, verifyCommit bool, useGoTemplate bool, goTemplateOptions []string) ([]map[string]interface{}, error) {
func (g *GitGenerator) generateParamsForGitDirectories(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, noRevisionCache, verifyCommit, useGoTemplate bool, project string, goTemplateOptions []string) ([]map[string]any, error) {
// Directories, not files
allPaths, err := g.repos.GetDirectories(context.TODO(), appSetGenerator.Git.RepoURL, appSetGenerator.Git.Revision, noRevisionCache, verifyCommit)
allPaths, err := g.repos.GetDirectories(context.TODO(), appSetGenerator.Git.RepoURL, appSetGenerator.Git.Revision, project, noRevisionCache, verifyCommit)
if err != nil {
return nil, fmt.Errorf("error getting directories from repo: %w", err)
}
@@ -122,11 +127,11 @@ func (g *GitGenerator) generateParamsForGitDirectories(appSetGenerator *argoproj
return res, nil
}
func (g *GitGenerator) generateParamsForGitFiles(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, noRevisionCache, verifyCommit bool, useGoTemplate bool, goTemplateOptions []string) ([]map[string]interface{}, error) {
func (g *GitGenerator) generateParamsForGitFiles(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, noRevisionCache, verifyCommit, useGoTemplate bool, project string, goTemplateOptions []string) ([]map[string]any, error) {
// Get all files that match the requested path string, removing duplicates
allFiles := make(map[string][]byte)
for _, requestedPath := range appSetGenerator.Git.Files {
files, err := g.repos.GetFiles(context.TODO(), appSetGenerator.Git.RepoURL, appSetGenerator.Git.Revision, requestedPath.Path, noRevisionCache, verifyCommit)
files, err := g.repos.GetFiles(context.TODO(), appSetGenerator.Git.RepoURL, appSetGenerator.Git.Revision, project, requestedPath.Path, noRevisionCache, verifyCommit)
if err != nil {
return nil, err
}
@@ -144,7 +149,7 @@ func (g *GitGenerator) generateParamsForGitFiles(appSetGenerator *argoprojiov1al
sort.Strings(allPaths)
// Generate params from each path, and return
res := []map[string]interface{}{}
res := []map[string]any{}
for _, path := range allPaths {
// A JSON / YAML file path can contain multiple sets of parameters (ie it is an array)
paramsArray, err := g.generateParamsFromGitFile(path, allFiles[path], appSetGenerator.Git.Values, useGoTemplate, goTemplateOptions, appSetGenerator.Git.PathParamPrefix)
@@ -157,14 +162,14 @@ func (g *GitGenerator) generateParamsForGitFiles(appSetGenerator *argoprojiov1al
return res, nil
}
func (g *GitGenerator) generateParamsFromGitFile(filePath string, fileContent []byte, values map[string]string, useGoTemplate bool, goTemplateOptions []string, pathParamPrefix string) ([]map[string]interface{}, error) {
objectsFound := []map[string]interface{}{}
func (g *GitGenerator) generateParamsFromGitFile(filePath string, fileContent []byte, values map[string]string, useGoTemplate bool, goTemplateOptions []string, pathParamPrefix string) ([]map[string]any, error) {
objectsFound := []map[string]any{}
// First, we attempt to parse as an array
err := yaml.Unmarshal(fileContent, &objectsFound)
if err != nil {
// If unable to parse as an array, attempt to parse as a single object
singleObj := make(map[string]interface{})
singleObj := make(map[string]any)
err = yaml.Unmarshal(fileContent, &singleObj)
if err != nil {
return nil, fmt.Errorf("unable to parse file: %w", err)
@@ -172,20 +177,20 @@ func (g *GitGenerator) generateParamsFromGitFile(filePath string, fileContent []
objectsFound = append(objectsFound, singleObj)
} else if len(objectsFound) == 0 {
// If file is valid but empty, add a default empty item
objectsFound = append(objectsFound, map[string]interface{}{})
objectsFound = append(objectsFound, map[string]any{})
}
res := []map[string]interface{}{}
res := []map[string]any{}
for _, objectFound := range objectsFound {
params := map[string]interface{}{}
params := map[string]any{}
if useGoTemplate {
for k, v := range objectFound {
params[k] = v
}
paramPath := map[string]interface{}{}
paramPath := map[string]any{}
paramPath["path"] = path.Dir(filePath)
paramPath["basename"] = path.Base(paramPath["path"].(string))
@@ -194,7 +199,7 @@ func (g *GitGenerator) generateParamsFromGitFile(filePath string, fileContent []
paramPath["filenameNormalized"] = utils.SanitizeName(path.Base(paramPath["filename"].(string)))
paramPath["segments"] = strings.Split(paramPath["path"].(string), "/")
if pathParamPrefix != "" {
params[pathParamPrefix] = map[string]interface{}{"path": paramPath}
params[pathParamPrefix] = map[string]any{"path": paramPath}
} else {
params["path"] = paramPath
}
@@ -261,19 +266,19 @@ func (g *GitGenerator) filterApps(directories []argoprojiov1alpha1.GitDirectoryG
return res
}
func (g *GitGenerator) generateParamsFromApps(requestedApps []string, appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, useGoTemplate bool, goTemplateOptions []string) ([]map[string]interface{}, error) {
res := make([]map[string]interface{}, len(requestedApps))
func (g *GitGenerator) generateParamsFromApps(requestedApps []string, appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, useGoTemplate bool, goTemplateOptions []string) ([]map[string]any, error) {
res := make([]map[string]any, len(requestedApps))
for i, a := range requestedApps {
params := make(map[string]interface{}, 5)
params := make(map[string]any, 5)
if useGoTemplate {
paramPath := map[string]interface{}{}
paramPath := map[string]any{}
paramPath["path"] = a
paramPath["basename"] = path.Base(a)
paramPath["basenameNormalized"] = utils.SanitizeName(path.Base(a))
paramPath["segments"] = strings.Split(paramPath["path"].(string), "/")
if appSetGenerator.Git.PathParamPrefix != "" {
params[appSetGenerator.Git.PathParamPrefix] = map[string]interface{}{"path": paramPath}
params[appSetGenerator.Git.PathParamPrefix] = map[string]any{"path": paramPath}
} else {
params["path"] = paramPath
}
@@ -302,3 +307,11 @@ func (g *GitGenerator) generateParamsFromApps(requestedApps []string, appSetGene
return res, nil
}
func resolveProjectName(project string) string {
if strings.Contains(project, "{{") {
return ""
}
return project
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,13 @@
package generators
import (
"fmt"
"errors"
"time"
"sigs.k8s.io/controller-runtime/pkg/client"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v2/util/env"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/util/env"
)
// Generator defines the interface implemented by all ApplicationSet generators.
@@ -15,7 +15,7 @@ type Generator interface {
// GenerateParams interprets the ApplicationSet and generates all relevant parameters for the application template.
// The expected / desired list of parameters is returned, it then will be render and reconciled
// against the current state of the Applications in the cluster.
GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, applicationSetInfo *argoprojiov1alpha1.ApplicationSet, client client.Client) ([]map[string]interface{}, error)
GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, applicationSetInfo *argoprojiov1alpha1.ApplicationSet, client client.Client) ([]map[string]any, error)
// GetRequeueAfter is the generator can controller the next reconciled loop
// In case there is more then one generator the time will be the minimum of the times.
@@ -27,7 +27,7 @@ type Generator interface {
}
var (
EmptyAppSetGeneratorError = fmt.Errorf("ApplicationSet is empty")
EmptyAppSetGeneratorError = errors.New("ApplicationSet is empty")
NoRequeueAfter time.Duration
)

View File

@@ -2,13 +2,14 @@ package generators
import (
"encoding/json"
"errors"
"fmt"
"time"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/yaml"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
var _ Generator = (*ListGenerator)(nil)
@@ -20,7 +21,7 @@ func NewListGenerator() Generator {
return g
}
func (g *ListGenerator) GetRequeueAfter(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator) time.Duration {
func (g *ListGenerator) GetRequeueAfter(_ *argoprojiov1alpha1.ApplicationSetGenerator) time.Duration {
return NoRequeueAfter
}
@@ -28,7 +29,7 @@ func (g *ListGenerator) GetTemplate(appSetGenerator *argoprojiov1alpha1.Applicat
return &appSetGenerator.List.Template
}
func (g *ListGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet, _ client.Client) ([]map[string]interface{}, error) {
func (g *ListGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet, _ client.Client) ([]map[string]any, error) {
if appSetGenerator == nil {
return nil, EmptyAppSetGeneratorError
}
@@ -37,11 +38,11 @@ func (g *ListGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.Appli
return nil, EmptyAppSetGeneratorError
}
res := make([]map[string]interface{}, len(appSetGenerator.List.Elements))
res := make([]map[string]any, len(appSetGenerator.List.Elements))
for i, tmpItem := range appSetGenerator.List.Elements {
params := map[string]interface{}{}
var element map[string]interface{}
params := map[string]any{}
var element map[string]any
err := json.Unmarshal(tmpItem.Raw, &element)
if err != nil {
return nil, fmt.Errorf("error unmarshling list element %w", err)
@@ -52,16 +53,16 @@ func (g *ListGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.Appli
} else {
for key, value := range element {
if key == "values" {
values, ok := (value).(map[string]interface{})
values, ok := (value).(map[string]any)
if !ok {
return nil, fmt.Errorf("error parsing values map")
return nil, errors.New("error parsing values map")
}
for k, v := range values {
value, ok := v.(string)
if !ok {
return nil, fmt.Errorf("error parsing value as string %w", err)
}
params[fmt.Sprintf("values.%s", k)] = value
params["values."+k] = value
}
} else {
v, ok := value.(string)
@@ -77,7 +78,7 @@ func (g *ListGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.Appli
// Append elements from ElementsYaml to the response
if len(appSetGenerator.List.ElementsYaml) > 0 {
var yamlElements []map[string]interface{}
var yamlElements []map[string]any
err := yaml.Unmarshal([]byte(appSetGenerator.List.ElementsYaml), &yamlElements)
if err != nil {
return nil, fmt.Errorf("error unmarshling decoded ElementsYaml %w", err)

View File

@@ -8,20 +8,20 @@ import (
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func TestGenerateListParams(t *testing.T) {
testCases := []struct {
elements []apiextensionsv1.JSON
expected []map[string]interface{}
expected []map[string]any
}{
{
elements: []apiextensionsv1.JSON{{Raw: []byte(`{"cluster": "cluster","url": "url"}`)}},
expected: []map[string]interface{}{{"cluster": "cluster", "url": "url"}},
expected: []map[string]any{{"cluster": "cluster", "url": "url"}},
}, {
elements: []apiextensionsv1.JSON{{Raw: []byte(`{"cluster": "cluster","url": "url","values":{"foo":"bar"}}`)}},
expected: []map[string]interface{}{{"cluster": "cluster", "url": "url", "values.foo": "bar"}},
expected: []map[string]any{{"cluster": "cluster", "url": "url", "values.foo": "bar"}},
},
}
@@ -49,14 +49,14 @@ func TestGenerateListParams(t *testing.T) {
func TestGenerateListParamsGoTemplate(t *testing.T) {
testCases := []struct {
elements []apiextensionsv1.JSON
expected []map[string]interface{}
expected []map[string]any
}{
{
elements: []apiextensionsv1.JSON{{Raw: []byte(`{"cluster": "cluster","url": "url"}`)}},
expected: []map[string]interface{}{{"cluster": "cluster", "url": "url"}},
expected: []map[string]any{{"cluster": "cluster", "url": "url"}},
}, {
elements: []apiextensionsv1.JSON{{Raw: []byte(`{"cluster": "cluster","url": "url","values":{"foo":"bar"}}`)}},
expected: []map[string]interface{}{{"cluster": "cluster", "url": "url", "values": map[string]interface{}{"foo": "bar"}}},
expected: []map[string]any{{"cluster": "cluster", "url": "url", "values": map[string]any{"foo": "bar"}}},
},
}

View File

@@ -1,24 +1,23 @@
package generators
import (
"errors"
"fmt"
"time"
"github.com/imdario/mergo"
"dario.cat/mergo"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
log "github.com/sirupsen/logrus"
"github.com/argoproj/argo-cd/v3/applicationset/utils"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
var _ Generator = (*MatrixGenerator)(nil)
var (
ErrMoreThanTwoGenerators = fmt.Errorf("found more than two generators, Matrix support only two")
ErrLessThanTwoGenerators = fmt.Errorf("found less than two generators, Matrix support only two")
ErrMoreThenOneInnerGenerators = fmt.Errorf("found more than one generator in matrix.Generators")
ErrMoreThanTwoGenerators = errors.New("found more than two generators, Matrix support only two")
ErrLessThanTwoGenerators = errors.New("found less than two generators, Matrix support only two")
ErrMoreThenOneInnerGenerators = errors.New("found more than one generator in matrix.Generators")
)
type MatrixGenerator struct {
@@ -33,7 +32,7 @@ func NewMatrixGenerator(supportedGenerators map[string]Generator) Generator {
return m
}
func (m *MatrixGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet, client client.Client) ([]map[string]interface{}, error) {
func (m *MatrixGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet, client client.Client) ([]map[string]any, error) {
if appSetGenerator.Matrix == nil {
return nil, EmptyAppSetGeneratorError
}
@@ -46,7 +45,7 @@ func (m *MatrixGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.App
return nil, ErrMoreThanTwoGenerators
}
res := []map[string]interface{}{}
res := []map[string]any{}
g0, err := m.getParams(appSetGenerator.Matrix.Generators[0], appSet, nil, client)
if err != nil {
@@ -59,7 +58,7 @@ func (m *MatrixGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.App
}
for _, b := range g1 {
if appSet.Spec.GoTemplate {
tmp := map[string]interface{}{}
tmp := map[string]any{}
if err := mergo.Merge(&tmp, b, mergo.WithOverride); err != nil {
return nil, fmt.Errorf("failed to merge params from the second generator in the matrix generator with temp map: %w", err)
}
@@ -80,27 +79,15 @@ func (m *MatrixGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.App
return res, nil
}
func (m *MatrixGenerator) getParams(appSetBaseGenerator argoprojiov1alpha1.ApplicationSetNestedGenerator, appSet *argoprojiov1alpha1.ApplicationSet, params map[string]interface{}, client client.Client) ([]map[string]interface{}, error) {
func (m *MatrixGenerator) getParams(appSetBaseGenerator argoprojiov1alpha1.ApplicationSetNestedGenerator, appSet *argoprojiov1alpha1.ApplicationSet, params map[string]any, client client.Client) ([]map[string]any, error) {
matrixGen, err := getMatrixGenerator(appSetBaseGenerator)
if err != nil {
return nil, err
}
if matrixGen != nil && !appSet.Spec.ApplyNestedSelectors {
foundSelector := dropDisabledNestedSelectors(matrixGen.Generators)
if foundSelector {
log.Warnf("AppSet '%v' defines selector on nested matrix generator's generator without enabling them via 'spec.applyNestedSelectors', ignoring nested selectors", appSet.Name)
}
}
mergeGen, err := getMergeGenerator(appSetBaseGenerator)
if err != nil {
return nil, fmt.Errorf("error retrieving merge generator: %w", err)
}
if mergeGen != nil && !appSet.Spec.ApplyNestedSelectors {
foundSelector := dropDisabledNestedSelectors(mergeGen.Generators)
if foundSelector {
log.Warnf("AppSet '%v' defines selector on nested merge generator's generator without enabling them via 'spec.applyNestedSelectors', ignoring nested selectors", appSet.Name)
}
}
t, err := Transform(
argoprojiov1alpha1.ApplicationSetGenerator{
@@ -125,7 +112,7 @@ func (m *MatrixGenerator) getParams(appSetBaseGenerator argoprojiov1alpha1.Appli
}
if len(t) == 0 {
return nil, fmt.Errorf("child generator generated no parameters")
return nil, errors.New("child generator generated no parameters")
}
if len(t) > 1 {
@@ -168,9 +155,8 @@ func (m *MatrixGenerator) GetRequeueAfter(appSetGenerator *argoprojiov1alpha1.Ap
if found {
return res
} else {
return NoRequeueAfter
}
return NoRequeueAfter
}
func getMatrixGenerator(r argoprojiov1alpha1.ApplicationSetNestedGenerator) (*argoprojiov1alpha1.MatrixGenerator, error) {

View File

@@ -1,7 +1,6 @@
package generators
import (
"context"
"testing"
"time"
@@ -13,36 +12,35 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"github.com/argoproj/argo-cd/v2/applicationset/services/mocks"
"github.com/argoproj/argo-cd/v3/applicationset/services/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func TestMatrixGenerate(t *testing.T) {
gitGenerator := &argoprojiov1alpha1.GitGenerator{
gitGenerator := &v1alpha1.GitGenerator{
RepoURL: "RepoURL",
Revision: "Revision",
Directories: []argoprojiov1alpha1.GitDirectoryGeneratorItem{{Path: "*"}},
Directories: []v1alpha1.GitDirectoryGeneratorItem{{Path: "*"}},
}
listGenerator := &argoprojiov1alpha1.ListGenerator{
listGenerator := &v1alpha1.ListGenerator{
Elements: []apiextensionsv1.JSON{{Raw: []byte(`{"cluster": "Cluster","url": "Url", "templated": "test-{{path.basenameNormalized}}"}`)}},
}
testCases := []struct {
name string
baseGenerators []argoprojiov1alpha1.ApplicationSetNestedGenerator
baseGenerators []v1alpha1.ApplicationSetNestedGenerator
expectedErr error
expected []map[string]interface{}
expected []map[string]any
}{
{
name: "happy flow - generate params",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
Git: gitGenerator,
},
@@ -50,16 +48,16 @@ func TestMatrixGenerate(t *testing.T) {
List: listGenerator,
},
},
expected: []map[string]interface{}{
expected: []map[string]any{
{"path": "app1", "path.basename": "app1", "path.basenameNormalized": "app1", "cluster": "Cluster", "url": "Url", "templated": "test-app1"},
{"path": "app2", "path.basename": "app2", "path.basenameNormalized": "app2", "cluster": "Cluster", "url": "Url", "templated": "test-app2"},
},
},
{
name: "happy flow - generate params from two lists",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
List: &argoprojiov1alpha1.ListGenerator{
List: &v1alpha1.ListGenerator{
Elements: []apiextensionsv1.JSON{
{Raw: []byte(`{"a": "1"}`)},
{Raw: []byte(`{"a": "2"}`)},
@@ -67,7 +65,7 @@ func TestMatrixGenerate(t *testing.T) {
},
},
{
List: &argoprojiov1alpha1.ListGenerator{
List: &v1alpha1.ListGenerator{
Elements: []apiextensionsv1.JSON{
{Raw: []byte(`{"b": "1"}`)},
{Raw: []byte(`{"b": "2"}`)},
@@ -75,7 +73,7 @@ func TestMatrixGenerate(t *testing.T) {
},
},
},
expected: []map[string]interface{}{
expected: []map[string]any{
{"a": "1", "b": "1"},
{"a": "1", "b": "2"},
{"a": "2", "b": "1"},
@@ -84,7 +82,7 @@ func TestMatrixGenerate(t *testing.T) {
},
{
name: "returns error if there is less than two base generators",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
Git: gitGenerator,
},
@@ -93,7 +91,7 @@ func TestMatrixGenerate(t *testing.T) {
},
{
name: "returns error if there is more than two base generators",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
List: listGenerator,
},
@@ -108,7 +106,7 @@ func TestMatrixGenerate(t *testing.T) {
},
{
name: "returns error if there is more than one inner generator in the first base generator",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
Git: gitGenerator,
List: listGenerator,
@@ -121,7 +119,7 @@ func TestMatrixGenerate(t *testing.T) {
},
{
name: "returns error if there is more than one inner generator in the second base generator",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
List: listGenerator,
},
@@ -139,19 +137,19 @@ func TestMatrixGenerate(t *testing.T) {
t.Run(testCaseCopy.name, func(t *testing.T) {
genMock := &generatorMock{}
appSet := &argoprojiov1alpha1.ApplicationSet{
appSet := &v1alpha1.ApplicationSet{
ObjectMeta: metav1.ObjectMeta{
Name: "set",
},
Spec: argoprojiov1alpha1.ApplicationSetSpec{},
Spec: v1alpha1.ApplicationSetSpec{},
}
for _, g := range testCaseCopy.baseGenerators {
gitGeneratorSpec := argoprojiov1alpha1.ApplicationSetGenerator{
gitGeneratorSpec := v1alpha1.ApplicationSetGenerator{
Git: g.Git,
List: g.List,
}
genMock.On("GenerateParams", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet, mock.Anything).Return([]map[string]interface{}{
genMock.On("GenerateParams", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet, mock.Anything).Return([]map[string]any{
{
"path": "app1",
"path.basename": "app1",
@@ -165,7 +163,7 @@ func TestMatrixGenerate(t *testing.T) {
}, nil)
genMock.On("GetTemplate", &gitGeneratorSpec).
Return(&argoprojiov1alpha1.ApplicationSetTemplate{})
Return(&v1alpha1.ApplicationSetTemplate{})
}
matrixGenerator := NewMatrixGenerator(
@@ -175,10 +173,10 @@ func TestMatrixGenerate(t *testing.T) {
},
)
got, err := matrixGenerator.GenerateParams(&argoprojiov1alpha1.ApplicationSetGenerator{
Matrix: &argoprojiov1alpha1.MatrixGenerator{
got, err := matrixGenerator.GenerateParams(&v1alpha1.ApplicationSetGenerator{
Matrix: &v1alpha1.MatrixGenerator{
Generators: testCaseCopy.baseGenerators,
Template: argoprojiov1alpha1.ApplicationSetTemplate{},
Template: v1alpha1.ApplicationSetTemplate{},
},
}, appSet, nil)
@@ -193,25 +191,25 @@ func TestMatrixGenerate(t *testing.T) {
}
func TestMatrixGenerateGoTemplate(t *testing.T) {
gitGenerator := &argoprojiov1alpha1.GitGenerator{
gitGenerator := &v1alpha1.GitGenerator{
RepoURL: "RepoURL",
Revision: "Revision",
Directories: []argoprojiov1alpha1.GitDirectoryGeneratorItem{{Path: "*"}},
Directories: []v1alpha1.GitDirectoryGeneratorItem{{Path: "*"}},
}
listGenerator := &argoprojiov1alpha1.ListGenerator{
listGenerator := &v1alpha1.ListGenerator{
Elements: []apiextensionsv1.JSON{{Raw: []byte(`{"cluster": "Cluster","url": "Url"}`)}},
}
testCases := []struct {
name string
baseGenerators []argoprojiov1alpha1.ApplicationSetNestedGenerator
baseGenerators []v1alpha1.ApplicationSetNestedGenerator
expectedErr error
expected []map[string]interface{}
expected []map[string]any
}{
{
name: "happy flow - generate params",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
Git: gitGenerator,
},
@@ -219,7 +217,7 @@ func TestMatrixGenerateGoTemplate(t *testing.T) {
List: listGenerator,
},
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"path": map[string]string{
"path": "app1",
@@ -242,9 +240,9 @@ func TestMatrixGenerateGoTemplate(t *testing.T) {
},
{
name: "happy flow - generate params from two lists",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
List: &argoprojiov1alpha1.ListGenerator{
List: &v1alpha1.ListGenerator{
Elements: []apiextensionsv1.JSON{
{Raw: []byte(`{"a": "1"}`)},
{Raw: []byte(`{"a": "2"}`)},
@@ -252,7 +250,7 @@ func TestMatrixGenerateGoTemplate(t *testing.T) {
},
},
{
List: &argoprojiov1alpha1.ListGenerator{
List: &v1alpha1.ListGenerator{
Elements: []apiextensionsv1.JSON{
{Raw: []byte(`{"b": "1"}`)},
{Raw: []byte(`{"b": "2"}`)},
@@ -260,7 +258,7 @@ func TestMatrixGenerateGoTemplate(t *testing.T) {
},
},
},
expected: []map[string]interface{}{
expected: []map[string]any{
{"a": "1", "b": "1"},
{"a": "1", "b": "2"},
{"a": "2", "b": "1"},
@@ -269,29 +267,29 @@ func TestMatrixGenerateGoTemplate(t *testing.T) {
},
{
name: "parameter override: first list elements take precedence",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
List: &argoprojiov1alpha1.ListGenerator{
List: &v1alpha1.ListGenerator{
Elements: []apiextensionsv1.JSON{
{Raw: []byte(`{"booleanFalse": false, "booleanTrue": true, "stringFalse": "false", "stringTrue": "true"}`)},
},
},
},
{
List: &argoprojiov1alpha1.ListGenerator{
List: &v1alpha1.ListGenerator{
Elements: []apiextensionsv1.JSON{
{Raw: []byte(`{"booleanFalse": true, "booleanTrue": false, "stringFalse": "true", "stringTrue": "false"}`)},
},
},
},
},
expected: []map[string]interface{}{
expected: []map[string]any{
{"booleanFalse": false, "booleanTrue": true, "stringFalse": "false", "stringTrue": "true"},
},
},
{
name: "returns error if there is less than two base generators",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
Git: gitGenerator,
},
@@ -300,7 +298,7 @@ func TestMatrixGenerateGoTemplate(t *testing.T) {
},
{
name: "returns error if there is more than two base generators",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
List: listGenerator,
},
@@ -315,7 +313,7 @@ func TestMatrixGenerateGoTemplate(t *testing.T) {
},
{
name: "returns error if there is more than one inner generator in the first base generator",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
Git: gitGenerator,
List: listGenerator,
@@ -328,7 +326,7 @@ func TestMatrixGenerateGoTemplate(t *testing.T) {
},
{
name: "returns error if there is more than one inner generator in the second base generator",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
List: listGenerator,
},
@@ -346,21 +344,21 @@ func TestMatrixGenerateGoTemplate(t *testing.T) {
t.Run(testCaseCopy.name, func(t *testing.T) {
genMock := &generatorMock{}
appSet := &argoprojiov1alpha1.ApplicationSet{
appSet := &v1alpha1.ApplicationSet{
ObjectMeta: metav1.ObjectMeta{
Name: "set",
},
Spec: argoprojiov1alpha1.ApplicationSetSpec{
Spec: v1alpha1.ApplicationSetSpec{
GoTemplate: true,
},
}
for _, g := range testCaseCopy.baseGenerators {
gitGeneratorSpec := argoprojiov1alpha1.ApplicationSetGenerator{
gitGeneratorSpec := v1alpha1.ApplicationSetGenerator{
Git: g.Git,
List: g.List,
}
genMock.On("GenerateParams", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet, mock.Anything).Return([]map[string]interface{}{
genMock.On("GenerateParams", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet, mock.Anything).Return([]map[string]any{
{
"path": map[string]string{
"path": "app1",
@@ -378,7 +376,7 @@ func TestMatrixGenerateGoTemplate(t *testing.T) {
}, nil)
genMock.On("GetTemplate", &gitGeneratorSpec).
Return(&argoprojiov1alpha1.ApplicationSetTemplate{})
Return(&v1alpha1.ApplicationSetTemplate{})
}
matrixGenerator := NewMatrixGenerator(
@@ -388,10 +386,10 @@ func TestMatrixGenerateGoTemplate(t *testing.T) {
},
)
got, err := matrixGenerator.GenerateParams(&argoprojiov1alpha1.ApplicationSetGenerator{
Matrix: &argoprojiov1alpha1.MatrixGenerator{
got, err := matrixGenerator.GenerateParams(&v1alpha1.ApplicationSetGenerator{
Matrix: &v1alpha1.MatrixGenerator{
Generators: testCaseCopy.baseGenerators,
Template: argoprojiov1alpha1.ApplicationSetTemplate{},
Template: v1alpha1.ApplicationSetTemplate{},
},
}, appSet, nil)
@@ -406,31 +404,31 @@ func TestMatrixGenerateGoTemplate(t *testing.T) {
}
func TestMatrixGetRequeueAfter(t *testing.T) {
gitGenerator := &argoprojiov1alpha1.GitGenerator{
gitGenerator := &v1alpha1.GitGenerator{
RepoURL: "RepoURL",
Revision: "Revision",
Directories: []argoprojiov1alpha1.GitDirectoryGeneratorItem{{Path: "*"}},
Directories: []v1alpha1.GitDirectoryGeneratorItem{{Path: "*"}},
}
listGenerator := &argoprojiov1alpha1.ListGenerator{
listGenerator := &v1alpha1.ListGenerator{
Elements: []apiextensionsv1.JSON{{Raw: []byte(`{"cluster": "Cluster","url": "Url"}`)}},
}
pullRequestGenerator := &argoprojiov1alpha1.PullRequestGenerator{}
pullRequestGenerator := &v1alpha1.PullRequestGenerator{}
scmGenerator := &argoprojiov1alpha1.SCMProviderGenerator{}
scmGenerator := &v1alpha1.SCMProviderGenerator{}
duckTypeGenerator := &argoprojiov1alpha1.DuckTypeGenerator{}
duckTypeGenerator := &v1alpha1.DuckTypeGenerator{}
testCases := []struct {
name string
baseGenerators []argoprojiov1alpha1.ApplicationSetNestedGenerator
baseGenerators []v1alpha1.ApplicationSetNestedGenerator
gitGetRequeueAfter time.Duration
expected time.Duration
}{
{
name: "return NoRequeueAfter if all the inner baseGenerators returns it",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
Git: gitGenerator,
},
@@ -443,7 +441,7 @@ func TestMatrixGetRequeueAfter(t *testing.T) {
},
{
name: "returns the minimal time",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
Git: gitGenerator,
},
@@ -456,7 +454,7 @@ func TestMatrixGetRequeueAfter(t *testing.T) {
},
{
name: "returns the minimal time for pull request",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
Git: gitGenerator,
},
@@ -469,7 +467,7 @@ func TestMatrixGetRequeueAfter(t *testing.T) {
},
{
name: "returns the default time if no requeueAfterSeconds is provided",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
Git: gitGenerator,
},
@@ -481,7 +479,7 @@ func TestMatrixGetRequeueAfter(t *testing.T) {
},
{
name: "returns the default time for duck type generator",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
Git: gitGenerator,
},
@@ -493,7 +491,7 @@ func TestMatrixGetRequeueAfter(t *testing.T) {
},
{
name: "returns the default time for scm generator",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
Git: gitGenerator,
},
@@ -512,7 +510,7 @@ func TestMatrixGetRequeueAfter(t *testing.T) {
mock := &generatorMock{}
for _, g := range testCaseCopy.baseGenerators {
gitGeneratorSpec := argoprojiov1alpha1.ApplicationSetGenerator{
gitGeneratorSpec := v1alpha1.ApplicationSetGenerator{
Git: g.Git,
List: g.List,
PullRequest: g.PullRequest,
@@ -532,10 +530,10 @@ func TestMatrixGetRequeueAfter(t *testing.T) {
},
)
got := matrixGenerator.GetRequeueAfter(&argoprojiov1alpha1.ApplicationSetGenerator{
Matrix: &argoprojiov1alpha1.MatrixGenerator{
got := matrixGenerator.GetRequeueAfter(&v1alpha1.ApplicationSetGenerator{
Matrix: &v1alpha1.MatrixGenerator{
Generators: testCaseCopy.baseGenerators,
Template: argoprojiov1alpha1.ApplicationSetTemplate{},
Template: v1alpha1.ApplicationSetTemplate{},
},
})
@@ -545,16 +543,16 @@ func TestMatrixGetRequeueAfter(t *testing.T) {
}
func TestInterpolatedMatrixGenerate(t *testing.T) {
interpolatedGitGenerator := &argoprojiov1alpha1.GitGenerator{
interpolatedGitGenerator := &v1alpha1.GitGenerator{
RepoURL: "RepoURL",
Revision: "Revision",
Files: []argoprojiov1alpha1.GitFileGeneratorItem{
Files: []v1alpha1.GitFileGeneratorItem{
{Path: "examples/git-generator-files-discovery/cluster-config/dev/config.json"},
{Path: "examples/git-generator-files-discovery/cluster-config/prod/config.json"},
},
}
interpolatedClusterGenerator := &argoprojiov1alpha1.ClusterGenerator{
interpolatedClusterGenerator := &v1alpha1.ClusterGenerator{
Selector: metav1.LabelSelector{
MatchLabels: map[string]string{"environment": "{{path.basename}}"},
MatchExpressions: nil,
@@ -562,14 +560,14 @@ func TestInterpolatedMatrixGenerate(t *testing.T) {
}
testCases := []struct {
name string
baseGenerators []argoprojiov1alpha1.ApplicationSetNestedGenerator
baseGenerators []v1alpha1.ApplicationSetNestedGenerator
expectedErr error
expected []map[string]interface{}
expected []map[string]any
clientError bool
}{
{
name: "happy flow - generate interpolated params",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
Git: interpolatedGitGenerator,
},
@@ -577,7 +575,7 @@ func TestInterpolatedMatrixGenerate(t *testing.T) {
Clusters: interpolatedClusterGenerator,
},
},
expected: []map[string]interface{}{
expected: []map[string]any{
{"path": "examples/git-generator-files-discovery/cluster-config/dev/config.json", "path.basename": "dev", "path.basenameNormalized": "dev", "name": "dev-01", "nameNormalized": "dev-01", "server": "https://dev-01.example.com", "metadata.labels.environment": "dev", "metadata.labels.argocd.argoproj.io/secret-type": "cluster", "project": ""},
{"path": "examples/git-generator-files-discovery/cluster-config/prod/config.json", "path.basename": "prod", "path.basenameNormalized": "prod", "name": "prod-01", "nameNormalized": "prod-01", "server": "https://prod-01.example.com", "metadata.labels.environment": "prod", "metadata.labels.argocd.argoproj.io/secret-type": "cluster", "project": ""},
},
@@ -637,7 +635,7 @@ func TestInterpolatedMatrixGenerate(t *testing.T) {
t.Run(testCaseCopy.name, func(t *testing.T) {
genMock := &generatorMock{}
appSet := &argoprojiov1alpha1.ApplicationSet{}
appSet := &v1alpha1.ApplicationSet{}
appClientset := kubefake.NewSimpleClientset(runtimeClusters...)
fakeClient := fake.NewClientBuilder().WithObjects(clusters...).Build()
@@ -645,14 +643,14 @@ func TestInterpolatedMatrixGenerate(t *testing.T) {
fakeClient,
testCase.clientError,
}
clusterGenerator := NewClusterGenerator(cl, context.Background(), appClientset, "namespace")
clusterGenerator := NewClusterGenerator(t.Context(), cl, appClientset, "namespace")
for _, g := range testCaseCopy.baseGenerators {
gitGeneratorSpec := argoprojiov1alpha1.ApplicationSetGenerator{
gitGeneratorSpec := v1alpha1.ApplicationSetGenerator{
Git: g.Git,
Clusters: g.Clusters,
}
genMock.On("GenerateParams", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet).Return([]map[string]interface{}{
genMock.On("GenerateParams", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet).Return([]map[string]any{
{
"path": "examples/git-generator-files-discovery/cluster-config/dev/config.json",
"path.basename": "dev",
@@ -665,7 +663,7 @@ func TestInterpolatedMatrixGenerate(t *testing.T) {
},
}, nil)
genMock.On("GetTemplate", &gitGeneratorSpec).
Return(&argoprojiov1alpha1.ApplicationSetTemplate{})
Return(&v1alpha1.ApplicationSetTemplate{})
}
matrixGenerator := NewMatrixGenerator(
map[string]Generator{
@@ -674,10 +672,10 @@ func TestInterpolatedMatrixGenerate(t *testing.T) {
},
)
got, err := matrixGenerator.GenerateParams(&argoprojiov1alpha1.ApplicationSetGenerator{
Matrix: &argoprojiov1alpha1.MatrixGenerator{
got, err := matrixGenerator.GenerateParams(&v1alpha1.ApplicationSetGenerator{
Matrix: &v1alpha1.MatrixGenerator{
Generators: testCaseCopy.baseGenerators,
Template: argoprojiov1alpha1.ApplicationSetTemplate{},
Template: v1alpha1.ApplicationSetTemplate{},
},
}, appSet, nil)
@@ -692,16 +690,16 @@ func TestInterpolatedMatrixGenerate(t *testing.T) {
}
func TestInterpolatedMatrixGenerateGoTemplate(t *testing.T) {
interpolatedGitGenerator := &argoprojiov1alpha1.GitGenerator{
interpolatedGitGenerator := &v1alpha1.GitGenerator{
RepoURL: "RepoURL",
Revision: "Revision",
Files: []argoprojiov1alpha1.GitFileGeneratorItem{
Files: []v1alpha1.GitFileGeneratorItem{
{Path: "examples/git-generator-files-discovery/cluster-config/dev/config.json"},
{Path: "examples/git-generator-files-discovery/cluster-config/prod/config.json"},
},
}
interpolatedClusterGenerator := &argoprojiov1alpha1.ClusterGenerator{
interpolatedClusterGenerator := &v1alpha1.ClusterGenerator{
Selector: metav1.LabelSelector{
MatchLabels: map[string]string{"environment": "{{.path.basename}}"},
MatchExpressions: nil,
@@ -709,14 +707,14 @@ func TestInterpolatedMatrixGenerateGoTemplate(t *testing.T) {
}
testCases := []struct {
name string
baseGenerators []argoprojiov1alpha1.ApplicationSetNestedGenerator
baseGenerators []v1alpha1.ApplicationSetNestedGenerator
expectedErr error
expected []map[string]interface{}
expected []map[string]any
clientError bool
}{
{
name: "happy flow - generate interpolated params",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
Git: interpolatedGitGenerator,
},
@@ -724,7 +722,7 @@ func TestInterpolatedMatrixGenerateGoTemplate(t *testing.T) {
Clusters: interpolatedClusterGenerator,
},
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"path": map[string]string{
"path": "examples/git-generator-files-discovery/cluster-config/dev/config.json",
@@ -735,7 +733,7 @@ func TestInterpolatedMatrixGenerateGoTemplate(t *testing.T) {
"nameNormalized": "dev-01",
"server": "https://dev-01.example.com",
"project": "",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"labels": map[string]string{
"environment": "dev",
"argocd.argoproj.io/secret-type": "cluster",
@@ -752,7 +750,7 @@ func TestInterpolatedMatrixGenerateGoTemplate(t *testing.T) {
"nameNormalized": "prod-01",
"server": "https://prod-01.example.com",
"project": "",
"metadata": map[string]interface{}{
"metadata": map[string]any{
"labels": map[string]string{
"environment": "prod",
"argocd.argoproj.io/secret-type": "cluster",
@@ -816,8 +814,8 @@ func TestInterpolatedMatrixGenerateGoTemplate(t *testing.T) {
t.Run(testCaseCopy.name, func(t *testing.T) {
genMock := &generatorMock{}
appSet := &argoprojiov1alpha1.ApplicationSet{
Spec: argoprojiov1alpha1.ApplicationSetSpec{
appSet := &v1alpha1.ApplicationSet{
Spec: v1alpha1.ApplicationSetSpec{
GoTemplate: true,
},
}
@@ -828,14 +826,14 @@ func TestInterpolatedMatrixGenerateGoTemplate(t *testing.T) {
fakeClient,
testCase.clientError,
}
clusterGenerator := NewClusterGenerator(cl, context.Background(), appClientset, "namespace")
clusterGenerator := NewClusterGenerator(t.Context(), cl, appClientset, "namespace")
for _, g := range testCaseCopy.baseGenerators {
gitGeneratorSpec := argoprojiov1alpha1.ApplicationSetGenerator{
gitGeneratorSpec := v1alpha1.ApplicationSetGenerator{
Git: g.Git,
Clusters: g.Clusters,
}
genMock.On("GenerateParams", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet).Return([]map[string]interface{}{
genMock.On("GenerateParams", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet).Return([]map[string]any{
{
"path": map[string]string{
"path": "examples/git-generator-files-discovery/cluster-config/dev/config.json",
@@ -852,7 +850,7 @@ func TestInterpolatedMatrixGenerateGoTemplate(t *testing.T) {
},
}, nil)
genMock.On("GetTemplate", &gitGeneratorSpec).
Return(&argoprojiov1alpha1.ApplicationSetTemplate{})
Return(&v1alpha1.ApplicationSetTemplate{})
}
matrixGenerator := NewMatrixGenerator(
map[string]Generator{
@@ -861,10 +859,10 @@ func TestInterpolatedMatrixGenerateGoTemplate(t *testing.T) {
},
)
got, err := matrixGenerator.GenerateParams(&argoprojiov1alpha1.ApplicationSetGenerator{
Matrix: &argoprojiov1alpha1.MatrixGenerator{
got, err := matrixGenerator.GenerateParams(&v1alpha1.ApplicationSetGenerator{
Matrix: &v1alpha1.MatrixGenerator{
Generators: testCaseCopy.baseGenerators,
Template: argoprojiov1alpha1.ApplicationSetTemplate{},
Template: v1alpha1.ApplicationSetTemplate{},
},
}, appSet, nil)
@@ -879,28 +877,28 @@ func TestInterpolatedMatrixGenerateGoTemplate(t *testing.T) {
}
func TestMatrixGenerateListElementsYaml(t *testing.T) {
gitGenerator := &argoprojiov1alpha1.GitGenerator{
gitGenerator := &v1alpha1.GitGenerator{
RepoURL: "RepoURL",
Revision: "Revision",
Files: []argoprojiov1alpha1.GitFileGeneratorItem{
Files: []v1alpha1.GitFileGeneratorItem{
{Path: "config.yaml"},
},
}
listGenerator := &argoprojiov1alpha1.ListGenerator{
listGenerator := &v1alpha1.ListGenerator{
Elements: []apiextensionsv1.JSON{},
ElementsYaml: "{{ .foo.bar | toJson }}",
}
testCases := []struct {
name string
baseGenerators []argoprojiov1alpha1.ApplicationSetNestedGenerator
baseGenerators []v1alpha1.ApplicationSetNestedGenerator
expectedErr error
expected []map[string]interface{}
expected []map[string]any
}{
{
name: "happy flow - generate params",
baseGenerators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
baseGenerators: []v1alpha1.ApplicationSetNestedGenerator{
{
Git: gitGenerator,
},
@@ -908,23 +906,23 @@ func TestMatrixGenerateListElementsYaml(t *testing.T) {
List: listGenerator,
},
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"chart": "a",
"version": "1",
"foo": map[string]interface{}{
"bar": []interface{}{
map[string]interface{}{
"foo": map[string]any{
"bar": []any{
map[string]any{
"chart": "a",
"version": "1",
},
map[string]interface{}{
map[string]any{
"chart": "b",
"version": "2",
},
},
},
"path": map[string]interface{}{
"path": map[string]any{
"basename": "dir",
"basenameNormalized": "dir",
"filename": "file_name.yaml",
@@ -939,19 +937,19 @@ func TestMatrixGenerateListElementsYaml(t *testing.T) {
{
"chart": "b",
"version": "2",
"foo": map[string]interface{}{
"bar": []interface{}{
map[string]interface{}{
"foo": map[string]any{
"bar": []any{
map[string]any{
"chart": "a",
"version": "1",
},
map[string]interface{}{
map[string]any{
"chart": "b",
"version": "2",
},
},
},
"path": map[string]interface{}{
"path": map[string]any{
"basename": "dir",
"basenameNormalized": "dir",
"filename": "file_name.yaml",
@@ -972,34 +970,34 @@ func TestMatrixGenerateListElementsYaml(t *testing.T) {
t.Run(testCaseCopy.name, func(t *testing.T) {
genMock := &generatorMock{}
appSet := &argoprojiov1alpha1.ApplicationSet{
appSet := &v1alpha1.ApplicationSet{
ObjectMeta: metav1.ObjectMeta{
Name: "set",
},
Spec: argoprojiov1alpha1.ApplicationSetSpec{
Spec: v1alpha1.ApplicationSetSpec{
GoTemplate: true,
},
}
for _, g := range testCaseCopy.baseGenerators {
gitGeneratorSpec := argoprojiov1alpha1.ApplicationSetGenerator{
gitGeneratorSpec := v1alpha1.ApplicationSetGenerator{
Git: g.Git,
List: g.List,
}
genMock.On("GenerateParams", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet).Return([]map[string]any{{
"foo": map[string]interface{}{
"bar": []interface{}{
map[string]interface{}{
"foo": map[string]any{
"bar": []any{
map[string]any{
"chart": "a",
"version": "1",
},
map[string]interface{}{
map[string]any{
"chart": "b",
"version": "2",
},
},
},
"path": map[string]interface{}{
"path": map[string]any{
"basename": "dir",
"basenameNormalized": "dir",
"filename": "file_name.yaml",
@@ -1012,7 +1010,7 @@ func TestMatrixGenerateListElementsYaml(t *testing.T) {
},
}}, nil)
genMock.On("GetTemplate", &gitGeneratorSpec).
Return(&argoprojiov1alpha1.ApplicationSetTemplate{})
Return(&v1alpha1.ApplicationSetTemplate{})
}
matrixGenerator := NewMatrixGenerator(
@@ -1022,10 +1020,10 @@ func TestMatrixGenerateListElementsYaml(t *testing.T) {
},
)
got, err := matrixGenerator.GenerateParams(&argoprojiov1alpha1.ApplicationSetGenerator{
Matrix: &argoprojiov1alpha1.MatrixGenerator{
got, err := matrixGenerator.GenerateParams(&v1alpha1.ApplicationSetGenerator{
Matrix: &v1alpha1.MatrixGenerator{
Generators: testCaseCopy.baseGenerators,
Template: argoprojiov1alpha1.ApplicationSetTemplate{},
Template: v1alpha1.ApplicationSetTemplate{},
},
}, appSet, nil)
@@ -1043,19 +1041,19 @@ type generatorMock struct {
mock.Mock
}
func (g *generatorMock) GetTemplate(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator) *argoprojiov1alpha1.ApplicationSetTemplate {
func (g *generatorMock) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate {
args := g.Called(appSetGenerator)
return args.Get(0).(*argoprojiov1alpha1.ApplicationSetTemplate)
return args.Get(0).(*v1alpha1.ApplicationSetTemplate)
}
func (g *generatorMock) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet, _ client.Client) ([]map[string]interface{}, error) {
func (g *generatorMock) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, appSet *v1alpha1.ApplicationSet, _ client.Client) ([]map[string]any, error) {
args := g.Called(appSetGenerator, appSet)
return args.Get(0).([]map[string]interface{}), args.Error(1)
return args.Get(0).([]map[string]any), args.Error(1)
}
func (g *generatorMock) GetRequeueAfter(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator) time.Duration {
func (g *generatorMock) GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSetGenerator) time.Duration {
args := g.Called(appSetGenerator)
return args.Get(0).(time.Duration)
@@ -1075,20 +1073,20 @@ func TestGitGenerator_GenerateParams_list_x_git_matrix_generator(t *testing.T) {
// of that bug.
listGeneratorMock := &generatorMock{}
listGeneratorMock.On("GenerateParams", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), mock.AnythingOfType("*v1alpha1.ApplicationSet"), mock.Anything).Return([]map[string]interface{}{
listGeneratorMock.On("GenerateParams", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), mock.AnythingOfType("*v1alpha1.ApplicationSet"), mock.Anything).Return([]map[string]any{
{"some": "value"},
}, nil)
listGeneratorMock.On("GetTemplate", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator")).Return(&argoprojiov1alpha1.ApplicationSetTemplate{})
listGeneratorMock.On("GetTemplate", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator")).Return(&v1alpha1.ApplicationSetTemplate{})
gitGeneratorSpec := &argoprojiov1alpha1.GitGenerator{
gitGeneratorSpec := &v1alpha1.GitGenerator{
RepoURL: "https://git.example.com",
Files: []argoprojiov1alpha1.GitFileGeneratorItem{
Files: []v1alpha1.GitFileGeneratorItem{
{Path: "some/path.json"},
},
}
repoServiceMock := &mocks.Repos{}
repoServiceMock.On("GetFiles", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(map[string][]byte{
repoServiceMock.On("GetFiles", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(map[string][]byte{
"some/path.json": []byte("test: content"),
}, nil)
gitGenerator := NewGitGenerator(repoServiceMock, "")
@@ -1098,10 +1096,10 @@ func TestGitGenerator_GenerateParams_list_x_git_matrix_generator(t *testing.T) {
"Git": gitGenerator,
})
matrixGeneratorSpec := &argoprojiov1alpha1.MatrixGenerator{
Generators: []argoprojiov1alpha1.ApplicationSetNestedGenerator{
matrixGeneratorSpec := &v1alpha1.MatrixGenerator{
Generators: []v1alpha1.ApplicationSetNestedGenerator{
{
List: &argoprojiov1alpha1.ListGenerator{
List: &v1alpha1.ListGenerator{
Elements: []apiextensionsv1.JSON{
{
Raw: []byte(`{"some": "value"}`),
@@ -1118,15 +1116,15 @@ func TestGitGenerator_GenerateParams_list_x_git_matrix_generator(t *testing.T) {
scheme := runtime.NewScheme()
err := v1alpha1.AddToScheme(scheme)
require.NoError(t, err)
appProject := argoprojiov1alpha1.AppProject{}
appProject := v1alpha1.AppProject{}
client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&appProject).Build()
params, err := matrixGenerator.GenerateParams(&argoprojiov1alpha1.ApplicationSetGenerator{
params, err := matrixGenerator.GenerateParams(&v1alpha1.ApplicationSetGenerator{
Matrix: matrixGeneratorSpec,
}, &argoprojiov1alpha1.ApplicationSet{}, client)
}, &v1alpha1.ApplicationSet{}, client)
require.NoError(t, err)
assert.Equal(t, []map[string]interface{}{{
assert.Equal(t, []map[string]any{{
"path": "some",
"path.basename": "some",
"path.basenameNormalized": "some",

View File

@@ -2,24 +2,23 @@ package generators
import (
"encoding/json"
"errors"
"fmt"
"time"
"github.com/imdario/mergo"
"dario.cat/mergo"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
log "github.com/sirupsen/logrus"
"github.com/argoproj/argo-cd/v3/applicationset/utils"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
var _ Generator = (*MergeGenerator)(nil)
var (
ErrLessThanTwoGeneratorsInMerge = fmt.Errorf("found less than two generators, Merge requires two or more")
ErrNoMergeKeys = fmt.Errorf("no merge keys were specified, Merge requires at least one")
ErrNonUniqueParamSets = fmt.Errorf("the parameters from a generator were not unique by the given mergeKeys, Merge requires all param sets to be unique")
ErrLessThanTwoGeneratorsInMerge = errors.New("found less than two generators, Merge requires two or more")
ErrNoMergeKeys = errors.New("no merge keys were specified, Merge requires at least one")
ErrNonUniqueParamSets = errors.New("the parameters from a generator were not unique by the given mergeKeys, Merge requires all param sets to be unique")
)
type MergeGenerator struct {
@@ -37,8 +36,8 @@ func NewMergeGenerator(supportedGenerators map[string]Generator) Generator {
// getParamSetsForAllGenerators generates params for each child generator in a MergeGenerator. Param sets are returned
// in slices ordered according to the order of the given generators.
func (m *MergeGenerator) getParamSetsForAllGenerators(generators []argoprojiov1alpha1.ApplicationSetNestedGenerator, appSet *argoprojiov1alpha1.ApplicationSet, client client.Client) ([][]map[string]interface{}, error) {
var paramSets [][]map[string]interface{}
func (m *MergeGenerator) getParamSetsForAllGenerators(generators []argoprojiov1alpha1.ApplicationSetNestedGenerator, appSet *argoprojiov1alpha1.ApplicationSet, client client.Client) ([][]map[string]any, error) {
var paramSets [][]map[string]any
for i, generator := range generators {
generatorParamSets, err := m.getParams(generator, appSet, client)
if err != nil {
@@ -51,7 +50,7 @@ func (m *MergeGenerator) getParamSetsForAllGenerators(generators []argoprojiov1a
}
// GenerateParams gets the params produced by the MergeGenerator.
func (m *MergeGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet, client client.Client) ([]map[string]interface{}, error) {
func (m *MergeGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet, client client.Client) ([]map[string]any, error) {
if appSetGenerator.Merge == nil {
return nil, EmptyAppSetGeneratorError
}
@@ -94,11 +93,11 @@ func (m *MergeGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.Appl
}
}
mergedParamSets := make([]map[string]interface{}, len(baseParamSetsByMergeKey))
mergedParamSets := make([]map[string]any, len(baseParamSetsByMergeKey))
i := 0
for _, mergedParamSet := range baseParamSetsByMergeKey {
mergedParamSets[i] = mergedParamSet
i += 1
i++
}
return mergedParamSets, nil
@@ -107,7 +106,7 @@ func (m *MergeGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.Appl
// getParamSetsByMergeKey converts the given list of parameter sets to a map of parameter sets where the key is the
// unique key of the parameter set as determined by the given mergeKeys. If any two parameter sets share the same merge
// key, getParamSetsByMergeKey will throw NonUniqueParamSets.
func getParamSetsByMergeKey(mergeKeys []string, paramSets []map[string]interface{}) (map[string]map[string]interface{}, error) {
func getParamSetsByMergeKey(mergeKeys []string, paramSets []map[string]any) (map[string]map[string]any, error) {
if len(mergeKeys) < 1 {
return nil, ErrNoMergeKeys
}
@@ -117,17 +116,17 @@ func getParamSetsByMergeKey(mergeKeys []string, paramSets []map[string]interface
deDuplicatedMergeKeys[mergeKey] = false
}
paramSetsByMergeKey := make(map[string]map[string]interface{}, len(paramSets))
paramSetsByMergeKey := make(map[string]map[string]any, len(paramSets))
for _, paramSet := range paramSets {
paramSetKey := make(map[string]interface{})
paramSetKey := make(map[string]any)
for mergeKey := range deDuplicatedMergeKeys {
paramSetKey[mergeKey] = paramSet[mergeKey]
}
paramSetKeyJson, err := json.Marshal(paramSetKey)
paramSetKeyJSON, err := json.Marshal(paramSetKey)
if err != nil {
return nil, fmt.Errorf("error marshalling param set key json: %w", err)
}
paramSetKeyString := string(paramSetKeyJson)
paramSetKeyString := string(paramSetKeyJSON)
if _, exists := paramSetsByMergeKey[paramSetKeyString]; exists {
return nil, fmt.Errorf("%w. Duplicate key was %s", ErrNonUniqueParamSets, paramSetKeyString)
}
@@ -138,27 +137,15 @@ func getParamSetsByMergeKey(mergeKeys []string, paramSets []map[string]interface
}
// getParams get the parameters generated by this generator.
func (m *MergeGenerator) getParams(appSetBaseGenerator argoprojiov1alpha1.ApplicationSetNestedGenerator, appSet *argoprojiov1alpha1.ApplicationSet, client client.Client) ([]map[string]interface{}, error) {
func (m *MergeGenerator) getParams(appSetBaseGenerator argoprojiov1alpha1.ApplicationSetNestedGenerator, appSet *argoprojiov1alpha1.ApplicationSet, client client.Client) ([]map[string]any, error) {
matrixGen, err := getMatrixGenerator(appSetBaseGenerator)
if err != nil {
return nil, err
}
if matrixGen != nil && !appSet.Spec.ApplyNestedSelectors {
foundSelector := dropDisabledNestedSelectors(matrixGen.Generators)
if foundSelector {
log.Warnf("AppSet '%v' defines selector on nested matrix generator's generator without enabling them via 'spec.applyNestedSelectors', ignoring nested selector", appSet.Name)
}
}
mergeGen, err := getMergeGenerator(appSetBaseGenerator)
if err != nil {
return nil, err
}
if mergeGen != nil && !appSet.Spec.ApplyNestedSelectors {
foundSelector := dropDisabledNestedSelectors(mergeGen.Generators)
if foundSelector {
log.Warnf("AppSet '%v' defines selector on nested merge generator's generator without enabling them via 'spec.applyNestedSelectors', ignoring nested selector", appSet.Name)
}
}
t, err := Transform(
argoprojiov1alpha1.ApplicationSetGenerator{
@@ -176,13 +163,13 @@ func (m *MergeGenerator) getParams(appSetBaseGenerator argoprojiov1alpha1.Applic
m.supportedGenerators,
argoprojiov1alpha1.ApplicationSetTemplate{},
appSet,
map[string]interface{}{}, client)
map[string]any{}, client)
if err != nil {
return nil, fmt.Errorf("child generator returned an error on parameter generation: %w", err)
}
if len(t) == 0 {
return nil, fmt.Errorf("child generator generated no parameters")
return nil, errors.New("child generator generated no parameters")
}
if len(t) > 1 {
@@ -223,9 +210,8 @@ func (m *MergeGenerator) GetRequeueAfter(appSetGenerator *argoprojiov1alpha1.App
if found {
return res
} else {
return NoRequeueAfter
}
return NoRequeueAfter
}
func getMergeGenerator(r argoprojiov1alpha1.ApplicationSetNestedGenerator) (*argoprojiov1alpha1.MergeGenerator, error) {

View File

@@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/require"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func getNestedListGenerator(json string) *argoprojiov1alpha1.ApplicationSetNestedGenerator {
@@ -36,15 +36,15 @@ func getTerminalListGeneratorMultiple(jsons []string) argoprojiov1alpha1.Applica
return generator
}
func listOfMapsToSet(maps []map[string]interface{}) (map[string]bool, error) {
func listOfMapsToSet(maps []map[string]any) (map[string]bool, error) {
set := make(map[string]bool, len(maps))
for _, paramMap := range maps {
paramMapAsJson, err := json.Marshal(paramMap)
paramMapAsJSON, err := json.Marshal(paramMap)
if err != nil {
return nil, err
}
set[string(paramMapAsJson)] = false
set[string(paramMapAsJSON)] = false
}
return set, nil
}
@@ -55,7 +55,7 @@ func TestMergeGenerate(t *testing.T) {
baseGenerators []argoprojiov1alpha1.ApplicationSetNestedGenerator
mergeKeys []string
expectedErr error
expected []map[string]interface{}
expected []map[string]any
}{
{
name: "no generators",
@@ -79,7 +79,7 @@ func TestMergeGenerate(t *testing.T) {
*getNestedListGenerator(`{"a": "3_1","b": "different","c": "3_3"}`), // gets ignored because its merge key value isn't in the base params set
},
mergeKeys: []string{"b"},
expected: []map[string]interface{}{
expected: []map[string]any{
{"a": "2_1", "b": "same", "c": "1_3"},
},
},
@@ -90,7 +90,7 @@ func TestMergeGenerate(t *testing.T) {
*getNestedListGenerator(`{"a": "a"}`),
},
mergeKeys: []string{"b"},
expected: []map[string]interface{}{
expected: []map[string]any{
{"a": "a"},
},
},
@@ -101,7 +101,7 @@ func TestMergeGenerate(t *testing.T) {
*getNestedListGenerator(`{"b": "b"}`),
},
mergeKeys: []string{"b"},
expected: []map[string]interface{}{
expected: []map[string]any{
{"a": "a"},
},
},
@@ -119,7 +119,7 @@ func TestMergeGenerate(t *testing.T) {
*getNestedListGenerator(`{"a": "1", "b": "1", "c": "added"}`),
},
mergeKeys: []string{"a", "b"},
expected: []map[string]interface{}{
expected: []map[string]any{
{"a": "1", "b": "1", "c": "added"},
{"a": "1", "b": "2"},
{"a": "2", "b": "1"},
@@ -141,7 +141,7 @@ func TestMergeGenerate(t *testing.T) {
*getNestedListGenerator(`{"a": "1", "b": "3", "d": "added"}`),
},
mergeKeys: []string{"a", "b"},
expected: []map[string]interface{}{
expected: []map[string]any{
{"a": "1", "b": "3", "c": "added", "d": "added"},
{"a": "2", "b": "2"},
},
@@ -196,7 +196,7 @@ func TestMergeGenerate(t *testing.T) {
}
}
func toAPIExtensionsJSON(t *testing.T, g interface{}) *apiextensionsv1.JSON {
func toAPIExtensionsJSON(t *testing.T, g any) *apiextensionsv1.JSON {
t.Helper()
resVal, err := json.Marshal(g)
if err != nil {
@@ -213,9 +213,9 @@ func TestParamSetsAreUniqueByMergeKeys(t *testing.T) {
testCases := []struct {
name string
mergeKeys []string
paramSets []map[string]interface{}
paramSets []map[string]any
expectedErr error
expected map[string]map[string]interface{}
expected map[string]map[string]any
}{
{
name: "no merge keys",
@@ -225,13 +225,13 @@ func TestParamSetsAreUniqueByMergeKeys(t *testing.T) {
{
name: "no paramSets",
mergeKeys: []string{"key"},
expected: make(map[string]map[string]interface{}),
expected: make(map[string]map[string]any),
},
{
name: "simple key, unique paramSets",
mergeKeys: []string{"key"},
paramSets: []map[string]interface{}{{"key": "a"}, {"key": "b"}},
expected: map[string]map[string]interface{}{
paramSets: []map[string]any{{"key": "a"}, {"key": "b"}},
expected: map[string]map[string]any{
`{"key":"a"}`: {"key": "a"},
`{"key":"b"}`: {"key": "b"},
},
@@ -239,23 +239,23 @@ func TestParamSetsAreUniqueByMergeKeys(t *testing.T) {
{
name: "simple key object, unique paramSets",
mergeKeys: []string{"key"},
paramSets: []map[string]interface{}{{"key": map[string]interface{}{"hello": "world"}}, {"key": "b"}},
expected: map[string]map[string]interface{}{
`{"key":{"hello":"world"}}`: {"key": map[string]interface{}{"hello": "world"}},
paramSets: []map[string]any{{"key": map[string]any{"hello": "world"}}, {"key": "b"}},
expected: map[string]map[string]any{
`{"key":{"hello":"world"}}`: {"key": map[string]any{"hello": "world"}},
`{"key":"b"}`: {"key": "b"},
},
},
{
name: "simple key, non-unique paramSets",
mergeKeys: []string{"key"},
paramSets: []map[string]interface{}{{"key": "a"}, {"key": "b"}, {"key": "b"}},
paramSets: []map[string]any{{"key": "a"}, {"key": "b"}, {"key": "b"}},
expectedErr: fmt.Errorf("%w. Duplicate key was %s", ErrNonUniqueParamSets, `{"key":"b"}`),
},
{
name: "simple key, duplicated key name, unique paramSets",
mergeKeys: []string{"key", "key"},
paramSets: []map[string]interface{}{{"key": "a"}, {"key": "b"}},
expected: map[string]map[string]interface{}{
paramSets: []map[string]any{{"key": "a"}, {"key": "b"}},
expected: map[string]map[string]any{
`{"key":"a"}`: {"key": "a"},
`{"key":"b"}`: {"key": "b"},
},
@@ -263,18 +263,18 @@ func TestParamSetsAreUniqueByMergeKeys(t *testing.T) {
{
name: "simple key, duplicated key name, non-unique paramSets",
mergeKeys: []string{"key", "key"},
paramSets: []map[string]interface{}{{"key": "a"}, {"key": "b"}, {"key": "b"}},
paramSets: []map[string]any{{"key": "a"}, {"key": "b"}, {"key": "b"}},
expectedErr: fmt.Errorf("%w. Duplicate key was %s", ErrNonUniqueParamSets, `{"key":"b"}`),
},
{
name: "compound key, unique paramSets",
mergeKeys: []string{"key1", "key2"},
paramSets: []map[string]interface{}{
paramSets: []map[string]any{
{"key1": "a", "key2": "a"},
{"key1": "a", "key2": "b"},
{"key1": "b", "key2": "a"},
},
expected: map[string]map[string]interface{}{
expected: map[string]map[string]any{
`{"key1":"a","key2":"a"}`: {"key1": "a", "key2": "a"},
`{"key1":"a","key2":"b"}`: {"key1": "a", "key2": "b"},
`{"key1":"b","key2":"a"}`: {"key1": "b", "key2": "a"},
@@ -283,13 +283,13 @@ func TestParamSetsAreUniqueByMergeKeys(t *testing.T) {
{
name: "compound key object, unique paramSets",
mergeKeys: []string{"key1", "key2"},
paramSets: []map[string]interface{}{
{"key1": "a", "key2": map[string]interface{}{"hello": "world"}},
paramSets: []map[string]any{
{"key1": "a", "key2": map[string]any{"hello": "world"}},
{"key1": "a", "key2": "b"},
{"key1": "b", "key2": "a"},
},
expected: map[string]map[string]interface{}{
`{"key1":"a","key2":{"hello":"world"}}`: {"key1": "a", "key2": map[string]interface{}{"hello": "world"}},
expected: map[string]map[string]any{
`{"key1":"a","key2":{"hello":"world"}}`: {"key1": "a", "key2": map[string]any{"hello": "world"}},
`{"key1":"a","key2":"b"}`: {"key1": "a", "key2": "b"},
`{"key1":"b","key2":"a"}`: {"key1": "b", "key2": "a"},
},
@@ -297,12 +297,12 @@ func TestParamSetsAreUniqueByMergeKeys(t *testing.T) {
{
name: "compound key, duplicate key names, unique paramSets",
mergeKeys: []string{"key1", "key1", "key2"},
paramSets: []map[string]interface{}{
paramSets: []map[string]any{
{"key1": "a", "key2": "a"},
{"key1": "a", "key2": "b"},
{"key1": "b", "key2": "a"},
},
expected: map[string]map[string]interface{}{
expected: map[string]map[string]any{
`{"key1":"a","key2":"a"}`: {"key1": "a", "key2": "a"},
`{"key1":"a","key2":"b"}`: {"key1": "a", "key2": "b"},
`{"key1":"b","key2":"a"}`: {"key1": "b", "key2": "a"},
@@ -311,7 +311,7 @@ func TestParamSetsAreUniqueByMergeKeys(t *testing.T) {
{
name: "compound key, non-unique paramSets",
mergeKeys: []string{"key1", "key2"},
paramSets: []map[string]interface{}{
paramSets: []map[string]any{
{"key1": "a", "key2": "a"},
{"key1": "a", "key2": "a"},
{"key1": "b", "key2": "a"},
@@ -321,7 +321,7 @@ func TestParamSetsAreUniqueByMergeKeys(t *testing.T) {
{
name: "compound key, duplicate key names, non-unique paramSets",
mergeKeys: []string{"key1", "key1", "key2"},
paramSets: []map[string]interface{}{
paramSets: []map[string]any{
{"key1": "a", "key2": "a"},
{"key1": "a", "key2": "a"},
{"key1": "b", "key2": "a"},

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
// Code generated by mockery v2.52.4. DO NOT EDIT.
package mocks
@@ -9,7 +9,7 @@ import (
time "time"
v1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
v1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
// Generator is an autogenerated mock type for the Generator type

View File

@@ -2,6 +2,7 @@ package generators
import (
"context"
"errors"
"fmt"
"strconv"
"strings"
@@ -12,10 +13,10 @@ import (
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/controller-runtime/pkg/client"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v2/util/settings"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/util/settings"
"github.com/argoproj/argo-cd/v2/applicationset/services/plugin"
"github.com/argoproj/argo-cd/v3/applicationset/services/plugin"
)
const (
@@ -31,7 +32,7 @@ type PluginGenerator struct {
namespace string
}
func NewPluginGenerator(client client.Client, ctx context.Context, clientset kubernetes.Interface, namespace string) Generator {
func NewPluginGenerator(ctx context.Context, client client.Client, clientset kubernetes.Interface, namespace string) Generator {
g := &PluginGenerator{
client: client,
ctx: ctx,
@@ -55,7 +56,7 @@ func (g *PluginGenerator) GetTemplate(appSetGenerator *argoprojiov1alpha1.Applic
return &appSetGenerator.Plugin.Template
}
func (g *PluginGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, applicationSetInfo *argoprojiov1alpha1.ApplicationSet, _ client.Client) ([]map[string]interface{}, error) {
func (g *PluginGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, applicationSetInfo *argoprojiov1alpha1.ApplicationSet, _ client.Client) ([]map[string]any, error) {
if appSetGenerator == nil {
return nil, EmptyAppSetGeneratorError
}
@@ -105,18 +106,18 @@ func (g *PluginGenerator) getPluginFromGenerator(ctx context.Context, appSetName
}
}
pluginClient, err := plugin.NewPluginService(ctx, appSetName, cm["baseUrl"], token, requestTimeout)
pluginClient, err := plugin.NewPluginService(appSetName, cm["baseUrl"], token, requestTimeout)
if err != nil {
return nil, fmt.Errorf("error initializing plugin client: %w", err)
}
return pluginClient, nil
}
func (g *PluginGenerator) generateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet, objectsFound []map[string]interface{}, pluginParams argoprojiov1alpha1.PluginParameters, useGoTemplate bool) ([]map[string]interface{}, error) {
res := []map[string]interface{}{}
func (g *PluginGenerator) generateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet, objectsFound []map[string]any, pluginParams argoprojiov1alpha1.PluginParameters, useGoTemplate bool) ([]map[string]any, error) {
res := []map[string]any{}
for _, objectFound := range objectsFound {
params := map[string]interface{}{}
params := map[string]any{}
if useGoTemplate {
for k, v := range objectFound {
@@ -132,7 +133,7 @@ func (g *PluginGenerator) generateParams(appSetGenerator *argoprojiov1alpha1.App
}
}
params["generator"] = map[string]interface{}{
params["generator"] = map[string]any{
"input": map[string]argoprojiov1alpha1.PluginParameters{
"parameters": pluginParams,
},
@@ -192,14 +193,14 @@ func (g *PluginGenerator) getConfigMap(ctx context.Context, configMapRef string)
return nil, err
}
baseUrl, ok := cm.Data["baseUrl"]
if !ok || baseUrl == "" {
return nil, fmt.Errorf("baseUrl not found in ConfigMap")
baseURL, ok := cm.Data["baseUrl"]
if !ok || baseURL == "" {
return nil, errors.New("baseUrl not found in ConfigMap")
}
token, ok := cm.Data["token"]
if !ok || token == "" {
return nil, fmt.Errorf("token not found in ConfigMap")
return nil, errors.New("token not found in ConfigMap")
}
return cm.Data, nil

View File

@@ -1,8 +1,8 @@
package generators
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"net/http/httptest"
@@ -11,7 +11,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
v1 "k8s.io/api/core/v1"
corev1 "k8s.io/api/core/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
@@ -19,25 +19,25 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"github.com/argoproj/argo-cd/v2/applicationset/services/plugin"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/applicationset/services/plugin"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func TestPluginGenerateParams(t *testing.T) {
testCases := []struct {
name string
configmap *v1.ConfigMap
secret *v1.Secret
configmap *corev1.ConfigMap
secret *corev1.Secret
inputParameters map[string]apiextensionsv1.JSON
values map[string]string
gotemplate bool
expected []map[string]interface{}
expected []map[string]any
content []byte
expectedError error
}{
{
name: "simple case",
configmap: &v1.ConfigMap{
configmap: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "first-plugin-cm",
Namespace: "default",
@@ -47,7 +47,7 @@ func TestPluginGenerateParams(t *testing.T) {
"token": "$plugin.token",
},
},
secret: &v1.Secret{
secret: &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "argocd-secret",
Namespace: "default",
@@ -73,13 +73,13 @@ func TestPluginGenerateParams(t *testing.T) {
"key3": 123
}]
}}`),
expected: []map[string]interface{}{
expected: []map[string]any{
{
"key1": "val1",
"key2.key2_1": "val2_1",
"key2.key2_2.key2_2_1": "val2_2_1",
"key3": "123",
"generator": map[string]interface{}{
"generator": map[string]any{
"input": argoprojiov1alpha1.PluginInput{
Parameters: argoprojiov1alpha1.PluginParameters{
"pkey1": {Raw: []byte(`"val1"`)},
@@ -93,7 +93,7 @@ func TestPluginGenerateParams(t *testing.T) {
},
{
name: "simple case with values",
configmap: &v1.ConfigMap{
configmap: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "first-plugin-cm",
Namespace: "default",
@@ -103,7 +103,7 @@ func TestPluginGenerateParams(t *testing.T) {
"token": "$plugin.token",
},
},
secret: &v1.Secret{
secret: &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "argocd-secret",
Namespace: "default",
@@ -133,7 +133,7 @@ func TestPluginGenerateParams(t *testing.T) {
"key3": 123
}]
}}`),
expected: []map[string]interface{}{
expected: []map[string]any{
{
"key1": "val1",
"key2.key2_1": "val2_1",
@@ -141,7 +141,7 @@ func TestPluginGenerateParams(t *testing.T) {
"key3": "123",
"values.valuekey1": "valuevalue1",
"values.valuekey2": "templated-val1",
"generator": map[string]interface{}{
"generator": map[string]any{
"input": argoprojiov1alpha1.PluginInput{
Parameters: argoprojiov1alpha1.PluginParameters{
"pkey1": {Raw: []byte(`"val1"`)},
@@ -155,7 +155,7 @@ func TestPluginGenerateParams(t *testing.T) {
},
{
name: "simple case with gotemplate",
configmap: &v1.ConfigMap{
configmap: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "first-plugin-cm",
Namespace: "default",
@@ -165,7 +165,7 @@ func TestPluginGenerateParams(t *testing.T) {
"token": "$plugin.token",
},
},
secret: &v1.Secret{
secret: &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "argocd-secret",
Namespace: "default",
@@ -191,17 +191,17 @@ func TestPluginGenerateParams(t *testing.T) {
"key3": 123
}]
}}`),
expected: []map[string]interface{}{
expected: []map[string]any{
{
"key1": "val1",
"key2": map[string]interface{}{
"key2": map[string]any{
"key2_1": "val2_1",
"key2_2": map[string]interface{}{
"key2_2": map[string]any{
"key2_2_1": "val2_2_1",
},
},
"key3": float64(123),
"generator": map[string]interface{}{
"generator": map[string]any{
"input": argoprojiov1alpha1.PluginInput{
Parameters: argoprojiov1alpha1.PluginParameters{
"pkey1": {Raw: []byte(`"val1"`)},
@@ -215,7 +215,7 @@ func TestPluginGenerateParams(t *testing.T) {
},
{
name: "simple case with appended params",
configmap: &v1.ConfigMap{
configmap: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "first-plugin-cm",
Namespace: "default",
@@ -225,7 +225,7 @@ func TestPluginGenerateParams(t *testing.T) {
"token": "$plugin.token",
},
},
secret: &v1.Secret{
secret: &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "argocd-secret",
Namespace: "default",
@@ -250,14 +250,14 @@ func TestPluginGenerateParams(t *testing.T) {
"key3": 123,
"pkey2": "valplugin"
}]}}`),
expected: []map[string]interface{}{
expected: []map[string]any{
{
"key1": "val1",
"key2.key2_1": "val2_1",
"key2.key2_2.key2_2_1": "val2_2_1",
"key3": "123",
"pkey2": "valplugin",
"generator": map[string]interface{}{
"generator": map[string]any{
"input": argoprojiov1alpha1.PluginInput{
Parameters: argoprojiov1alpha1.PluginParameters{
"pkey1": {Raw: []byte(`"val1"`)},
@@ -271,7 +271,7 @@ func TestPluginGenerateParams(t *testing.T) {
},
{
name: "no params",
configmap: &v1.ConfigMap{
configmap: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "first-plugin-cm",
Namespace: "default",
@@ -281,7 +281,7 @@ func TestPluginGenerateParams(t *testing.T) {
"token": "$plugin.token",
},
},
secret: &v1.Secret{
secret: &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "argocd-secret",
Namespace: "default",
@@ -304,14 +304,14 @@ func TestPluginGenerateParams(t *testing.T) {
"key3": 123
}]
}}`),
expected: []map[string]interface{}{
expected: []map[string]any{
{
"key1": "val1",
"key2.key2_1": "val2_1",
"key2.key2_2.key2_2_1": "val2_2_1",
"key3": "123",
"generator": map[string]interface{}{
"input": map[string]map[string]interface{}{
"generator": map[string]any{
"input": map[string]map[string]any{
"parameters": {},
},
},
@@ -321,7 +321,7 @@ func TestPluginGenerateParams(t *testing.T) {
},
{
name: "empty return",
configmap: &v1.ConfigMap{
configmap: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "first-plugin-cm",
Namespace: "default",
@@ -331,7 +331,7 @@ func TestPluginGenerateParams(t *testing.T) {
"token": "$plugin.token",
},
},
secret: &v1.Secret{
secret: &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "argocd-secret",
Namespace: "default",
@@ -343,12 +343,12 @@ func TestPluginGenerateParams(t *testing.T) {
inputParameters: map[string]apiextensionsv1.JSON{},
gotemplate: false,
content: []byte(`{"input": {"parameters": []}}`),
expected: []map[string]interface{}{},
expected: []map[string]any{},
expectedError: nil,
},
{
name: "wrong return",
configmap: &v1.ConfigMap{
configmap: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "first-plugin-cm",
Namespace: "default",
@@ -358,7 +358,7 @@ func TestPluginGenerateParams(t *testing.T) {
"token": "$plugin.token",
},
},
secret: &v1.Secret{
secret: &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "argocd-secret",
Namespace: "default",
@@ -370,12 +370,12 @@ func TestPluginGenerateParams(t *testing.T) {
inputParameters: map[string]apiextensionsv1.JSON{},
gotemplate: false,
content: []byte(`wrong body ...`),
expected: []map[string]interface{}{},
expectedError: fmt.Errorf("error listing params: error get api 'set': invalid character 'w' looking for beginning of value: wrong body ..."),
expected: []map[string]any{},
expectedError: errors.New("error listing params: error get api 'set': invalid character 'w' looking for beginning of value: wrong body ..."),
},
{
name: "external secret",
configmap: &v1.ConfigMap{
configmap: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "first-plugin-cm",
Namespace: "default",
@@ -385,7 +385,7 @@ func TestPluginGenerateParams(t *testing.T) {
"token": "$plugin-secret:plugin.token",
},
},
secret: &v1.Secret{
secret: &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "plugin-secret",
Namespace: "default",
@@ -410,14 +410,14 @@ func TestPluginGenerateParams(t *testing.T) {
"key3": 123,
"pkey2": "valplugin"
}]}}`),
expected: []map[string]interface{}{
expected: []map[string]any{
{
"key1": "val1",
"key2.key2_1": "val2_1",
"key2.key2_2.key2_2_1": "val2_2_1",
"key3": "123",
"pkey2": "valplugin",
"generator": map[string]interface{}{
"generator": map[string]any{
"input": argoprojiov1alpha1.PluginInput{
Parameters: argoprojiov1alpha1.PluginParameters{
"pkey1": {Raw: []byte(`"val1"`)},
@@ -431,7 +431,7 @@ func TestPluginGenerateParams(t *testing.T) {
},
{
name: "no secret",
configmap: &v1.ConfigMap{
configmap: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "first-plugin-cm",
Namespace: "default",
@@ -441,7 +441,7 @@ func TestPluginGenerateParams(t *testing.T) {
"token": "$plugin.token",
},
},
secret: &v1.Secret{},
secret: &corev1.Secret{},
inputParameters: map[string]apiextensionsv1.JSON{
"pkey1": {Raw: []byte(`"val1"`)},
"pkey2": {Raw: []byte(`"val2"`)},
@@ -459,13 +459,13 @@ func TestPluginGenerateParams(t *testing.T) {
"key3": 123
}]
}}`),
expected: []map[string]interface{}{
expected: []map[string]any{
{
"key1": "val1",
"key2.key2_1": "val2_1",
"key2.key2_2.key2_2_1": "val2_2_1",
"key3": "123",
"generator": map[string]interface{}{
"generator": map[string]any{
"input": argoprojiov1alpha1.PluginInput{
Parameters: argoprojiov1alpha1.PluginParameters{
"pkey1": {Raw: []byte(`"val1"`)},
@@ -475,12 +475,12 @@ func TestPluginGenerateParams(t *testing.T) {
},
},
},
expectedError: fmt.Errorf("error getting plugin from generator: error fetching Secret token: error fetching secret default/argocd-secret: secrets \"argocd-secret\" not found"),
expectedError: errors.New("error getting plugin from generator: error fetching Secret token: error fetching secret default/argocd-secret: secrets \"argocd-secret\" not found"),
},
{
name: "no configmap",
configmap: &v1.ConfigMap{},
secret: &v1.Secret{
configmap: &corev1.ConfigMap{},
secret: &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "argocd-secret",
Namespace: "default",
@@ -506,13 +506,13 @@ func TestPluginGenerateParams(t *testing.T) {
"key3": 123
}]
}}`),
expected: []map[string]interface{}{
expected: []map[string]any{
{
"key1": "val1",
"key2.key2_1": "val2_1",
"key2.key2_2.key2_2_1": "val2_2_1",
"key3": "123",
"generator": map[string]interface{}{
"generator": map[string]any{
"input": argoprojiov1alpha1.PluginInput{
Parameters: argoprojiov1alpha1.PluginParameters{
"pkey1": {Raw: []byte(`"val1"`)},
@@ -522,11 +522,11 @@ func TestPluginGenerateParams(t *testing.T) {
},
},
},
expectedError: fmt.Errorf("error getting plugin from generator: error fetching ConfigMap: configmaps \"\" not found"),
expectedError: errors.New("error getting plugin from generator: error fetching ConfigMap: configmaps \"\" not found"),
},
{
name: "no baseUrl",
configmap: &v1.ConfigMap{
configmap: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "first-plugin-cm",
Namespace: "default",
@@ -535,7 +535,7 @@ func TestPluginGenerateParams(t *testing.T) {
"token": "$plugin.token",
},
},
secret: &v1.Secret{
secret: &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "argocd-secret",
Namespace: "default",
@@ -561,13 +561,13 @@ func TestPluginGenerateParams(t *testing.T) {
"key3": 123
}]
}}`),
expected: []map[string]interface{}{
expected: []map[string]any{
{
"key1": "val1",
"key2.key2_1": "val2_1",
"key2.key2_2.key2_2_1": "val2_2_1",
"key3": "123",
"generator": map[string]interface{}{
"generator": map[string]any{
"input": argoprojiov1alpha1.PluginInput{
Parameters: argoprojiov1alpha1.PluginParameters{
"pkey1": {Raw: []byte(`"val1"`)},
@@ -577,11 +577,11 @@ func TestPluginGenerateParams(t *testing.T) {
},
},
},
expectedError: fmt.Errorf("error getting plugin from generator: error fetching ConfigMap: baseUrl not found in ConfigMap"),
expectedError: errors.New("error getting plugin from generator: error fetching ConfigMap: baseUrl not found in ConfigMap"),
},
{
name: "no token",
configmap: &v1.ConfigMap{
configmap: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "first-plugin-cm",
Namespace: "default",
@@ -590,7 +590,7 @@ func TestPluginGenerateParams(t *testing.T) {
"baseUrl": "http://127.0.0.1",
},
},
secret: &v1.Secret{},
secret: &corev1.Secret{},
inputParameters: map[string]apiextensionsv1.JSON{
"pkey1": {Raw: []byte(`"val1"`)},
"pkey2": {Raw: []byte(`"val2"`)},
@@ -608,13 +608,13 @@ func TestPluginGenerateParams(t *testing.T) {
"key3": 123
}]
}}`),
expected: []map[string]interface{}{
expected: []map[string]any{
{
"key1": "val1",
"key2.key2_1": "val2_1",
"key2.key2_2.key2_2_1": "val2_2_1",
"key3": "123",
"generator": map[string]interface{}{
"generator": map[string]any{
"input": argoprojiov1alpha1.PluginInput{
Parameters: argoprojiov1alpha1.PluginParameters{
"pkey1": {Raw: []byte(`"val1"`)},
@@ -624,11 +624,11 @@ func TestPluginGenerateParams(t *testing.T) {
},
},
},
expectedError: fmt.Errorf("error getting plugin from generator: error fetching ConfigMap: token not found in ConfigMap"),
expectedError: errors.New("error getting plugin from generator: error fetching ConfigMap: token not found in ConfigMap"),
},
}
ctx := context.Background()
ctx := t.Context()
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
@@ -670,7 +670,7 @@ func TestPluginGenerateParams(t *testing.T) {
fakeClientWithCache := fake.NewClientBuilder().WithObjects([]client.Object{testCase.configmap, testCase.secret}...).Build()
pluginGenerator := NewPluginGenerator(fakeClientWithCache, ctx, fakeClient, "default")
pluginGenerator := NewPluginGenerator(ctx, fakeClientWithCache, fakeClient, "default")
applicationSetInfo := argoprojiov1alpha1.ApplicationSet{
ObjectMeta: metav1.ObjectMeta{
@@ -690,11 +690,11 @@ func TestPluginGenerateParams(t *testing.T) {
require.EqualError(t, err, testCase.expectedError.Error())
} else {
require.NoError(t, err)
expectedJson, err := json.Marshal(testCase.expected)
expectedJSON, err := json.Marshal(testCase.expected)
require.NoError(t, err)
gotJson, err := json.Marshal(got)
gotJSON, err := json.Marshal(got)
require.NoError(t, err)
assert.JSONEq(t, string(expectedJson), string(gotJson))
assert.JSONEq(t, string(expectedJSON), string(gotJSON))
}
})
}

View File

@@ -2,6 +2,7 @@ package generators
import (
"context"
"errors"
"fmt"
"strconv"
"time"
@@ -10,9 +11,9 @@ import (
"github.com/gosimple/slug"
pullrequest "github.com/argoproj/argo-cd/v2/applicationset/services/pull_request"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
pullrequest "github.com/argoproj/argo-cd/v3/applicationset/services/pull_request"
"github.com/argoproj/argo-cd/v3/applicationset/utils"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
var _ Generator = (*PullRequestGenerator)(nil)
@@ -50,7 +51,7 @@ func (g *PullRequestGenerator) GetTemplate(appSetGenerator *argoprojiov1alpha1.A
return &appSetGenerator.PullRequest.Template
}
func (g *PullRequestGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, applicationSetInfo *argoprojiov1alpha1.ApplicationSet, _ client.Client) ([]map[string]interface{}, error) {
func (g *PullRequestGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, applicationSetInfo *argoprojiov1alpha1.ApplicationSet, _ client.Client) ([]map[string]any, error) {
if appSetGenerator == nil {
return nil, EmptyAppSetGeneratorError
}
@@ -69,7 +70,7 @@ func (g *PullRequestGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha
if err != nil {
return nil, fmt.Errorf("error listing repos: %w", err)
}
params := make([]map[string]interface{}, 0, len(pulls))
params := make([]map[string]any, 0, len(pulls))
// In order to follow the DNS label standard as defined in RFC 1123,
// we need to limit the 'branch' to 50 to give room to append/suffix-ing it
@@ -95,7 +96,7 @@ func (g *PullRequestGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha
shortSHALength7 = len(pull.HeadSHA)
}
paramMap := map[string]interface{}{
paramMap := map[string]any{
"number": strconv.Itoa(pull.Number),
"title": pull.Title,
"branch": pull.Branch,
@@ -108,6 +109,11 @@ func (g *PullRequestGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha
"author": pull.Author,
}
err := appendTemplatedValues(appSetGenerator.PullRequest.Values, paramMap, applicationSetInfo.Spec.GoTemplate, applicationSetInfo.Spec.GoTemplateOptions)
if err != nil {
return nil, fmt.Errorf("failed to append templated values: %w", err)
}
// PR lables will only be supported for Go Template appsets, since fasttemplate will be deprecated.
if applicationSetInfo != nil && applicationSetInfo.Spec.GoTemplate {
paramMap["labels"] = pull.Labels
@@ -143,7 +149,7 @@ func (g *PullRequestGenerator) selectServiceProvider(ctx context.Context, genera
if err != nil {
return nil, fmt.Errorf("error fetching Secret token: %w", err)
}
return pullrequest.NewGitLabService(ctx, token, providerConfig.API, providerConfig.Project, providerConfig.Labels, providerConfig.PullRequestState, g.scmRootCAPath, providerConfig.Insecure, caCerts)
return pullrequest.NewGitLabService(token, providerConfig.API, providerConfig.Project, providerConfig.Labels, providerConfig.PullRequestState, g.scmRootCAPath, providerConfig.Insecure, caCerts)
}
if generatorConfig.Gitea != nil {
providerConfig := generatorConfig.Gitea
@@ -151,7 +157,7 @@ func (g *PullRequestGenerator) selectServiceProvider(ctx context.Context, genera
if err != nil {
return nil, fmt.Errorf("error fetching Secret token: %w", err)
}
return pullrequest.NewGiteaService(ctx, token, providerConfig.API, providerConfig.Owner, providerConfig.Repo, providerConfig.Insecure)
return pullrequest.NewGiteaService(token, providerConfig.API, providerConfig.Owner, providerConfig.Repo, providerConfig.Insecure)
}
if generatorConfig.BitbucketServer != nil {
providerConfig := generatorConfig.BitbucketServer
@@ -175,9 +181,8 @@ func (g *PullRequestGenerator) selectServiceProvider(ctx context.Context, genera
return nil, fmt.Errorf("error fetching Secret token: %w", err)
}
return pullrequest.NewBitbucketServiceBasicAuth(ctx, providerConfig.BasicAuth.Username, password, providerConfig.API, providerConfig.Project, providerConfig.Repo, g.scmRootCAPath, providerConfig.Insecure, caCerts)
} else {
return pullrequest.NewBitbucketServiceNoAuth(ctx, providerConfig.API, providerConfig.Project, providerConfig.Repo, g.scmRootCAPath, providerConfig.Insecure, caCerts)
}
return pullrequest.NewBitbucketServiceNoAuth(ctx, providerConfig.API, providerConfig.Project, providerConfig.Repo, g.scmRootCAPath, providerConfig.Insecure, caCerts)
}
if generatorConfig.Bitbucket != nil {
providerConfig := generatorConfig.Bitbucket
@@ -193,9 +198,8 @@ func (g *PullRequestGenerator) selectServiceProvider(ctx context.Context, genera
return nil, fmt.Errorf("error fetching Secret token: %w", err)
}
return pullrequest.NewBitbucketCloudServiceBasicAuth(providerConfig.API, providerConfig.BasicAuth.Username, password, providerConfig.Owner, providerConfig.Repo)
} else {
return pullrequest.NewBitbucketCloudServiceNoAuth(providerConfig.API, providerConfig.Owner, providerConfig.Repo)
}
return pullrequest.NewBitbucketCloudServiceNoAuth(providerConfig.API, providerConfig.Owner, providerConfig.Repo)
}
if generatorConfig.AzureDevOps != nil {
providerConfig := generatorConfig.AzureDevOps
@@ -203,9 +207,9 @@ func (g *PullRequestGenerator) selectServiceProvider(ctx context.Context, genera
if err != nil {
return nil, fmt.Errorf("error fetching Secret token: %w", err)
}
return pullrequest.NewAzureDevOpsService(ctx, token, providerConfig.API, providerConfig.Organization, providerConfig.Project, providerConfig.Repo, providerConfig.Labels)
return pullrequest.NewAzureDevOpsService(token, providerConfig.API, providerConfig.Organization, providerConfig.Project, providerConfig.Repo, providerConfig.Labels)
}
return nil, fmt.Errorf("no Pull Request provider implementation configured")
return nil, errors.New("no Pull Request provider implementation configured")
}
func (g *PullRequestGenerator) github(ctx context.Context, cfg *argoprojiov1alpha1.PullRequestGeneratorGithub, applicationSetInfo *argoprojiov1alpha1.ApplicationSet) (pullrequest.PullRequestService, error) {
@@ -223,5 +227,5 @@ func (g *PullRequestGenerator) github(ctx context.Context, cfg *argoprojiov1alph
if err != nil {
return nil, fmt.Errorf("error fetching Secret token: %w", err)
}
return pullrequest.NewGithubService(ctx, token, cfg.API, cfg.Owner, cfg.Repo, cfg.Labels)
return pullrequest.NewGithubService(token, cfg.API, cfg.Owner, cfg.Repo, cfg.Labels)
}

View File

@@ -2,22 +2,23 @@ package generators
import (
"context"
"fmt"
"errors"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
pullrequest "github.com/argoproj/argo-cd/v2/applicationset/services/pull_request"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
pullrequest "github.com/argoproj/argo-cd/v3/applicationset/services/pull_request"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func TestPullRequestGithubGenerateParams(t *testing.T) {
ctx := context.Background()
ctx := t.Context()
cases := []struct {
selectFunc func(context.Context, *argoprojiov1alpha1.PullRequestGenerator, *argoprojiov1alpha1.ApplicationSet) (pullrequest.PullRequestService, error)
expected []map[string]interface{}
values map[string]string
expected []map[string]any
expectedErr error
applicationSet argoprojiov1alpha1.ApplicationSet
}{
@@ -38,7 +39,7 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
nil,
)
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"number": "1",
"title": "title1",
@@ -71,7 +72,7 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
nil,
)
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"number": "2",
"title": "title2",
@@ -104,7 +105,7 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
nil,
)
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"number": "1",
"title": "title1",
@@ -124,12 +125,51 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
selectFunc: func(context.Context, *argoprojiov1alpha1.PullRequestGenerator, *argoprojiov1alpha1.ApplicationSet) (pullrequest.PullRequestService, error) {
return pullrequest.NewFakeService(
ctx,
[]*pullrequest.PullRequest{
{
Number: 1,
Title: "title1",
Branch: "my_branch",
TargetBranch: "master",
HeadSHA: "abcd",
Author: "testName",
},
},
nil,
fmt.Errorf("fake error"),
)
},
values: map[string]string{
"foo": "bar",
"pr_branch": "{{ branch }}",
},
expected: []map[string]any{
{
"number": "1",
"title": "title1",
"branch": "my_branch",
"branch_slug": "my-branch",
"target_branch": "master",
"target_branch_slug": "master",
"head_sha": "abcd",
"head_short_sha": "abcd",
"head_short_sha_7": "abcd",
"author": "testName",
"values.foo": "bar",
"values.pr_branch": "my_branch",
},
},
expectedErr: nil,
},
{
selectFunc: func(context.Context, *argoprojiov1alpha1.PullRequestGenerator, *argoprojiov1alpha1.ApplicationSet) (pullrequest.PullRequestService, error) {
return pullrequest.NewFakeService(
ctx,
nil,
errors.New("fake error"),
)
},
expected: nil,
expectedErr: fmt.Errorf("error listing repos: fake error"),
expectedErr: errors.New("error listing repos: fake error"),
},
{
selectFunc: func(context.Context, *argoprojiov1alpha1.PullRequestGenerator, *argoprojiov1alpha1.ApplicationSet) (pullrequest.PullRequestService, error) {
@@ -149,7 +189,7 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
nil,
)
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"number": "1",
"title": "title1",
@@ -190,7 +230,7 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
nil,
)
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"number": "1",
"title": "title1",
@@ -219,12 +259,14 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
selectServiceProviderFunc: c.selectFunc,
}
generatorConfig := argoprojiov1alpha1.ApplicationSetGenerator{
PullRequest: &argoprojiov1alpha1.PullRequestGenerator{},
PullRequest: &argoprojiov1alpha1.PullRequestGenerator{
Values: c.values,
},
}
got, gotErr := gen.GenerateParams(&generatorConfig, &c.applicationSet, nil)
if c.expectedErr != nil {
assert.Equal(t, c.expectedErr.Error(), gotErr.Error())
require.EqualError(t, gotErr, c.expectedErr.Error())
} else {
require.NoError(t, gotErr)
}

View File

@@ -11,11 +11,11 @@ import (
log "github.com/sirupsen/logrus"
"github.com/argoproj/argo-cd/v2/applicationset/services/github_app_auth"
"github.com/argoproj/argo-cd/v2/applicationset/services/scm_provider"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
"github.com/argoproj/argo-cd/v2/common"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/applicationset/services/github_app_auth"
"github.com/argoproj/argo-cd/v3/applicationset/services/scm_provider"
"github.com/argoproj/argo-cd/v3/applicationset/utils"
"github.com/argoproj/argo-cd/v3/common"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
var _ Generator = (*SCMProviderGenerator)(nil)
@@ -116,7 +116,7 @@ func ScmProviderAllowed(applicationSetInfo *argoprojiov1alpha1.ApplicationSet, g
return NewErrDisallowedSCMProvider(url, allowedScmProviders)
}
func (g *SCMProviderGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, applicationSetInfo *argoprojiov1alpha1.ApplicationSet, _ client.Client) ([]map[string]interface{}, error) {
func (g *SCMProviderGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, applicationSetInfo *argoprojiov1alpha1.ApplicationSet, _ client.Client) ([]map[string]any, error) {
if appSetGenerator == nil {
return nil, EmptyAppSetGeneratorError
}
@@ -138,15 +138,16 @@ func (g *SCMProviderGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha
ctx := context.Background()
var provider scm_provider.SCMProviderService
if g.overrideProvider != nil {
switch {
case g.overrideProvider != nil:
provider = g.overrideProvider
} else if providerConfig.Github != nil {
case providerConfig.Github != nil:
var err error
provider, err = g.githubProvider(ctx, providerConfig.Github, applicationSetInfo)
if err != nil {
return nil, fmt.Errorf("scm provider: %w", err)
}
} else if providerConfig.Gitlab != nil {
case providerConfig.Gitlab != nil:
providerConfig := providerConfig.Gitlab
var caCerts []byte
var scmError error
@@ -160,20 +161,20 @@ func (g *SCMProviderGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha
if err != nil {
return nil, fmt.Errorf("error fetching Gitlab token: %w", err)
}
provider, err = scm_provider.NewGitlabProvider(ctx, providerConfig.Group, token, providerConfig.API, providerConfig.AllBranches, providerConfig.IncludeSubgroups, providerConfig.WillIncludeSharedProjects(), providerConfig.Insecure, g.scmRootCAPath, providerConfig.Topic, caCerts)
provider, err = scm_provider.NewGitlabProvider(providerConfig.Group, token, providerConfig.API, providerConfig.AllBranches, providerConfig.IncludeSubgroups, providerConfig.WillIncludeSharedProjects(), providerConfig.Insecure, g.scmRootCAPath, providerConfig.Topic, caCerts)
if err != nil {
return nil, fmt.Errorf("error initializing Gitlab service: %w", err)
}
} else if providerConfig.Gitea != nil {
case providerConfig.Gitea != nil:
token, err := utils.GetSecretRef(ctx, g.client, providerConfig.Gitea.TokenRef, applicationSetInfo.Namespace, g.tokenRefStrictMode)
if err != nil {
return nil, fmt.Errorf("error fetching Gitea token: %w", err)
}
provider, err = scm_provider.NewGiteaProvider(ctx, providerConfig.Gitea.Owner, token, providerConfig.Gitea.API, providerConfig.Gitea.AllBranches, providerConfig.Gitea.Insecure)
provider, err = scm_provider.NewGiteaProvider(providerConfig.Gitea.Owner, token, providerConfig.Gitea.API, providerConfig.Gitea.AllBranches, providerConfig.Gitea.Insecure)
if err != nil {
return nil, fmt.Errorf("error initializing Gitea service: %w", err)
}
} else if providerConfig.BitbucketServer != nil {
case providerConfig.BitbucketServer != nil:
providerConfig := providerConfig.BitbucketServer
var caCerts []byte
var scmError error
@@ -183,50 +184,51 @@ func (g *SCMProviderGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha
return nil, fmt.Errorf("error fetching CA certificates from ConfigMap: %w", scmError)
}
}
if providerConfig.BearerToken != nil {
switch {
case providerConfig.BearerToken != nil:
appToken, err := utils.GetSecretRef(ctx, g.client, providerConfig.BearerToken.TokenRef, applicationSetInfo.Namespace, g.tokenRefStrictMode)
if err != nil {
return nil, fmt.Errorf("error fetching Secret Bearer token: %w", err)
}
provider, scmError = scm_provider.NewBitbucketServerProviderBearerToken(ctx, appToken, providerConfig.API, providerConfig.Project, providerConfig.AllBranches, g.scmRootCAPath, providerConfig.Insecure, caCerts)
} else if providerConfig.BasicAuth != nil {
case providerConfig.BasicAuth != nil:
password, err := utils.GetSecretRef(ctx, g.client, providerConfig.BasicAuth.PasswordRef, applicationSetInfo.Namespace, g.tokenRefStrictMode)
if err != nil {
return nil, fmt.Errorf("error fetching Secret token: %w", err)
}
provider, scmError = scm_provider.NewBitbucketServerProviderBasicAuth(ctx, providerConfig.BasicAuth.Username, password, providerConfig.API, providerConfig.Project, providerConfig.AllBranches, g.scmRootCAPath, providerConfig.Insecure, caCerts)
} else {
default:
provider, scmError = scm_provider.NewBitbucketServerProviderNoAuth(ctx, providerConfig.API, providerConfig.Project, providerConfig.AllBranches, g.scmRootCAPath, providerConfig.Insecure, caCerts)
}
if scmError != nil {
return nil, fmt.Errorf("error initializing Bitbucket Server service: %w", scmError)
}
} else if providerConfig.AzureDevOps != nil {
case providerConfig.AzureDevOps != nil:
token, err := utils.GetSecretRef(ctx, g.client, providerConfig.AzureDevOps.AccessTokenRef, applicationSetInfo.Namespace, g.tokenRefStrictMode)
if err != nil {
return nil, fmt.Errorf("error fetching Azure Devops access token: %w", err)
}
provider, err = scm_provider.NewAzureDevOpsProvider(ctx, token, providerConfig.AzureDevOps.Organization, providerConfig.AzureDevOps.API, providerConfig.AzureDevOps.TeamProject, providerConfig.AzureDevOps.AllBranches)
provider, err = scm_provider.NewAzureDevOpsProvider(token, providerConfig.AzureDevOps.Organization, providerConfig.AzureDevOps.API, providerConfig.AzureDevOps.TeamProject, providerConfig.AzureDevOps.AllBranches)
if err != nil {
return nil, fmt.Errorf("error initializing Azure Devops service: %w", err)
}
} else if providerConfig.Bitbucket != nil {
case providerConfig.Bitbucket != nil:
appPassword, err := utils.GetSecretRef(ctx, g.client, providerConfig.Bitbucket.AppPasswordRef, applicationSetInfo.Namespace, g.tokenRefStrictMode)
if err != nil {
return nil, fmt.Errorf("error fetching Bitbucket cloud appPassword: %w", err)
}
provider, err = scm_provider.NewBitBucketCloudProvider(ctx, providerConfig.Bitbucket.Owner, providerConfig.Bitbucket.User, appPassword, providerConfig.Bitbucket.AllBranches)
provider, err = scm_provider.NewBitBucketCloudProvider(providerConfig.Bitbucket.Owner, providerConfig.Bitbucket.User, appPassword, providerConfig.Bitbucket.AllBranches)
if err != nil {
return nil, fmt.Errorf("error initializing Bitbucket cloud service: %w", err)
}
} else if providerConfig.AWSCodeCommit != nil {
case providerConfig.AWSCodeCommit != nil:
var awsErr error
provider, awsErr = scm_provider.NewAWSCodeCommitProvider(ctx, providerConfig.AWSCodeCommit.TagFilters, providerConfig.AWSCodeCommit.Role, providerConfig.AWSCodeCommit.Region, providerConfig.AWSCodeCommit.AllBranches)
if awsErr != nil {
return nil, fmt.Errorf("error initializing AWS codecommit service: %w", awsErr)
}
} else {
return nil, fmt.Errorf("no SCM provider implementation configured")
default:
return nil, errors.New("no SCM provider implementation configured")
}
// Find all the available repos.
@@ -234,7 +236,7 @@ func (g *SCMProviderGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha
if err != nil {
return nil, fmt.Errorf("error listing repos: %w", err)
}
paramsArray := make([]map[string]interface{}, 0, len(repos))
paramsArray := make([]map[string]any, 0, len(repos))
var shortSHALength int
var shortSHALength7 int
for _, repo := range repos {
@@ -248,7 +250,7 @@ func (g *SCMProviderGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha
shortSHALength7 = len(repo.SHA)
}
params := map[string]interface{}{
params := map[string]any{
"organization": repo.Organization,
"repository": repo.Repository,
"url": repo.URL,
@@ -289,5 +291,5 @@ func (g *SCMProviderGenerator) githubProvider(ctx context.Context, github *argop
if err != nil {
return nil, fmt.Errorf("error fetching Github token: %w", err)
}
return scm_provider.NewGithubProvider(ctx, github.Organization, token, github.API, github.AllBranches)
return scm_provider.NewGithubProvider(github.Organization, token, github.API, github.AllBranches)
}

View File

@@ -7,8 +7,8 @@ import (
"github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/argoproj/argo-cd/v2/applicationset/services/scm_provider"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/applicationset/services/scm_provider"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func TestSCMProviderGenerateParams(t *testing.T) {
@@ -16,7 +16,7 @@ func TestSCMProviderGenerateParams(t *testing.T) {
name string
repos []*scm_provider.Repository
values map[string]string
expected []map[string]interface{}
expected []map[string]any
expectedError error
}{
{
@@ -38,7 +38,7 @@ func TestSCMProviderGenerateParams(t *testing.T) {
SHA: "59d0",
},
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"organization": "myorg",
"repository": "repo1",
@@ -79,7 +79,7 @@ func TestSCMProviderGenerateParams(t *testing.T) {
"foo": "bar",
"should_i_force_push_to": "{{ branch }}?",
},
expected: []map[string]interface{}{
expected: []map[string]any{
{
"organization": "myorg",
"repository": "repo3",

View File

@@ -1,5 +1,5 @@
package generators
type SCMGeneratorWithCustomApiUrl interface {
type SCMGeneratorWithCustomApiUrl interface { //nolint:revive //FIXME(var-naming)
CustomApiUrl() string
}

View File

@@ -7,18 +7,18 @@ import (
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/argoproj/argo-cd/v2/applicationset/services"
"github.com/argoproj/argo-cd/v3/applicationset/services"
)
func GetGenerators(ctx context.Context, c client.Client, k8sClient kubernetes.Interface, namespace string, argoCDService services.Repos, dynamicClient dynamic.Interface, scmConfig SCMConfig) map[string]Generator {
terminalGenerators := map[string]Generator{
"List": NewListGenerator(),
"Clusters": NewClusterGenerator(c, ctx, k8sClient, namespace),
"Clusters": NewClusterGenerator(ctx, c, k8sClient, namespace),
"Git": NewGitGenerator(argoCDService, namespace),
"SCMProvider": NewSCMProviderGenerator(c, scmConfig),
"ClusterDecisionResource": NewDuckTypeGenerator(ctx, dynamicClient, k8sClient, namespace),
"PullRequest": NewPullRequestGenerator(c, scmConfig),
"Plugin": NewPluginGenerator(c, ctx, k8sClient, namespace),
"Plugin": NewPluginGenerator(ctx, c, k8sClient, namespace),
}
nestedGenerators := map[string]Generator{

View File

@@ -4,11 +4,11 @@ import (
"fmt"
)
func appendTemplatedValues(values map[string]string, params map[string]interface{}, useGoTemplate bool, goTemplateOptions []string) error {
func appendTemplatedValues(values map[string]string, params map[string]any, useGoTemplate bool, goTemplateOptions []string) error {
// We create a local map to ensure that we do not fall victim to a billion-laughs attack. We iterate through the
// cluster values map and only replace values in said map if it has already been allowlisted in the params map.
// Once we iterate through all the cluster values we can then safely merge the `tmp` map into the main params map.
tmp := map[string]interface{}{}
tmp := map[string]any{}
for key, value := range values {
result, err := replaceTemplatedString(value, params, useGoTemplate, goTemplateOptions)
@@ -22,7 +22,7 @@ func appendTemplatedValues(values map[string]string, params map[string]interface
}
tmp["values"].(map[string]string)[key] = result
} else {
tmp[fmt.Sprintf("values.%s", key)] = result
tmp["values."+key] = result
}
}
@@ -33,7 +33,7 @@ func appendTemplatedValues(values map[string]string, params map[string]interface
return nil
}
func replaceTemplatedString(value string, params map[string]interface{}, useGoTemplate bool, goTemplateOptions []string) (string, error) {
func replaceTemplatedString(value string, params map[string]any, useGoTemplate bool, goTemplateOptions []string) (string, error) {
replacedTmplStr, err := render.Replace(value, params, useGoTemplate, goTemplateOptions)
if err != nil {
return "", fmt.Errorf("failed to replace templated string with rendered values: %w", err)

View File

@@ -11,18 +11,18 @@ func TestValueInterpolation(t *testing.T) {
testCases := []struct {
name string
values map[string]string
params map[string]interface{}
expected map[string]interface{}
params map[string]any
expected map[string]any
}{
{
name: "Simple interpolation",
values: map[string]string{
"hello": "{{ world }}",
},
params: map[string]interface{}{
params: map[string]any{
"world": "world!",
},
expected: map[string]interface{}{
expected: map[string]any{
"world": "world!",
"values.hello": "world!",
},
@@ -32,8 +32,8 @@ func TestValueInterpolation(t *testing.T) {
values: map[string]string{
"non-existent": "{{ non-existent }}",
},
params: map[string]interface{}{},
expected: map[string]interface{}{
params: map[string]any{},
expected: map[string]any{
"values.non-existent": "{{ non-existent }}",
},
},
@@ -44,8 +44,8 @@ func TestValueInterpolation(t *testing.T) {
"lol2": "{{values.lol1}}{{values.lol1}}",
"lol3": "{{values.lol2}}{{values.lol2}}{{values.lol2}}",
},
params: map[string]interface{}{},
expected: map[string]interface{}{
params: map[string]any{},
expected: map[string]any{
"values.lol1": "lol",
"values.lol2": "{{values.lol1}}{{values.lol1}}",
"values.lol3": "{{values.lol2}}{{values.lol2}}{{values.lol2}}",
@@ -66,18 +66,18 @@ func TestValueInterpolationWithGoTemplating(t *testing.T) {
testCases := []struct {
name string
values map[string]string
params map[string]interface{}
expected map[string]interface{}
params map[string]any
expected map[string]any
}{
{
name: "Simple interpolation",
values: map[string]string{
"hello": "{{ .world }}",
},
params: map[string]interface{}{
params: map[string]any{
"world": "world!",
},
expected: map[string]interface{}{
expected: map[string]any{
"world": "world!",
"values": map[string]string{
"hello": "world!",
@@ -89,8 +89,8 @@ func TestValueInterpolationWithGoTemplating(t *testing.T) {
values: map[string]string{
"non_existent": "{{ default \"bar\" .non_existent }}",
},
params: map[string]interface{}{},
expected: map[string]interface{}{
params: map[string]any{},
expected: map[string]any{
"values": map[string]string{
"non_existent": "bar",
},
@@ -103,8 +103,8 @@ func TestValueInterpolationWithGoTemplating(t *testing.T) {
"lol2": "{{.values.lol1}}{{.values.lol1}}",
"lol3": "{{.values.lol2}}{{.values.lol2}}{{.values.lol2}}",
},
params: map[string]interface{}{},
expected: map[string]interface{}{
params: map[string]any{},
expected: map[string]any{
"values": map[string]string{
"lol1": "lol",
"lol2": "<no value><no value>",

View File

@@ -2,11 +2,10 @@ package metrics
import (
"github.com/prometheus/client_golang/prometheus"
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"
)
// Fake implementation for testing
func NewFakeAppsetMetrics(client ctrlclient.WithWatch) *ApplicationsetMetrics {
func NewFakeAppsetMetrics() *ApplicationsetMetrics {
reconcileHistogram := prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Name: "argocd_appset_reconcile",

View File

@@ -7,9 +7,10 @@ import (
"k8s.io/apimachinery/pkg/labels"
"sigs.k8s.io/controller-runtime/pkg/metrics"
argoappv1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
applisters "github.com/argoproj/argo-cd/v2/pkg/client/listers/application/v1alpha1"
metricsutil "github.com/argoproj/argo-cd/v2/util/metrics"
argoappv1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
applisters "github.com/argoproj/argo-cd/v3/pkg/client/listers/application/v1alpha1"
metricsutil "github.com/argoproj/argo-cd/v3/util/metrics"
"github.com/argoproj/argo-cd/v3/util/metrics/kubectl"
)
var (
@@ -57,6 +58,10 @@ func NewApplicationsetMetrics(appsetLister applisters.ApplicationSetLister, apps
metrics.Registry.MustRegister(reconcileHistogram)
metrics.Registry.MustRegister(appsetCollector)
kubectlMetricsServer := kubectl.NewKubectlMetrics()
kubectlMetricsServer.RegisterWithClientGo()
kubectl.RegisterWithPrometheus(metrics.Registry)
return ApplicationsetMetrics{
reconcileHistogram: reconcileHistogram,
}

View File

@@ -7,23 +7,19 @@ import (
"testing"
"time"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
argoappv1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"k8s.io/apimachinery/pkg/runtime"
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"
fake "sigs.k8s.io/controller-runtime/pkg/client/fake"
prometheus "github.com/prometheus/client_golang/prometheus"
metricsutil "github.com/argoproj/argo-cd/v2/util/metrics"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/metrics"
"sigs.k8s.io/yaml"
"github.com/argoproj/argo-cd/v3/applicationset/utils"
argoappv1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
metricsutil "github.com/argoproj/argo-cd/v3/util/metrics"
)
var (

View File

@@ -5,9 +5,9 @@ import (
"net/http"
"github.com/bradleyfalzon/ghinstallation/v2"
"github.com/google/go-github/v63/github"
"github.com/google/go-github/v66/github"
"github.com/argoproj/argo-cd/v2/applicationset/services/github_app_auth"
"github.com/argoproj/argo-cd/v3/applicationset/services/github_app_auth"
)
// Client builds a github client for the given app authentication.

View File

@@ -65,7 +65,7 @@ func newClient(baseURL string, options ...ClientOptionFunc) (*Client, error) {
return c, nil
}
func (c *Client) NewRequest(method, path string, body interface{}, options []ClientOptionFunc) (*http.Request, error) {
func (c *Client) NewRequestWithContext(ctx context.Context, method, path string, body any) (*http.Request, error) {
// Make sure the given URL end with a slash
if !strings.HasSuffix(c.baseURL, "/") {
c.baseURL += "/"
@@ -82,7 +82,7 @@ func (c *Client) NewRequest(method, path string, body interface{}, options []Cli
}
}
req, err := http.NewRequest(method, c.baseURL+path, buf)
req, err := http.NewRequestWithContext(ctx, method, c.baseURL+path, buf)
if err != nil {
return nil, err
}
@@ -102,7 +102,7 @@ func (c *Client) NewRequest(method, path string, body interface{}, options []Cli
return req, nil
}
func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error) {
func (c *Client) Do(req *http.Request, v any) (*http.Response, error) {
resp, err := c.client.Do(req)
if err != nil {
return nil, err
@@ -143,7 +143,7 @@ func CheckResponse(resp *http.Response) error {
return fmt.Errorf("API error with status code %d: %w", resp.StatusCode, err)
}
var raw map[string]interface{}
var raw map[string]any
if err := json.Unmarshal(data, &raw); err != nil {
return fmt.Errorf("API error with status code %d: %s", resp.StatusCode, string(data))
}

View File

@@ -2,7 +2,7 @@ package http
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"net/http"
@@ -14,7 +14,7 @@ import (
)
func TestClient(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
_, err := w.Write([]byte("Hello, World!"))
if err != nil {
@@ -29,15 +29,13 @@ func TestClient(t *testing.T) {
}
func TestClientDo(t *testing.T) {
ctx := context.Background()
for _, c := range []struct {
name string
params map[string]string
content []byte
fakeServer *httptest.Server
clientOptionFns []ClientOptionFunc
expected []map[string]interface{}
expected []map[string]any
expectedCode int
expectedError error
}{
@@ -47,7 +45,7 @@ func TestClientDo(t *testing.T) {
"pkey1": "val1",
"pkey2": "val2",
},
fakeServer: httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fakeServer: httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
_, err := w.Write([]byte(`[{
"key1": "val1",
@@ -64,12 +62,12 @@ func TestClientDo(t *testing.T) {
}
})),
clientOptionFns: nil,
expected: []map[string]interface{}{
expected: []map[string]any{
{
"key1": "val1",
"key2": map[string]interface{}{
"key2": map[string]any{
"key2_1": "val2_1",
"key2_2": map[string]interface{}{
"key2_2": map[string]any{
"key2_2_1": "val2_2_1",
},
},
@@ -107,9 +105,9 @@ func TestClientDo(t *testing.T) {
}
})),
clientOptionFns: nil,
expected: []map[string]interface{}(nil),
expected: []map[string]any(nil),
expectedCode: http.StatusUnauthorized,
expectedError: fmt.Errorf("API error with status code 401: "),
expectedError: errors.New("API error with status code 401: "),
},
} {
cc := c
@@ -119,12 +117,12 @@ func TestClientDo(t *testing.T) {
client, err := NewClient(cc.fakeServer.URL, cc.clientOptionFns...)
require.NoError(t, err, "NewClient returned unexpected error")
req, err := client.NewRequest("POST", "", cc.params, nil)
req, err := client.NewRequestWithContext(t.Context(), http.MethodPost, "", cc.params)
require.NoError(t, err, "NewRequest returned unexpected error")
var data []map[string]interface{}
var data []map[string]any
resp, err := client.Do(ctx, req, &data)
resp, err := client.Do(req, &data)
if cc.expectedError != nil {
assert.EqualError(t, err, cc.expectedError.Error())

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
// Code generated by mockery v2.52.4. DO NOT EDIT.
package mocks
@@ -13,9 +13,9 @@ type Repos struct {
mock.Mock
}
// GetDirectories provides a mock function with given fields: ctx, repoURL, revision, noRevisionCache, verifyCommit
func (_m *Repos) GetDirectories(ctx context.Context, repoURL string, revision string, noRevisionCache bool, verifyCommit bool) ([]string, error) {
ret := _m.Called(ctx, repoURL, revision, noRevisionCache, verifyCommit)
// GetDirectories provides a mock function with given fields: ctx, repoURL, revision, project, noRevisionCache, verifyCommit
func (_m *Repos) GetDirectories(ctx context.Context, repoURL string, revision string, project string, noRevisionCache bool, verifyCommit bool) ([]string, error) {
ret := _m.Called(ctx, repoURL, revision, project, noRevisionCache, verifyCommit)
if len(ret) == 0 {
panic("no return value specified for GetDirectories")
@@ -23,19 +23,19 @@ func (_m *Repos) GetDirectories(ctx context.Context, repoURL string, revision st
var r0 []string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string, bool, bool) ([]string, error)); ok {
return rf(ctx, repoURL, revision, noRevisionCache, verifyCommit)
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, bool, bool) ([]string, error)); ok {
return rf(ctx, repoURL, revision, project, noRevisionCache, verifyCommit)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string, bool, bool) []string); ok {
r0 = rf(ctx, repoURL, revision, noRevisionCache, verifyCommit)
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, bool, bool) []string); ok {
r0 = rf(ctx, repoURL, revision, project, noRevisionCache, verifyCommit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, string, bool, bool) error); ok {
r1 = rf(ctx, repoURL, revision, noRevisionCache, verifyCommit)
if rf, ok := ret.Get(1).(func(context.Context, string, string, string, bool, bool) error); ok {
r1 = rf(ctx, repoURL, revision, project, noRevisionCache, verifyCommit)
} else {
r1 = ret.Error(1)
}
@@ -43,9 +43,9 @@ func (_m *Repos) GetDirectories(ctx context.Context, repoURL string, revision st
return r0, r1
}
// GetFiles provides a mock function with given fields: ctx, repoURL, revision, pattern, noRevisionCache, verifyCommit
func (_m *Repos) GetFiles(ctx context.Context, repoURL string, revision string, pattern string, noRevisionCache bool, verifyCommit bool) (map[string][]byte, error) {
ret := _m.Called(ctx, repoURL, revision, pattern, noRevisionCache, verifyCommit)
// GetFiles provides a mock function with given fields: ctx, repoURL, revision, project, pattern, noRevisionCache, verifyCommit
func (_m *Repos) GetFiles(ctx context.Context, repoURL string, revision string, project string, pattern string, noRevisionCache bool, verifyCommit bool) (map[string][]byte, error) {
ret := _m.Called(ctx, repoURL, revision, project, pattern, noRevisionCache, verifyCommit)
if len(ret) == 0 {
panic("no return value specified for GetFiles")
@@ -53,19 +53,19 @@ func (_m *Repos) GetFiles(ctx context.Context, repoURL string, revision string,
var r0 map[string][]byte
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, bool, bool) (map[string][]byte, error)); ok {
return rf(ctx, repoURL, revision, pattern, noRevisionCache, verifyCommit)
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, bool, bool) (map[string][]byte, error)); ok {
return rf(ctx, repoURL, revision, project, pattern, noRevisionCache, verifyCommit)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, bool, bool) map[string][]byte); ok {
r0 = rf(ctx, repoURL, revision, pattern, noRevisionCache, verifyCommit)
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, bool, bool) map[string][]byte); ok {
r0 = rf(ctx, repoURL, revision, project, pattern, noRevisionCache, verifyCommit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[string][]byte)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, string, string, bool, bool) error); ok {
r1 = rf(ctx, repoURL, revision, pattern, noRevisionCache, verifyCommit)
if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string, bool, bool) error); ok {
r1 = rf(ctx, repoURL, revision, project, pattern, noRevisionCache, verifyCommit)
} else {
r1 = ret.Error(1)
}

View File

@@ -5,8 +5,8 @@ import (
"fmt"
"net/http"
internalhttp "github.com/argoproj/argo-cd/v2/applicationset/services/internal/http"
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
internalhttp "github.com/argoproj/argo-cd/v3/applicationset/services/internal/http"
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
// ServiceRequest is the request object sent to the plugin service.
@@ -20,7 +20,7 @@ type ServiceRequest struct {
type Output struct {
// Parameters is the list of parameter sets returned by the plugin.
Parameters []map[string]interface{} `json:"parameters"`
Parameters []map[string]any `json:"parameters"`
}
// ServiceResponse is the response object returned by the plugin service.
@@ -34,7 +34,7 @@ type Service struct {
appSetName string
}
func NewPluginService(ctx context.Context, appSetName string, baseURL string, token string, requestTimeout int) (*Service, error) {
func NewPluginService(appSetName string, baseURL string, token string, requestTimeout int) (*Service, error) {
var clientOptionFns []internalhttp.ClientOptionFunc
clientOptionFns = append(clientOptionFns, internalhttp.WithToken(token))
@@ -55,14 +55,14 @@ func NewPluginService(ctx context.Context, appSetName string, baseURL string, to
}
func (p *Service) List(ctx context.Context, parameters v1alpha1.PluginParameters) (*ServiceResponse, error) {
req, err := p.client.NewRequest(http.MethodPost, "api/v1/getparams.execute", ServiceRequest{ApplicationSetName: p.appSetName, Input: v1alpha1.PluginInput{Parameters: parameters}}, nil)
req, err := p.client.NewRequestWithContext(ctx, http.MethodPost, "api/v1/getparams.execute", ServiceRequest{ApplicationSetName: p.appSetName, Input: v1alpha1.PluginInput{Parameters: parameters}})
if err != nil {
return nil, fmt.Errorf("NewRequest returned unexpected error: %w", err)
}
var data ServiceResponse
_, err = p.client.Do(ctx, req, &data)
_, err = p.client.Do(req, &data)
if err != nil {
return nil, fmt.Errorf("error get api '%s': %w", p.appSetName, err)
}

View File

@@ -1,7 +1,6 @@
package plugin
import (
"context"
"encoding/json"
"fmt"
"net/http"
@@ -31,10 +30,10 @@ func TestPlugin(t *testing.T) {
ts := httptest.NewServer(handler)
defer ts.Close()
client, err := NewPluginService(context.Background(), "plugin-test", ts.URL, token, 0)
client, err := NewPluginService("plugin-test", ts.URL, token, 0)
require.NoError(t, err)
data, err := client.List(context.Background(), nil)
data, err := client.List(t.Context(), nil)
require.NoError(t, err)
var expectedData ServiceResponse

View File

@@ -1,10 +1,9 @@
package plugin
import (
"fmt"
"strings"
"github.com/argoproj/argo-cd/v2/common"
"github.com/argoproj/argo-cd/v3/common"
)
// ParseSecretKey retrieves secret appSetName if different from common ArgoCDSecretName.
@@ -12,7 +11,7 @@ func ParseSecretKey(key string) (secretName string, tokenKey string) {
if strings.Contains(key, ":") {
parts := strings.Split(key, ":")
secretName = parts[0][1:]
tokenKey = fmt.Sprintf("$%s", parts[1])
tokenKey = "$" + parts[1]
} else {
secretName = common.ArgoCDSecretName
tokenKey = key

View File

@@ -6,8 +6,8 @@ import (
"strings"
"github.com/microsoft/azure-devops-go-api/azuredevops"
core "github.com/microsoft/azure-devops-go-api/azuredevops/core"
git "github.com/microsoft/azure-devops-go-api/azuredevops/git"
"github.com/microsoft/azure-devops-go-api/azuredevops/core"
"github.com/microsoft/azure-devops-go-api/azuredevops/git"
)
const AZURE_DEVOPS_DEFAULT_URL = "https://dev.azure.com"
@@ -41,14 +41,14 @@ var (
_ AzureDevOpsClientFactory = &devopsFactoryImpl{}
)
func NewAzureDevOpsService(ctx context.Context, token, url, organization, project, repo string, labels []string) (PullRequestService, error) {
organizationUrl := buildURL(url, organization)
func NewAzureDevOpsService(token, url, organization, project, repo string, labels []string) (PullRequestService, error) {
organizationURL := buildURL(url, organization)
var connection *azuredevops.Connection
if token == "" {
connection = azuredevops.NewAnonymousConnection(organizationUrl)
connection = azuredevops.NewAnonymousConnection(organizationURL)
} else {
connection = azuredevops.NewPatConnection(organizationUrl, token)
connection = azuredevops.NewPatConnection(organizationURL, token)
}
return &AzureDevOpsService{

View File

@@ -7,12 +7,12 @@ import (
"github.com/microsoft/azure-devops-go-api/azuredevops/webapi"
"github.com/microsoft/azure-devops-go-api/azuredevops/core"
git "github.com/microsoft/azure-devops-go-api/azuredevops/git"
"github.com/microsoft/azure-devops-go-api/azuredevops/git"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
azureMock "github.com/argoproj/argo-cd/v2/applicationset/services/scm_provider/azure_devops/git/mocks"
azureMock "github.com/argoproj/argo-cd/v3/applicationset/services/scm_provider/azure_devops/git/mocks"
)
func createBoolPtr(x bool) *bool {
@@ -61,20 +61,20 @@ func (m *AzureClientFactoryMock) GetClient(ctx context.Context) (git.Client, err
func TestListPullRequest(t *testing.T) {
teamProject := "myorg_project"
repoName := "myorg_project_repo"
pr_id := 123
pr_title := "feat(123)"
pr_head_sha := "cd4973d9d14a08ffe6b641a89a68891d6aac8056"
ctx := context.Background()
prID := 123
prTitle := "feat(123)"
prHeadSha := "cd4973d9d14a08ffe6b641a89a68891d6aac8056"
ctx := t.Context()
uniqueName := "testName"
pullRequestMock := []git.GitPullRequest{
{
PullRequestId: createIntPtr(pr_id),
Title: createStringPtr(pr_title),
PullRequestId: createIntPtr(prID),
Title: createStringPtr(prTitle),
SourceRefName: createStringPtr("refs/heads/feature-branch"),
TargetRefName: createStringPtr("refs/heads/main"),
LastMergeSourceCommit: &git.GitCommitRef{
CommitId: createStringPtr(pr_head_sha),
CommitId: createStringPtr(prHeadSha),
},
Labels: &[]core.WebApiTagDefinition{},
Repository: &git.GitRepository{
@@ -108,9 +108,9 @@ func TestListPullRequest(t *testing.T) {
assert.Len(t, list, 1)
assert.Equal(t, "feature-branch", list[0].Branch)
assert.Equal(t, "main", list[0].TargetBranch)
assert.Equal(t, pr_head_sha, list[0].HeadSHA)
assert.Equal(t, prHeadSha, list[0].HeadSHA)
assert.Equal(t, "feat(123)", list[0].Title)
assert.Equal(t, pr_id, list[0].Number)
assert.Equal(t, prID, list[0].Number)
assert.Equal(t, uniqueName, list[0].Author)
}

View File

@@ -3,6 +3,7 @@ package pull_request
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/url"
@@ -51,7 +52,7 @@ type PullRequestResponse struct {
var _ PullRequestService = (*BitbucketCloudService)(nil)
func parseUrl(uri string) (*url.URL, error) {
func parseURL(uri string) (*url.URL, error) {
if uri == "" {
uri = "https://api.bitbucket.org/2.0"
}
@@ -64,10 +65,10 @@ func parseUrl(uri string) (*url.URL, error) {
return url, nil
}
func NewBitbucketCloudServiceBasicAuth(baseUrl, username, password, owner, repositorySlug string) (PullRequestService, error) {
url, err := parseUrl(baseUrl)
func NewBitbucketCloudServiceBasicAuth(baseURL, username, password, owner, repositorySlug string) (PullRequestService, error) {
url, err := parseURL(baseURL)
if err != nil {
return nil, fmt.Errorf("error parsing base url of %s for %s/%s: %w", baseUrl, owner, repositorySlug, err)
return nil, fmt.Errorf("error parsing base url of %s for %s/%s: %w", baseURL, owner, repositorySlug, err)
}
bitbucketClient := bitbucket.NewBasicAuth(username, password)
@@ -80,10 +81,10 @@ func NewBitbucketCloudServiceBasicAuth(baseUrl, username, password, owner, repos
}, nil
}
func NewBitbucketCloudServiceBearerToken(baseUrl, bearerToken, owner, repositorySlug string) (PullRequestService, error) {
url, err := parseUrl(baseUrl)
func NewBitbucketCloudServiceBearerToken(baseURL, bearerToken, owner, repositorySlug string) (PullRequestService, error) {
url, err := parseURL(baseURL)
if err != nil {
return nil, fmt.Errorf("error parsing base url of %s for %s/%s: %w", baseUrl, owner, repositorySlug, err)
return nil, fmt.Errorf("error parsing base url of %s for %s/%s: %w", baseURL, owner, repositorySlug, err)
}
bitbucketClient := bitbucket.NewOAuthbearerToken(bearerToken)
@@ -96,9 +97,9 @@ func NewBitbucketCloudServiceBearerToken(baseUrl, bearerToken, owner, repository
}, nil
}
func NewBitbucketCloudServiceNoAuth(baseUrl, owner, repositorySlug string) (PullRequestService, error) {
func NewBitbucketCloudServiceNoAuth(baseURL, owner, repositorySlug string) (PullRequestService, error) {
// There is currently no method to explicitly not require auth
return NewBitbucketCloudServiceBearerToken(baseUrl, "", owner, repositorySlug)
return NewBitbucketCloudServiceBearerToken(baseURL, "", owner, repositorySlug)
}
func (b *BitbucketCloudService) List(_ context.Context) ([]*PullRequest, error) {
@@ -112,14 +113,14 @@ func (b *BitbucketCloudService) List(_ context.Context) ([]*PullRequest, error)
return nil, fmt.Errorf("error listing pull requests for %s/%s: %w", b.owner, b.repositorySlug, err)
}
resp, ok := response.(map[string]interface{})
resp, ok := response.(map[string]any)
if !ok {
return nil, fmt.Errorf("unknown type returned from bitbucket pull requests")
return nil, errors.New("unknown type returned from bitbucket pull requests")
}
repoArray, ok := resp["values"].([]interface{})
repoArray, ok := resp["values"].([]any)
if !ok {
return nil, fmt.Errorf("unknown type returned from response values")
return nil, errors.New("unknown type returned from response values")
}
jsonStr, err := json.Marshal(repoArray)

View File

@@ -1,7 +1,6 @@
package pull_request
import (
"context"
"fmt"
"io"
"net/http"
@@ -11,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func defaultHandlerCloud(t *testing.T) func(http.ResponseWriter, *http.Request) {
@@ -54,11 +53,11 @@ func defaultHandlerCloud(t *testing.T) func(http.ResponseWriter, *http.Request)
}
func TestParseUrlEmptyUrl(t *testing.T) {
url, err := parseUrl("")
bitbucketUrl, _ := url.Parse("https://api.bitbucket.org/2.0")
url, err := parseURL("")
bitbucketURL, _ := url.Parse("https://api.bitbucket.org/2.0")
require.NoError(t, err)
assert.Equal(t, bitbucketUrl, url)
assert.Equal(t, bitbucketURL, url)
}
func TestInvalidBaseUrlBasicAuthCloud(t *testing.T) {
@@ -87,7 +86,7 @@ func TestListPullRequestBearerTokenCloud(t *testing.T) {
defer ts.Close()
svc, err := NewBitbucketCloudServiceBearerToken(ts.URL, "TOKEN", "OWNER", "REPO")
require.NoError(t, err)
pullRequests, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{})
pullRequests, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{})
require.NoError(t, err)
assert.Len(t, pullRequests, 1)
assert.Equal(t, 101, pullRequests[0].Number)
@@ -105,7 +104,7 @@ func TestListPullRequestNoAuthCloud(t *testing.T) {
defer ts.Close()
svc, err := NewBitbucketCloudServiceNoAuth(ts.URL, "OWNER", "REPO")
require.NoError(t, err)
pullRequests, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{})
pullRequests, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{})
require.NoError(t, err)
assert.Len(t, pullRequests, 1)
assert.Equal(t, 101, pullRequests[0].Number)
@@ -123,7 +122,7 @@ func TestListPullRequestBasicAuthCloud(t *testing.T) {
defer ts.Close()
svc, err := NewBitbucketCloudServiceBasicAuth(ts.URL, "user", "password", "OWNER", "REPO")
require.NoError(t, err)
pullRequests, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{})
pullRequests, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{})
require.NoError(t, err)
assert.Len(t, pullRequests, 1)
assert.Equal(t, 101, pullRequests[0].Number)
@@ -214,7 +213,7 @@ func TestListPullRequestPaginationCloud(t *testing.T) {
defer ts.Close()
svc, err := NewBitbucketCloudServiceNoAuth(ts.URL, "OWNER", "REPO")
require.NoError(t, err)
pullRequests, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{})
pullRequests, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{})
require.NoError(t, err)
assert.Len(t, pullRequests, 3)
assert.Equal(t, PullRequest{
@@ -241,12 +240,12 @@ func TestListPullRequestPaginationCloud(t *testing.T) {
}
func TestListResponseErrorCloud(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
}))
defer ts.Close()
svc, _ := NewBitbucketCloudServiceNoAuth(ts.URL, "OWNER", "REPO")
_, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{})
_, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{})
require.Error(t, err)
}
@@ -270,7 +269,7 @@ func TestListResponseMalformedCloud(t *testing.T) {
}))
defer ts.Close()
svc, _ := NewBitbucketCloudServiceNoAuth(ts.URL, "OWNER", "REPO")
_, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{})
_, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{})
require.Error(t, err)
}
@@ -294,7 +293,7 @@ func TestListResponseMalformedValuesCloud(t *testing.T) {
}))
defer ts.Close()
svc, _ := NewBitbucketCloudServiceNoAuth(ts.URL, "OWNER", "REPO")
_, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{})
_, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{})
require.Error(t, err)
}
@@ -319,7 +318,7 @@ func TestListResponseEmptyCloud(t *testing.T) {
defer ts.Close()
svc, err := NewBitbucketCloudServiceNoAuth(ts.URL, "OWNER", "REPO")
require.NoError(t, err)
pullRequests, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{})
pullRequests, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{})
require.NoError(t, err)
assert.Empty(t, pullRequests)
}
@@ -406,7 +405,7 @@ func TestListPullRequestBranchMatchCloud(t *testing.T) {
regexp := `feature-1[\d]{2}`
svc, err := NewBitbucketCloudServiceNoAuth(ts.URL, "OWNER", "REPO")
require.NoError(t, err)
pullRequests, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{
pullRequests, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{
{
BranchMatch: &regexp,
},
@@ -431,7 +430,7 @@ func TestListPullRequestBranchMatchCloud(t *testing.T) {
regexp = `.*2$`
svc, err = NewBitbucketCloudServiceNoAuth(ts.URL, "OWNER", "REPO")
require.NoError(t, err)
pullRequests, err = ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{
pullRequests, err = ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{
{
BranchMatch: &regexp,
},
@@ -449,7 +448,7 @@ func TestListPullRequestBranchMatchCloud(t *testing.T) {
regexp = `[\d{2}`
svc, err = NewBitbucketCloudServiceNoAuth(ts.URL, "OWNER", "REPO")
require.NoError(t, err)
_, err = ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{
_, err = ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{
{
BranchMatch: &regexp,
},

View File

@@ -3,12 +3,11 @@ package pull_request
import (
"context"
"fmt"
"net/http"
bitbucketv1 "github.com/gfleury/go-bitbucket-v1"
log "github.com/sirupsen/logrus"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
"github.com/argoproj/argo-cd/v3/applicationset/services"
)
type BitbucketService struct {
@@ -49,22 +48,17 @@ func NewBitbucketServiceNoAuth(ctx context.Context, url, projectKey, repositoryS
}
func newBitbucketService(ctx context.Context, bitbucketConfig *bitbucketv1.Configuration, projectKey, repositorySlug string, scmRootCAPath string, insecure bool, caCerts []byte) (PullRequestService, error) {
bitbucketConfig.BasePath = utils.NormalizeBitbucketBasePath(bitbucketConfig.BasePath)
tlsConfig := utils.GetTlsConfig(scmRootCAPath, insecure, caCerts)
bitbucketConfig.HTTPClient = &http.Client{Transport: &http.Transport{
TLSClientConfig: tlsConfig,
}}
bitbucketClient := bitbucketv1.NewAPIClient(ctx, bitbucketConfig)
bbClient := services.SetupBitbucketClient(ctx, bitbucketConfig, scmRootCAPath, insecure, caCerts)
return &BitbucketService{
client: bitbucketClient,
client: bbClient,
projectKey: projectKey,
repositorySlug: repositorySlug,
}, nil
}
func (b *BitbucketService) List(_ context.Context) ([]*PullRequest, error) {
paged := map[string]interface{}{
paged := map[string]any{
"limit": 100,
}

View File

@@ -1,7 +1,6 @@
package pull_request
import (
"context"
"crypto/x509"
"encoding/pem"
"io"
@@ -12,7 +11,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func defaultHandler(t *testing.T) func(http.ResponseWriter, *http.Request) {
@@ -64,9 +63,9 @@ func TestListPullRequestNoAuth(t *testing.T) {
defaultHandler(t)(w, r)
}))
defer ts.Close()
svc, err := NewBitbucketServiceNoAuth(context.Background(), ts.URL, "PROJECT", "REPO", "", false, nil)
svc, err := NewBitbucketServiceNoAuth(t.Context(), ts.URL, "PROJECT", "REPO", "", false, nil)
require.NoError(t, err)
pullRequests, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{})
pullRequests, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{})
require.NoError(t, err)
assert.Len(t, pullRequests, 1)
assert.Equal(t, 101, pullRequests[0].Number)
@@ -165,9 +164,9 @@ func TestListPullRequestPagination(t *testing.T) {
}
}))
defer ts.Close()
svc, err := NewBitbucketServiceNoAuth(context.Background(), ts.URL, "PROJECT", "REPO", "", false, nil)
svc, err := NewBitbucketServiceNoAuth(t.Context(), ts.URL, "PROJECT", "REPO", "", false, nil)
require.NoError(t, err)
pullRequests, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{})
pullRequests, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{})
require.NoError(t, err)
assert.Len(t, pullRequests, 3)
assert.Equal(t, PullRequest{
@@ -207,9 +206,9 @@ func TestListPullRequestBasicAuth(t *testing.T) {
defaultHandler(t)(w, r)
}))
defer ts.Close()
svc, err := NewBitbucketServiceBasicAuth(context.Background(), "user", "password", ts.URL, "PROJECT", "REPO", "", false, nil)
svc, err := NewBitbucketServiceBasicAuth(t.Context(), "user", "password", ts.URL, "PROJECT", "REPO", "", false, nil)
require.NoError(t, err)
pullRequests, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{})
pullRequests, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{})
require.NoError(t, err)
assert.Len(t, pullRequests, 1)
assert.Equal(t, 101, pullRequests[0].Number)
@@ -224,9 +223,9 @@ func TestListPullRequestBearerAuth(t *testing.T) {
defaultHandler(t)(w, r)
}))
defer ts.Close()
svc, err := NewBitbucketServiceBearerToken(context.Background(), "tolkien", ts.URL, "PROJECT", "REPO", "", false, nil)
svc, err := NewBitbucketServiceBearerToken(t.Context(), "tolkien", ts.URL, "PROJECT", "REPO", "", false, nil)
require.NoError(t, err)
pullRequests, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{})
pullRequests, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{})
require.NoError(t, err)
assert.Len(t, pullRequests, 1)
assert.Equal(t, 101, pullRequests[0].Number)
@@ -277,7 +276,7 @@ func TestListPullRequestTLS(t *testing.T) {
defer ts.Close()
var certs []byte
if test.passCerts == true {
if test.passCerts {
for _, cert := range ts.TLS.Certificates {
for _, c := range cert.Certificate {
parsedCert, err := x509.ParseCertificate(c)
@@ -290,9 +289,9 @@ func TestListPullRequestTLS(t *testing.T) {
}
}
svc, err := NewBitbucketServiceBasicAuth(context.Background(), "user", "password", ts.URL, "PROJECT", "REPO", "", test.tlsInsecure, certs)
svc, err := NewBitbucketServiceBasicAuth(t.Context(), "user", "password", ts.URL, "PROJECT", "REPO", "", test.tlsInsecure, certs)
require.NoError(t, err)
_, err = ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{})
_, err = ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{})
if test.requireErr {
require.Error(t, err)
} else {
@@ -303,12 +302,12 @@ func TestListPullRequestTLS(t *testing.T) {
}
func TestListResponseError(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
}))
defer ts.Close()
svc, _ := NewBitbucketServiceNoAuth(context.Background(), ts.URL, "PROJECT", "REPO", "", false, nil)
_, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{})
svc, _ := NewBitbucketServiceNoAuth(t.Context(), ts.URL, "PROJECT", "REPO", "", false, nil)
_, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{})
require.Error(t, err)
}
@@ -332,8 +331,8 @@ func TestListResponseMalformed(t *testing.T) {
}
}))
defer ts.Close()
svc, _ := NewBitbucketServiceNoAuth(context.Background(), ts.URL, "PROJECT", "REPO", "", false, nil)
_, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{})
svc, _ := NewBitbucketServiceNoAuth(t.Context(), ts.URL, "PROJECT", "REPO", "", false, nil)
_, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{})
require.Error(t, err)
}
@@ -357,9 +356,9 @@ func TestListResponseEmpty(t *testing.T) {
}
}))
defer ts.Close()
svc, err := NewBitbucketServiceNoAuth(context.Background(), ts.URL, "PROJECT", "REPO", "", false, nil)
svc, err := NewBitbucketServiceNoAuth(t.Context(), ts.URL, "PROJECT", "REPO", "", false, nil)
require.NoError(t, err)
pullRequests, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{})
pullRequests, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{})
require.NoError(t, err)
assert.Empty(t, pullRequests)
}
@@ -453,9 +452,9 @@ func TestListPullRequestBranchMatch(t *testing.T) {
}))
defer ts.Close()
regexp := `feature-1[\d]{2}`
svc, err := NewBitbucketServiceNoAuth(context.Background(), ts.URL, "PROJECT", "REPO", "", false, nil)
svc, err := NewBitbucketServiceNoAuth(t.Context(), ts.URL, "PROJECT", "REPO", "", false, nil)
require.NoError(t, err)
pullRequests, err := ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{
pullRequests, err := ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{
{
BranchMatch: &regexp,
},
@@ -482,9 +481,9 @@ func TestListPullRequestBranchMatch(t *testing.T) {
}, *pullRequests[1])
regexp = `.*2$`
svc, err = NewBitbucketServiceNoAuth(context.Background(), ts.URL, "PROJECT", "REPO", "", false, nil)
svc, err = NewBitbucketServiceNoAuth(t.Context(), ts.URL, "PROJECT", "REPO", "", false, nil)
require.NoError(t, err)
pullRequests, err = ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{
pullRequests, err = ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{
{
BranchMatch: &regexp,
},
@@ -502,9 +501,9 @@ func TestListPullRequestBranchMatch(t *testing.T) {
}, *pullRequests[0])
regexp = `[\d{2}`
svc, err = NewBitbucketServiceNoAuth(context.Background(), ts.URL, "PROJECT", "REPO", "", false, nil)
svc, err = NewBitbucketServiceNoAuth(t.Context(), ts.URL, "PROJECT", "REPO", "", false, nil)
require.NoError(t, err)
_, err = ListPullRequests(context.Background(), svc, []v1alpha1.PullRequestGeneratorFilter{
_, err = ListPullRequests(t.Context(), svc, []v1alpha1.PullRequestGeneratorFilter{
{
BranchMatch: &regexp,
},

View File

@@ -18,6 +18,6 @@ func NewFakeService(_ context.Context, listPullReuests []*PullRequest, listError
}, nil
}
func (g *FakeService) List(ctx context.Context) ([]*PullRequest, error) {
func (g *FakeService) List(_ context.Context) ([]*PullRequest, error) {
return g.listPullReuests, g.listError
}

View File

@@ -18,7 +18,7 @@ type GiteaService struct {
var _ PullRequestService = (*GiteaService)(nil)
func NewGiteaService(ctx context.Context, token, url, owner, repo string, insecure bool) (PullRequestService, error) {
func NewGiteaService(token, url, owner, repo string, insecure bool) (PullRequestService, error) {
if token == "" {
token = os.Getenv("GITEA_TOKEN")
}
@@ -49,6 +49,7 @@ func (g *GiteaService) List(ctx context.Context) ([]*PullRequest, error) {
opts := gitea.ListPullRequestsOptions{
State: gitea.StateOpen,
}
g.client.SetContext(ctx)
prs, _, err := g.client.ListRepoPullRequests(g.owner, g.repo, opts)
if err != nil {
return nil, err

View File

@@ -1,7 +1,6 @@
package pull_request
import (
"context"
"fmt"
"io"
"net/http"
@@ -251,9 +250,9 @@ func TestGiteaList(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
giteaMockHandler(t)(w, r)
}))
host, err := NewGiteaService(context.Background(), "", ts.URL, "test-argocd", "pr-test", false)
host, err := NewGiteaService("", ts.URL, "test-argocd", "pr-test", false)
require.NoError(t, err)
prs, err := host.List(context.Background())
prs, err := host.List(t.Context())
require.NoError(t, err)
assert.Len(t, prs, 1)
assert.Equal(t, 1, prs[0].Number)

View File

@@ -3,10 +3,10 @@ package pull_request
import (
"context"
"fmt"
"net/http"
"os"
"github.com/google/go-github/v63/github"
"golang.org/x/oauth2"
"github.com/google/go-github/v66/github"
)
type GithubService struct {
@@ -18,24 +18,26 @@ type GithubService struct {
var _ PullRequestService = (*GithubService)(nil)
func NewGithubService(ctx context.Context, token, url, owner, repo string, labels []string) (PullRequestService, error) {
var ts oauth2.TokenSource
func NewGithubService(token, url, owner, repo string, labels []string) (PullRequestService, error) {
// Undocumented environment variable to set a default token, to be used in testing to dodge anonymous rate limits.
if token == "" {
token = os.Getenv("GITHUB_TOKEN")
}
if token != "" {
ts = oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: token},
)
}
httpClient := oauth2.NewClient(ctx, ts)
httpClient := &http.Client{}
var client *github.Client
if url == "" {
client = github.NewClient(httpClient)
if token == "" {
client = github.NewClient(httpClient)
} else {
client = github.NewClient(httpClient).WithAuthToken(token)
}
} else {
var err error
client, err = github.NewClient(httpClient).WithEnterpriseURLs(url, url)
if token == "" {
client, err = github.NewClient(httpClient).WithEnterpriseURLs(url, url)
} else {
client, err = github.NewClient(httpClient).WithAuthToken(token).WithEnterpriseURLs(url, url)
}
if err != nil {
return nil, err
}

View File

@@ -1,8 +1,8 @@
package pull_request
import (
"github.com/argoproj/argo-cd/v2/applicationset/services/github_app_auth"
"github.com/argoproj/argo-cd/v2/applicationset/services/internal/github_app"
"github.com/argoproj/argo-cd/v3/applicationset/services/github_app_auth"
"github.com/argoproj/argo-cd/v3/applicationset/services/internal/github_app"
)
func NewGithubAppService(g github_app_auth.Authentication, url, owner, repo string, labels []string) (PullRequestService, error) {

View File

@@ -3,7 +3,7 @@ package pull_request
import (
"testing"
"github.com/google/go-github/v63/github"
"github.com/google/go-github/v66/github"
"github.com/stretchr/testify/require"
)

View File

@@ -7,9 +7,9 @@ import (
"os"
"github.com/hashicorp/go-retryablehttp"
gitlab "github.com/xanzy/go-gitlab"
gitlab "gitlab.com/gitlab-org/api/client-go"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
"github.com/argoproj/argo-cd/v3/applicationset/utils"
)
type GitLabService struct {
@@ -21,7 +21,7 @@ type GitLabService struct {
var _ PullRequestService = (*GitLabService)(nil)
func NewGitLabService(ctx context.Context, token, url, project string, labels []string, pullRequestState string, scmRootCAPath string, insecure bool, caCerts []byte) (PullRequestService, error) {
func NewGitLabService(token, url, project string, labels []string, pullRequestState string, scmRootCAPath string, insecure bool, caCerts []byte) (PullRequestService, error) {
var clientOptionFns []gitlab.ClientOptionFunc
// Set a custom Gitlab base URL if one is provided
@@ -74,7 +74,7 @@ func (g *GitLabService) List(ctx context.Context) ([]*PullRequest, error) {
pullRequests := []*PullRequest{}
for {
mrs, resp, err := g.client.MergeRequests.ListProjectMergeRequests(g.project, opts)
mrs, resp, err := g.client.MergeRequests.ListProjectMergeRequests(g.project, opts, gitlab.WithContext(ctx))
if err != nil {
return nil, fmt.Errorf("error listing merge requests for project '%s': %w", g.project, err)
}

View File

@@ -1,7 +1,6 @@
package pull_request
import (
"context"
"crypto/x509"
"encoding/pem"
"io"
@@ -35,10 +34,10 @@ func TestGitLabServiceCustomBaseURL(t *testing.T) {
writeMRListResponse(t, w)
})
svc, err := NewGitLabService(context.Background(), "", server.URL, "278964", nil, "", "", false, nil)
svc, err := NewGitLabService("", server.URL, "278964", nil, "", "", false, nil)
require.NoError(t, err)
_, err = svc.List(context.Background())
_, err = svc.List(t.Context())
require.NoError(t, err)
}
@@ -54,10 +53,10 @@ func TestGitLabServiceToken(t *testing.T) {
writeMRListResponse(t, w)
})
svc, err := NewGitLabService(context.Background(), "token-123", server.URL, "278964", nil, "", "", false, nil)
svc, err := NewGitLabService("token-123", server.URL, "278964", nil, "", "", false, nil)
require.NoError(t, err)
_, err = svc.List(context.Background())
_, err = svc.List(t.Context())
require.NoError(t, err)
}
@@ -73,10 +72,10 @@ func TestList(t *testing.T) {
writeMRListResponse(t, w)
})
svc, err := NewGitLabService(context.Background(), "", server.URL, "278964", []string{}, "", "", false, nil)
svc, err := NewGitLabService("", server.URL, "278964", []string{}, "", "", false, nil)
require.NoError(t, err)
prs, err := svc.List(context.Background())
prs, err := svc.List(t.Context())
require.NoError(t, err)
assert.Len(t, prs, 1)
assert.Equal(t, 15442, prs[0].Number)
@@ -99,10 +98,10 @@ func TestListWithLabels(t *testing.T) {
writeMRListResponse(t, w)
})
svc, err := NewGitLabService(context.Background(), "", server.URL, "278964", []string{"feature", "ready"}, "", "", false, nil)
svc, err := NewGitLabService("", server.URL, "278964", []string{"feature", "ready"}, "", "", false, nil)
require.NoError(t, err)
_, err = svc.List(context.Background())
_, err = svc.List(t.Context())
require.NoError(t, err)
}
@@ -118,10 +117,10 @@ func TestListWithState(t *testing.T) {
writeMRListResponse(t, w)
})
svc, err := NewGitLabService(context.Background(), "", server.URL, "278964", []string{}, "opened", "", false, nil)
svc, err := NewGitLabService("", server.URL, "278964", []string{}, "opened", "", false, nil)
require.NoError(t, err)
_, err = svc.List(context.Background())
_, err = svc.List(t.Context())
require.NoError(t, err)
}
@@ -161,13 +160,13 @@ func TestListWithStateTLS(t *testing.T) {
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
writeMRListResponse(t, w)
}))
defer ts.Close()
var certs []byte
if test.passCerts == true {
if test.passCerts {
for _, cert := range ts.TLS.Certificates {
for _, c := range cert.Certificate {
parsedCert, err := x509.ParseCertificate(c)
@@ -180,10 +179,10 @@ func TestListWithStateTLS(t *testing.T) {
}
}
svc, err := NewGitLabService(context.Background(), "", ts.URL, "278964", []string{}, "opened", "", test.tlsInsecure, certs)
svc, err := NewGitLabService("", ts.URL, "278964", []string{}, "opened", "", test.tlsInsecure, certs)
require.NoError(t, err)
_, err = svc.List(context.Background())
_, err = svc.List(t.Context())
if test.requireErr {
require.Error(t, err)
} else {

View File

@@ -5,7 +5,7 @@ import (
"fmt"
"regexp"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func compileFilters(filters []argoprojiov1alpha1.PullRequestGeneratorFilter) ([]*Filter, error) {

View File

@@ -1,13 +1,12 @@
package pull_request
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
argoprojiov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func strp(s string) *string {
@@ -16,7 +15,7 @@ func strp(s string) *string {
func TestFilterBranchMatchBadRegexp(t *testing.T) {
provider, _ := NewFakeService(
context.Background(),
t.Context(),
[]*PullRequest{
{
Number: 1,
@@ -34,13 +33,13 @@ func TestFilterBranchMatchBadRegexp(t *testing.T) {
BranchMatch: strp("("),
},
}
_, err := ListPullRequests(context.Background(), provider, filters)
_, err := ListPullRequests(t.Context(), provider, filters)
require.Error(t, err)
}
func TestFilterBranchMatch(t *testing.T) {
provider, _ := NewFakeService(
context.Background(),
t.Context(),
[]*PullRequest{
{
Number: 1,
@@ -82,7 +81,7 @@ func TestFilterBranchMatch(t *testing.T) {
BranchMatch: strp("w"),
},
}
pullRequests, err := ListPullRequests(context.Background(), provider, filters)
pullRequests, err := ListPullRequests(t.Context(), provider, filters)
require.NoError(t, err)
assert.Len(t, pullRequests, 1)
assert.Equal(t, "two", pullRequests[0].Branch)
@@ -90,7 +89,7 @@ func TestFilterBranchMatch(t *testing.T) {
func TestFilterTargetBranchMatch(t *testing.T) {
provider, _ := NewFakeService(
context.Background(),
t.Context(),
[]*PullRequest{
{
Number: 1,
@@ -132,7 +131,7 @@ func TestFilterTargetBranchMatch(t *testing.T) {
TargetBranchMatch: strp("1"),
},
}
pullRequests, err := ListPullRequests(context.Background(), provider, filters)
pullRequests, err := ListPullRequests(t.Context(), provider, filters)
require.NoError(t, err)
assert.Len(t, pullRequests, 1)
assert.Equal(t, "two", pullRequests[0].Branch)
@@ -140,7 +139,7 @@ func TestFilterTargetBranchMatch(t *testing.T) {
func TestMultiFilterOr(t *testing.T) {
provider, _ := NewFakeService(
context.Background(),
t.Context(),
[]*PullRequest{
{
Number: 1,
@@ -185,7 +184,7 @@ func TestMultiFilterOr(t *testing.T) {
BranchMatch: strp("r"),
},
}
pullRequests, err := ListPullRequests(context.Background(), provider, filters)
pullRequests, err := ListPullRequests(t.Context(), provider, filters)
require.NoError(t, err)
assert.Len(t, pullRequests, 3)
assert.Equal(t, "two", pullRequests[0].Branch)
@@ -195,7 +194,7 @@ func TestMultiFilterOr(t *testing.T) {
func TestMultiFilterOrWithTargetBranchFilter(t *testing.T) {
provider, _ := NewFakeService(
context.Background(),
t.Context(),
[]*PullRequest{
{
Number: 1,
@@ -242,7 +241,7 @@ func TestMultiFilterOrWithTargetBranchFilter(t *testing.T) {
TargetBranchMatch: strp("3"),
},
}
pullRequests, err := ListPullRequests(context.Background(), provider, filters)
pullRequests, err := ListPullRequests(t.Context(), provider, filters)
require.NoError(t, err)
assert.Len(t, pullRequests, 2)
assert.Equal(t, "two", pullRequests[0].Branch)
@@ -251,7 +250,7 @@ func TestMultiFilterOrWithTargetBranchFilter(t *testing.T) {
func TestNoFilters(t *testing.T) {
provider, _ := NewFakeService(
context.Background(),
t.Context(),
[]*PullRequest{
{
Number: 1,
@@ -273,7 +272,7 @@ func TestNoFilters(t *testing.T) {
nil,
)
filters := []argoprojiov1alpha1.PullRequestGeneratorFilter{}
repos, err := ListPullRequests(context.Background(), provider, filters)
repos, err := ListPullRequests(t.Context(), provider, filters)
require.NoError(t, err)
assert.Len(t, repos, 2)
assert.Equal(t, "one", repos[0].Branch)

View File

@@ -4,39 +4,54 @@ import (
"context"
"fmt"
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v2/reposerver/apiclient"
"github.com/argoproj/argo-cd/v2/util/git"
"github.com/argoproj/argo-cd/v2/util/io"
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/reposerver/apiclient"
"github.com/argoproj/argo-cd/v3/util/db"
"github.com/argoproj/argo-cd/v3/util/io"
)
type argoCDService struct {
getRepository func(ctx context.Context, url, project string) (*v1alpha1.Repository, error)
storecreds git.CredsStore
submoduleEnabled bool
repoServerClientSet apiclient.Clientset
newFileGlobbingEnabled bool
getRepository func(ctx context.Context, url, project string) (*v1alpha1.Repository, error)
submoduleEnabled bool
newFileGlobbingEnabled bool
getGitFilesFromRepoServer func(ctx context.Context, req *apiclient.GitFilesRequest) (*apiclient.GitFilesResponse, error)
getGitDirectoriesFromRepoServer func(ctx context.Context, req *apiclient.GitDirectoriesRequest) (*apiclient.GitDirectoriesResponse, error)
}
type Repos interface {
// GetFiles returns content of files (not directories) within the target repo
GetFiles(ctx context.Context, repoURL string, revision string, pattern string, noRevisionCache, verifyCommit bool) (map[string][]byte, error)
GetFiles(ctx context.Context, repoURL, revision, project, pattern string, noRevisionCache, verifyCommit bool) (map[string][]byte, error)
// GetDirectories returns a list of directories (not files) within the target repo
GetDirectories(ctx context.Context, repoURL string, revision string, noRevisionCache, verifyCommit bool) ([]string, error)
GetDirectories(ctx context.Context, repoURL, revision, project string, noRevisionCache, verifyCommit bool) ([]string, error)
}
func NewArgoCDService(getRepository func(ctx context.Context, url, project string) (*v1alpha1.Repository, error), submoduleEnabled bool, repoClientset apiclient.Clientset, newFileGlobbingEnabled bool) (Repos, error) {
func NewArgoCDService(db db.ArgoDB, submoduleEnabled bool, repoClientset apiclient.Clientset, newFileGlobbingEnabled bool) Repos {
return &argoCDService{
getRepository: getRepository,
getRepository: db.GetRepository,
submoduleEnabled: submoduleEnabled,
repoServerClientSet: repoClientset,
newFileGlobbingEnabled: newFileGlobbingEnabled,
}, nil
getGitFilesFromRepoServer: func(ctx context.Context, fileRequest *apiclient.GitFilesRequest) (*apiclient.GitFilesResponse, error) {
closer, client, err := repoClientset.NewRepoServerClient()
if err != nil {
return nil, fmt.Errorf("error initializing new repo server client: %w", err)
}
defer io.Close(closer)
return client.GetGitFiles(ctx, fileRequest)
},
getGitDirectoriesFromRepoServer: func(ctx context.Context, dirRequest *apiclient.GitDirectoriesRequest) (*apiclient.GitDirectoriesResponse, error) {
closer, client, err := repoClientset.NewRepoServerClient()
if err != nil {
return nil, fmt.Errorf("error initialising new repo server client: %w", err)
}
defer io.Close(closer)
return client.GetGitDirectories(ctx, dirRequest)
},
}
}
func (a *argoCDService) GetFiles(ctx context.Context, repoURL string, revision string, pattern string, noRevisionCache, verifyCommit bool) (map[string][]byte, error) {
repo, err := a.getRepository(ctx, repoURL, "")
func (a *argoCDService) GetFiles(ctx context.Context, repoURL, revision, project, pattern string, noRevisionCache, verifyCommit bool) (map[string][]byte, error) {
repo, err := a.getRepository(ctx, repoURL, project)
if err != nil {
return nil, fmt.Errorf("error in GetRepository: %w", err)
}
@@ -50,21 +65,15 @@ func (a *argoCDService) GetFiles(ctx context.Context, repoURL string, revision s
NoRevisionCache: noRevisionCache,
VerifyCommit: verifyCommit,
}
closer, client, err := a.repoServerClientSet.NewRepoServerClient()
if err != nil {
return nil, fmt.Errorf("error initialising new repo server client: %w", err)
}
defer io.Close(closer)
fileResponse, err := client.GetGitFiles(ctx, fileRequest)
fileResponse, err := a.getGitFilesFromRepoServer(ctx, fileRequest)
if err != nil {
return nil, fmt.Errorf("error retrieving Git files: %w", err)
}
return fileResponse.GetMap(), nil
}
func (a *argoCDService) GetDirectories(ctx context.Context, repoURL string, revision string, noRevisionCache, verifyCommit bool) ([]string, error) {
repo, err := a.getRepository(ctx, repoURL, "")
func (a *argoCDService) GetDirectories(ctx context.Context, repoURL, revision, project string, noRevisionCache, verifyCommit bool) ([]string, error) {
repo, err := a.getRepository(ctx, repoURL, project)
if err != nil {
return nil, fmt.Errorf("error in GetRepository: %w", err)
}
@@ -77,13 +86,7 @@ func (a *argoCDService) GetDirectories(ctx context.Context, repoURL string, revi
VerifyCommit: verifyCommit,
}
closer, client, err := a.repoServerClientSet.NewRepoServerClient()
if err != nil {
return nil, fmt.Errorf("error initialising new repo server client: %w", err)
}
defer io.Close(closer)
dirResponse, err := client.GetGitDirectories(ctx, dirRequest)
dirResponse, err := a.getGitDirectoriesFromRepoServer(ctx, dirRequest)
if err != nil {
return nil, fmt.Errorf("error retrieving Git Directories: %w", err)
}

View File

@@ -2,26 +2,26 @@ package services
import (
"context"
"errors"
"fmt"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"k8s.io/client-go/kubernetes/fake"
"github.com/argoproj/argo-cd/v2/reposerver/apiclient"
repo_mocks "github.com/argoproj/argo-cd/v2/reposerver/apiclient/mocks"
"github.com/argoproj/argo-cd/v2/util/git"
"github.com/argoproj/argo-cd/v3/reposerver/apiclient"
repo_mocks "github.com/argoproj/argo-cd/v3/reposerver/apiclient/mocks"
"github.com/argoproj/argo-cd/v3/util/db"
"github.com/argoproj/argo-cd/v3/util/settings"
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func TestGetDirectories(t *testing.T) {
type fields struct {
storecreds git.CredsStore
submoduleEnabled bool
getRepository func(ctx context.Context, url, project string) (*v1alpha1.Repository, error)
repoServerClientFuncs []func(*repo_mocks.RepoServerServiceClient)
submoduleEnabled bool
getRepository func(ctx context.Context, url, project string) (*v1alpha1.Repository, error)
getGitDirectories func(ctx context.Context, req *apiclient.GitDirectoriesRequest) (*apiclient.GitDirectoriesResponse, error)
}
type args struct {
ctx context.Context
@@ -38,58 +38,49 @@ func TestGetDirectories(t *testing.T) {
wantErr assert.ErrorAssertionFunc
}{
{name: "ErrorGettingRepos", fields: fields{
getRepository: func(ctx context.Context, url, project string) (*v1alpha1.Repository, error) {
return nil, fmt.Errorf("unable to get repos")
getRepository: func(_ context.Context, _, _ string) (*v1alpha1.Repository, error) {
return nil, errors.New("unable to get repos")
},
}, args: args{}, want: nil, wantErr: assert.Error},
{name: "ErrorGettingDirs", fields: fields{
getRepository: func(ctx context.Context, url, project string) (*v1alpha1.Repository, error) {
getRepository: func(_ context.Context, _, _ string) (*v1alpha1.Repository, error) {
return &v1alpha1.Repository{}, nil
},
repoServerClientFuncs: []func(*repo_mocks.RepoServerServiceClient){
func(client *repo_mocks.RepoServerServiceClient) {
client.On("GetGitDirectories", mock.Anything, mock.Anything).Return(nil, fmt.Errorf("unable to get dirs"))
},
getGitDirectories: func(_ context.Context, _ *apiclient.GitDirectoriesRequest) (*apiclient.GitDirectoriesResponse, error) {
return nil, errors.New("unable to get dirs")
},
}, args: args{}, want: nil, wantErr: assert.Error},
{name: "HappyCase", fields: fields{
getRepository: func(ctx context.Context, url, project string) (*v1alpha1.Repository, error) {
return &v1alpha1.Repository{}, nil
getRepository: func(_ context.Context, _, _ string) (*v1alpha1.Repository, error) {
return &v1alpha1.Repository{
Repo: "foo",
}, nil
},
repoServerClientFuncs: []func(*repo_mocks.RepoServerServiceClient){
func(client *repo_mocks.RepoServerServiceClient) {
client.On("GetGitDirectories", mock.Anything, mock.Anything).Return(&apiclient.GitDirectoriesResponse{
Paths: []string{"foo", "foo/bar", "bar/foo"},
}, nil)
},
getGitDirectories: func(_ context.Context, _ *apiclient.GitDirectoriesRequest) (*apiclient.GitDirectoriesResponse, error) {
return &apiclient.GitDirectoriesResponse{
Paths: []string{"foo", "foo/bar", "bar/foo"},
}, nil
},
}, args: args{}, want: []string{"foo", "foo/bar", "bar/foo"}, wantErr: assert.NoError},
}, args: args{
repoURL: "foo",
}, want: []string{"foo", "foo/bar", "bar/foo"}, wantErr: assert.NoError},
{name: "ErrorVerifyingCommit", fields: fields{
getRepository: func(ctx context.Context, url, project string) (*v1alpha1.Repository, error) {
getRepository: func(_ context.Context, _, _ string) (*v1alpha1.Repository, error) {
return &v1alpha1.Repository{}, nil
},
repoServerClientFuncs: []func(*repo_mocks.RepoServerServiceClient){
func(client *repo_mocks.RepoServerServiceClient) {
client.On("GetGitDirectories", mock.Anything, mock.Anything).Return(nil, fmt.Errorf("revision HEAD is not signed"))
},
getGitDirectories: func(_ context.Context, _ *apiclient.GitDirectoriesRequest) (*apiclient.GitDirectoriesResponse, error) {
return nil, errors.New("revision HEAD is not signed")
},
}, args: args{}, want: nil, wantErr: assert.Error},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
mockRepoClient := &repo_mocks.RepoServerServiceClient{}
// decorate the mocks
for i := range tt.fields.repoServerClientFuncs {
tt.fields.repoServerClientFuncs[i](mockRepoClient)
}
a := &argoCDService{
getRepository: tt.fields.getRepository,
storecreds: tt.fields.storecreds,
submoduleEnabled: tt.fields.submoduleEnabled,
repoServerClientSet: &repo_mocks.Clientset{RepoServerServiceClient: mockRepoClient},
getRepository: tt.fields.getRepository,
submoduleEnabled: tt.fields.submoduleEnabled,
getGitDirectoriesFromRepoServer: tt.fields.getGitDirectories,
}
got, err := a.GetDirectories(tt.args.ctx, tt.args.repoURL, tt.args.revision, tt.args.noRevisionCache, tt.args.verifyCommit)
got, err := a.GetDirectories(tt.args.ctx, tt.args.repoURL, tt.args.revision, "", tt.args.noRevisionCache, tt.args.verifyCommit)
if !tt.wantErr(t, err, fmt.Sprintf("GetDirectories(%v, %v, %v, %v)", tt.args.ctx, tt.args.repoURL, tt.args.revision, tt.args.noRevisionCache)) {
return
}
@@ -100,10 +91,9 @@ func TestGetDirectories(t *testing.T) {
func TestGetFiles(t *testing.T) {
type fields struct {
storecreds git.CredsStore
submoduleEnabled bool
repoServerClientFuncs []func(*repo_mocks.RepoServerServiceClient)
getRepository func(ctx context.Context, url, project string) (*v1alpha1.Repository, error)
submoduleEnabled bool
getRepository func(ctx context.Context, url, project string) (*v1alpha1.Repository, error)
getGitFiles func(ctx context.Context, req *apiclient.GitFilesRequest) (*apiclient.GitFilesResponse, error)
}
type args struct {
ctx context.Context
@@ -121,64 +111,55 @@ func TestGetFiles(t *testing.T) {
wantErr assert.ErrorAssertionFunc
}{
{name: "ErrorGettingRepos", fields: fields{
getRepository: func(ctx context.Context, url, project string) (*v1alpha1.Repository, error) {
return nil, fmt.Errorf("unable to get repos")
getRepository: func(_ context.Context, _, _ string) (*v1alpha1.Repository, error) {
return nil, errors.New("unable to get repos")
},
}, args: args{}, want: nil, wantErr: assert.Error},
{name: "ErrorGettingFiles", fields: fields{
getRepository: func(ctx context.Context, url, project string) (*v1alpha1.Repository, error) {
getRepository: func(_ context.Context, _, _ string) (*v1alpha1.Repository, error) {
return &v1alpha1.Repository{}, nil
},
repoServerClientFuncs: []func(*repo_mocks.RepoServerServiceClient){
func(client *repo_mocks.RepoServerServiceClient) {
client.On("GetGitFiles", mock.Anything, mock.Anything).Return(nil, fmt.Errorf("unable to get files"))
},
getGitFiles: func(_ context.Context, _ *apiclient.GitFilesRequest) (*apiclient.GitFilesResponse, error) {
return nil, errors.New("unable to get files")
},
}, args: args{}, want: nil, wantErr: assert.Error},
{name: "HappyCase", fields: fields{
getRepository: func(ctx context.Context, url, project string) (*v1alpha1.Repository, error) {
return &v1alpha1.Repository{}, nil
getRepository: func(_ context.Context, _, _ string) (*v1alpha1.Repository, error) {
return &v1alpha1.Repository{
Repo: "foo",
}, nil
},
repoServerClientFuncs: []func(*repo_mocks.RepoServerServiceClient){
func(client *repo_mocks.RepoServerServiceClient) {
client.On("GetGitFiles", mock.Anything, mock.Anything).Return(&apiclient.GitFilesResponse{
Map: map[string][]byte{
"foo.json": []byte("hello: world!"),
"bar.yaml": []byte("yay: appsets"),
},
}, nil)
},
getGitFiles: func(_ context.Context, _ *apiclient.GitFilesRequest) (*apiclient.GitFilesResponse, error) {
return &apiclient.GitFilesResponse{
Map: map[string][]byte{
"foo.json": []byte("hello: world!"),
"bar.yaml": []byte("yay: appsets"),
},
}, nil
},
}, args: args{}, want: map[string][]byte{
}, args: args{
repoURL: "foo",
}, want: map[string][]byte{
"foo.json": []byte("hello: world!"),
"bar.yaml": []byte("yay: appsets"),
}, wantErr: assert.NoError},
{name: "ErrorVerifyingCommit", fields: fields{
getRepository: func(ctx context.Context, url, project string) (*v1alpha1.Repository, error) {
getRepository: func(_ context.Context, _, _ string) (*v1alpha1.Repository, error) {
return &v1alpha1.Repository{}, nil
},
repoServerClientFuncs: []func(*repo_mocks.RepoServerServiceClient){
func(client *repo_mocks.RepoServerServiceClient) {
client.On("GetGitFiles", mock.Anything, mock.Anything).Return(nil, fmt.Errorf("revision HEAD is not signed"))
},
getGitFiles: func(_ context.Context, _ *apiclient.GitFilesRequest) (*apiclient.GitFilesResponse, error) {
return nil, errors.New("revision HEAD is not signed")
},
}, args: args{}, want: nil, wantErr: assert.Error},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
mockRepoClient := &repo_mocks.RepoServerServiceClient{}
// decorate the mocks
for i := range tt.fields.repoServerClientFuncs {
tt.fields.repoServerClientFuncs[i](mockRepoClient)
}
a := &argoCDService{
getRepository: tt.fields.getRepository,
storecreds: tt.fields.storecreds,
submoduleEnabled: tt.fields.submoduleEnabled,
repoServerClientSet: &repo_mocks.Clientset{RepoServerServiceClient: mockRepoClient},
getRepository: tt.fields.getRepository,
submoduleEnabled: tt.fields.submoduleEnabled,
getGitFilesFromRepoServer: tt.fields.getGitFiles,
}
got, err := a.GetFiles(tt.args.ctx, tt.args.repoURL, tt.args.revision, tt.args.pattern, tt.args.noRevisionCache, tt.args.verifyCommit)
got, err := a.GetFiles(tt.args.ctx, tt.args.repoURL, tt.args.revision, tt.args.pattern, "", tt.args.noRevisionCache, tt.args.verifyCommit)
if !tt.wantErr(t, err, fmt.Sprintf("GetFiles(%v, %v, %v, %v, %v)", tt.args.ctx, tt.args.repoURL, tt.args.revision, tt.args.pattern, tt.args.noRevisionCache)) {
return
}
@@ -188,9 +169,9 @@ func TestGetFiles(t *testing.T) {
}
func TestNewArgoCDService(t *testing.T) {
service, err := NewArgoCDService(func(ctx context.Context, url, project string) (*v1alpha1.Repository, error) {
return &v1alpha1.Repository{}, nil
}, false, &repo_mocks.Clientset{}, false)
require.NoError(t, err)
testNamespace := "test"
clientset := fake.NewClientset()
testDB := db.NewDB(testNamespace, settings.NewSettingsManager(t.Context(), clientset, testNamespace), clientset)
service := NewArgoCDService(testDB, false, &repo_mocks.Clientset{}, false)
assert.NotNil(t, service)
}

View File

@@ -21,13 +21,13 @@ import (
"golang.org/x/exp/maps"
"k8s.io/utils/strings/slices"
application "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
application "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
const (
resourceTypeCodeCommitRepository = "codecommit:repository"
prefixGitUrlHttps = "https://git-codecommit."
prefixGitUrlHttpsFIPS = "https://git-codecommit-fips."
prefixGitURLHTTPS = "https://git-codecommit."
prefixGitURLHTTPSFIPS = "https://git-codecommit-fips."
)
// AWSCodeCommitClient is a lean facade to the codecommitiface.CodeCommitAPI
@@ -315,16 +315,16 @@ func getCodeCommitRepoName(repoArn string) (string, error) {
// getCodeCommitFIPSEndpoint transforms provided https:// codecommit URL to a FIPS-compliant endpoint.
// note that the specified region must support FIPS, otherwise the returned URL won't be reachable
// see: https://docs.aws.amazon.com/codecommit/latest/userguide/regions.html#regions-git
func getCodeCommitFIPSEndpoint(repoUrl string) (string, error) {
if strings.HasPrefix(repoUrl, prefixGitUrlHttpsFIPS) {
log.Debugf("provided repoUrl %s is already a fips endpoint", repoUrl)
return repoUrl, nil
func getCodeCommitFIPSEndpoint(repoURL string) (string, error) {
if strings.HasPrefix(repoURL, prefixGitURLHTTPSFIPS) {
log.Debugf("provided repoUrl %s is already a fips endpoint", repoURL)
return repoURL, nil
}
if !strings.HasPrefix(repoUrl, prefixGitUrlHttps) {
return "", fmt.Errorf("the provided https endpoint isn't recognized, cannot be transformed to FIPS endpoint: %s", repoUrl)
if !strings.HasPrefix(repoURL, prefixGitURLHTTPS) {
return "", fmt.Errorf("the provided https endpoint isn't recognized, cannot be transformed to FIPS endpoint: %s", repoURL)
}
// we already have the prefix, so we guarantee to replace exactly the prefix only.
return strings.Replace(repoUrl, prefixGitUrlHttps, prefixGitUrlHttpsFIPS, 1), nil
return strings.Replace(repoURL, prefixGitURLHTTPS, prefixGitURLHTTPSFIPS, 1), nil
}
func hasAwsError(err error, codes ...string) bool {

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
// Code generated by mockery v2.52.4. DO NOT EDIT.
package mocks

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
// Code generated by mockery v2.52.4. DO NOT EDIT.
package mocks

View File

@@ -1,7 +1,6 @@
package scm_provider
import (
"context"
"errors"
"sort"
"testing"
@@ -13,8 +12,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/argoproj/argo-cd/v2/applicationset/services/scm_provider/aws_codecommit/mocks"
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/applicationset/services/scm_provider/aws_codecommit/mocks"
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
type awsCodeCommitTestRepository struct {
@@ -23,7 +22,7 @@ type awsCodeCommitTestRepository struct {
arn string
accountId string
defaultBranch string
expectedCloneUrl string
expectedCloneURL string
getRepositoryError error
getRepositoryNilMetadata bool
valid bool
@@ -49,7 +48,7 @@ func TestAWSCodeCommitListRepos(t *testing.T) {
id: "8235624d-d248-4df9-a983-2558b01dbe83",
arn: "arn:aws:codecommit:us-east-1:111111111111:repo1",
defaultBranch: "main",
expectedCloneUrl: "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo1",
expectedCloneURL: "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo1",
valid: true,
},
},
@@ -74,7 +73,7 @@ func TestAWSCodeCommitListRepos(t *testing.T) {
id: "8235624d-d248-4df9-a983-2558b01dbe83",
arn: "arn:aws:codecommit:us-east-1:111111111111:repo1",
defaultBranch: "main",
expectedCloneUrl: "https://git-codecommit-fips.us-east-1.amazonaws.com/v1/repos/repo1",
expectedCloneURL: "https://git-codecommit-fips.us-east-1.amazonaws.com/v1/repos/repo1",
valid: true,
},
},
@@ -96,7 +95,7 @@ func TestAWSCodeCommitListRepos(t *testing.T) {
id: "8235624d-d248-4df9-a983-2558b01dbe83",
arn: "arn:aws:codecommit:us-east-1:111111111111:repo1",
defaultBranch: "main",
expectedCloneUrl: "ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo1",
expectedCloneURL: "ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo1",
valid: true,
},
{
@@ -160,7 +159,7 @@ func TestAWSCodeCommitListRepos(t *testing.T) {
t.Run(testCase.name, func(t *testing.T) {
codeCommitClient := mocks.NewAWSCodeCommitClient(t)
taggingClient := mocks.NewAWSTaggingClient(t)
ctx := context.Background()
ctx := t.Context()
codecommitRepoNameIdPairs := make([]*codecommit.RepositoryNameIdPair, 0)
resourceTaggings := make([]*resourcegroupstaggingapi.ResourceTagMapping, 0)
validRepositories := make([]*awsCodeCommitTestRepository, 0)
@@ -226,7 +225,7 @@ func TestAWSCodeCommitListRepos(t *testing.T) {
assert.Equal(t, originRepo.name, repo.Repository)
assert.Equal(t, originRepo.id, repo.RepositoryId)
assert.Equal(t, originRepo.defaultBranch, repo.Branch)
assert.Equal(t, originRepo.expectedCloneUrl, repo.URL)
assert.Equal(t, originRepo.expectedCloneURL, repo.URL)
assert.Empty(t, repo.SHA, "SHA is always empty")
}
}
@@ -349,7 +348,7 @@ func TestAWSCodeCommitRepoHasPath(t *testing.T) {
t.Run(testCase.name, func(t *testing.T) {
codeCommitClient := mocks.NewAWSCodeCommitClient(t)
taggingClient := mocks.NewAWSTaggingClient(t)
ctx := context.Background()
ctx := t.Context()
if testCase.expectedGetFolderPath != "" {
codeCommitClient.
On("GetFolderWithContext", ctx, &codecommit.GetFolderInput{
@@ -382,7 +381,7 @@ func TestAWSCodeCommitGetBranches(t *testing.T) {
id := "1a64adc4-2fb5-4abd-afe7-127984ba83c0"
defaultBranch := "main"
organization := "111111111111"
cloneUrl := "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo1"
cloneURL := "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo1"
testCases := []struct {
name string
@@ -422,7 +421,7 @@ func TestAWSCodeCommitGetBranches(t *testing.T) {
t.Run(testCase.name, func(t *testing.T) {
codeCommitClient := mocks.NewAWSCodeCommitClient(t)
taggingClient := mocks.NewAWSTaggingClient(t)
ctx := context.Background()
ctx := t.Context()
if testCase.allBranches {
codeCommitClient.
On("ListBranchesWithContext", ctx, &codecommit.ListBranchesInput{
@@ -445,7 +444,7 @@ func TestAWSCodeCommitGetBranches(t *testing.T) {
actual, err := provider.GetBranches(ctx, &Repository{
Organization: organization,
Repository: name,
URL: cloneUrl,
URL: cloneURL,
RepositoryId: id,
})
if testCase.expectOverallError {
@@ -454,7 +453,7 @@ func TestAWSCodeCommitGetBranches(t *testing.T) {
assertCopiedProperties := func(repo *Repository) {
assert.Equal(t, id, repo.RepositoryId)
assert.Equal(t, name, repo.Repository)
assert.Equal(t, cloneUrl, repo.URL)
assert.Equal(t, cloneURL, repo.URL)
assert.Equal(t, organization, repo.Organization)
assert.Empty(t, repo.SHA)
}

View File

@@ -57,9 +57,9 @@ var (
_ AzureDevOpsClientFactory = &devopsFactoryImpl{}
)
func NewAzureDevOpsProvider(ctx context.Context, accessToken string, org string, url string, project string, allBranches bool) (*AzureDevOpsProvider, error) {
func NewAzureDevOpsProvider(accessToken string, org string, url string, project string, allBranches bool) (*AzureDevOpsProvider, error) {
if accessToken == "" {
return nil, fmt.Errorf("no access token provided")
return nil, errors.New("no access token provided")
}
devOpsURL, err := getValidDevOpsURL(url, org)
@@ -72,7 +72,7 @@ func NewAzureDevOpsProvider(ctx context.Context, accessToken string, org string,
return &AzureDevOpsProvider{organization: org, teamProject: project, accessToken: accessToken, clientFactory: &devopsFactoryImpl{connection: connection}, allBranches: allBranches}, nil
}
func (g *AzureDevOpsProvider) ListRepos(ctx context.Context, cloneProtocol string) ([]*Repository, error) {
func (g *AzureDevOpsProvider) ListRepos(ctx context.Context, _ string) ([]*Repository, error) {
gitClient, err := g.clientFactory.GetClient(ctx)
if err != nil {
return nil, fmt.Errorf("failed to get Azure DevOps client: %w", err)
@@ -107,7 +107,7 @@ func (g *AzureDevOpsProvider) RepoHasPath(ctx context.Context, repo *Repository,
}
var repoId string
if uuid, isUuid := repo.RepositoryId.(uuid.UUID); isUuid { // most likely an UUID, but do type-safe check anyway. Do %v fallback if not expected type.
if uuid, isUUID := repo.RepositoryId.(uuid.UUID); isUUID { // most likely an UUID, but do type-safe check anyway. Do %v fallback if not expected type.
repoId = uuid.String()
} else {
repoId = fmt.Sprintf("%v", repo.RepositoryId)

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
// Code generated by mockery v2.52.4. DO NOT EDIT.
package mocks

View File

@@ -2,6 +2,7 @@ package scm_provider
import (
"context"
"errors"
"fmt"
"testing"
@@ -14,7 +15,7 @@ import (
"github.com/microsoft/azure-devops-go-api/azuredevops"
azureGit "github.com/microsoft/azure-devops-go-api/azuredevops/git"
azureMock "github.com/argoproj/argo-cd/v2/applicationset/services/scm_provider/azure_devops/git/mocks"
azureMock "github.com/argoproj/argo-cd/v3/applicationset/services/scm_provider/azure_devops/git/mocks"
)
func s(input string) *string {
@@ -28,7 +29,7 @@ func TestAzureDevopsRepoHasPath(t *testing.T) {
path := "dir/subdir/item.yaml"
branchName := "my/featurebranch"
ctx := context.Background()
ctx := t.Context()
uuid := uuid.New().String()
testCases := []struct {
@@ -41,7 +42,7 @@ func TestAzureDevopsRepoHasPath(t *testing.T) {
}{
{
name: "RepoHasPath when Azure DevOps client factory fails returns error",
clientError: fmt.Errorf("Client factory error"),
clientError: errors.New("Client factory error"),
},
{
name: "RepoHasPath when found returns true",
@@ -62,7 +63,7 @@ func TestAzureDevopsRepoHasPath(t *testing.T) {
{
name: "RepoHasPath when unknown Azure DevOps error occurs returns error",
pathFound: false,
azureDevopsError: fmt.Errorf("Undefined error from Azure Devops"),
azureDevopsError: errors.New("Undefined error from Azure Devops"),
returnError: true,
errorMessage: "failed to check for path existence",
},
@@ -114,7 +115,7 @@ func TestGetDefaultBranchOnDisabledRepo(t *testing.T) {
repoName := "myorg_project_repo"
defaultBranch := "main"
ctx := context.Background()
ctx := t.Context()
testCases := []struct {
name string
@@ -133,7 +134,7 @@ func TestGetDefaultBranchOnDisabledRepo(t *testing.T) {
},
{
name: "other error when calling azure devops returns error",
azureDevOpsError: fmt.Errorf("some unknown error"),
azureDevOpsError: errors.New("some unknown error"),
shouldReturnError: true,
},
}
@@ -173,7 +174,7 @@ func TestGetAllBranchesOnDisabledRepo(t *testing.T) {
repoName := "myorg_project_repo"
defaultBranch := "main"
ctx := context.Background()
ctx := t.Context()
testCases := []struct {
name string
@@ -192,7 +193,7 @@ func TestGetAllBranchesOnDisabledRepo(t *testing.T) {
},
{
name: "other error when calling azure devops returns error",
azureDevOpsError: fmt.Errorf("some unknown error"),
azureDevOpsError: errors.New("some unknown error"),
shouldReturnError: true,
},
}
@@ -232,7 +233,7 @@ func TestAzureDevOpsGetDefaultBranchStripsRefsName(t *testing.T) {
teamProject := "myorg_project"
repoName := "myorg_project_repo"
ctx := context.Background()
ctx := t.Context()
uuid := uuid.New().String()
strippedBranchName := "somebranch"
defaultBranch := fmt.Sprintf("refs/heads/%v", strippedBranchName)
@@ -263,7 +264,7 @@ func TestAzureDevOpsGetBranchesDefultBranchOnly(t *testing.T) {
teamProject := "myorg_project"
repoName := "myorg_project_repo"
ctx := context.Background()
ctx := t.Context()
uuid := uuid.New().String()
defaultBranch := "main"
@@ -271,7 +272,7 @@ func TestAzureDevOpsGetBranchesDefultBranchOnly(t *testing.T) {
testCases := []struct {
name string
expectedBranch *azureGit.GitBranchStats
getBranchesApiError error
getBranchesAPIError error
clientError error
}{
{
@@ -280,11 +281,11 @@ func TestAzureDevOpsGetBranchesDefultBranchOnly(t *testing.T) {
},
{
name: "GetBranches AllBranches false when request fails returns error and empty result",
getBranchesApiError: fmt.Errorf("Remote Azure Devops GetBranches error"),
getBranchesAPIError: errors.New("Remote Azure Devops GetBranches error"),
},
{
name: "GetBranches AllBranches false when Azure DevOps client fails returns error",
clientError: fmt.Errorf("Could not get Azure Devops API client"),
clientError: errors.New("Could not get Azure Devops API client"),
},
{
name: "GetBranches AllBranches false when branch returned with long commit SHA",
@@ -299,7 +300,7 @@ func TestAzureDevOpsGetBranchesDefultBranchOnly(t *testing.T) {
clientFactoryMock := &AzureClientFactoryMock{mock: &mock.Mock{}}
clientFactoryMock.mock.On("GetClient", mock.Anything).Return(&gitClientMock, testCase.clientError)
gitClientMock.On("GetBranch", ctx, azureGit.GetBranchArgs{RepositoryId: &repoName, Project: &teamProject, Name: &defaultBranch}).Return(testCase.expectedBranch, testCase.getBranchesApiError)
gitClientMock.On("GetBranch", ctx, azureGit.GetBranchArgs{RepositoryId: &repoName, Project: &teamProject, Name: &defaultBranch}).Return(testCase.expectedBranch, testCase.getBranchesAPIError)
repo := &Repository{Organization: organization, Repository: repoName, RepositoryId: uuid, Branch: defaultBranch}
@@ -313,9 +314,9 @@ func TestAzureDevOpsGetBranchesDefultBranchOnly(t *testing.T) {
return
}
if testCase.getBranchesApiError != nil {
if testCase.getBranchesAPIError != nil {
assert.Empty(t, branches)
require.ErrorContains(t, err, testCase.getBranchesApiError.Error())
require.ErrorContains(t, err, testCase.getBranchesAPIError.Error())
} else {
if testCase.expectedBranch != nil {
assert.NotEmpty(t, branches)
@@ -334,13 +335,13 @@ func TestAzureDevopsGetBranches(t *testing.T) {
teamProject := "myorg_project"
repoName := "myorg_project_repo"
ctx := context.Background()
ctx := t.Context()
uuid := uuid.New().String()
testCases := []struct {
name string
expectedBranches *[]azureGit.GitBranchStats
getBranchesApiError error
getBranchesAPIError error
clientError error
allBranches bool
expectedProcessingErrorMsg string
@@ -352,7 +353,7 @@ func TestAzureDevopsGetBranches(t *testing.T) {
},
{
name: "GetBranches when Azure DevOps request fails returns error and empty result",
getBranchesApiError: fmt.Errorf("Remote Azure Devops GetBranches error"),
getBranchesAPIError: errors.New("Remote Azure Devops GetBranches error"),
allBranches: true,
},
{
@@ -362,7 +363,7 @@ func TestAzureDevopsGetBranches(t *testing.T) {
},
{
name: "GetBranches when git client retrievel fails returns error",
clientError: fmt.Errorf("Could not get Azure Devops API client"),
clientError: errors.New("Could not get Azure Devops API client"),
allBranches: true,
},
{
@@ -383,7 +384,7 @@ func TestAzureDevopsGetBranches(t *testing.T) {
clientFactoryMock := &AzureClientFactoryMock{mock: &mock.Mock{}}
clientFactoryMock.mock.On("GetClient", mock.Anything).Return(&gitClientMock, testCase.clientError)
gitClientMock.On("GetBranches", ctx, azureGit.GetBranchesArgs{RepositoryId: &repoName, Project: &teamProject}).Return(testCase.expectedBranches, testCase.getBranchesApiError)
gitClientMock.On("GetBranches", ctx, azureGit.GetBranchesArgs{RepositoryId: &repoName, Project: &teamProject}).Return(testCase.expectedBranches, testCase.getBranchesAPIError)
repo := &Repository{Organization: organization, Repository: repoName, RepositoryId: uuid}
@@ -402,9 +403,9 @@ func TestAzureDevopsGetBranches(t *testing.T) {
return
}
if testCase.getBranchesApiError != nil {
if testCase.getBranchesAPIError != nil {
assert.Empty(t, branches)
require.ErrorContains(t, err, testCase.getBranchesApiError.Error())
require.ErrorContains(t, err, testCase.getBranchesAPIError.Error())
} else {
if len(*testCase.expectedBranches) > 0 {
assert.NotEmpty(t, branches)
@@ -426,7 +427,7 @@ func TestGetAzureDevopsRepositories(t *testing.T) {
teamProject := "myorg_project"
uuid := uuid.New()
ctx := context.Background()
ctx := t.Context()
repoId := &uuid
@@ -447,7 +448,7 @@ func TestGetAzureDevopsRepositories(t *testing.T) {
},
{
name: "ListRepos when Azure DevOps request fails returns error",
getRepositoriesError: fmt.Errorf("Could not get repos"),
getRepositoriesError: errors.New("Could not get repos"),
},
{
name: "ListRepos when repo has no name returns empty list",

View File

@@ -2,6 +2,7 @@ package scm_provider
import (
"context"
"errors"
"fmt"
"net/http"
"strings"
@@ -51,7 +52,7 @@ func (c *ExtendedClient) GetContents(repo *Repository, path string) (bool, error
var _ SCMProviderService = &BitBucketCloudProvider{}
func NewBitBucketCloudProvider(ctx context.Context, owner string, user string, password string, allBranches bool) (*BitBucketCloudProvider, error) {
func NewBitBucketCloudProvider(owner string, user string, password string, allBranches bool) (*BitBucketCloudProvider, error) {
client := &ExtendedClient{
bitbucket.NewBasicAuth(user, password),
user,
@@ -61,7 +62,7 @@ func NewBitBucketCloudProvider(ctx context.Context, owner string, user string, p
return &BitBucketCloudProvider{client: client, owner: owner, allBranches: allBranches}, nil
}
func (g *BitBucketCloudProvider) GetBranches(ctx context.Context, repo *Repository) ([]*Repository, error) {
func (g *BitBucketCloudProvider) GetBranches(_ context.Context, repo *Repository) ([]*Repository, error) {
repos := []*Repository{}
branches, err := g.listBranches(repo)
if err != nil {
@@ -86,7 +87,7 @@ func (g *BitBucketCloudProvider) GetBranches(ctx context.Context, repo *Reposito
return repos, nil
}
func (g *BitBucketCloudProvider) ListRepos(ctx context.Context, cloneProtocol string) ([]*Repository, error) {
func (g *BitBucketCloudProvider) ListRepos(_ context.Context, cloneProtocol string) ([]*Repository, error) {
if cloneProtocol == "" {
cloneProtocol = "ssh"
}
@@ -100,7 +101,7 @@ func (g *BitBucketCloudProvider) ListRepos(ctx context.Context, cloneProtocol st
return nil, fmt.Errorf("error listing repositories for %s: %w", g.owner, err)
}
for _, bitBucketRepo := range accountReposResp.Items {
cloneUrl, err := findCloneURL(cloneProtocol, &bitBucketRepo)
cloneURL, err := findCloneURL(cloneProtocol, &bitBucketRepo)
if err != nil {
return nil, fmt.Errorf("error fetching clone url for repo %s: %w", bitBucketRepo.Slug, err)
}
@@ -108,7 +109,7 @@ func (g *BitBucketCloudProvider) ListRepos(ctx context.Context, cloneProtocol st
Organization: g.owner,
Repository: bitBucketRepo.Slug,
Branch: bitBucketRepo.Mainbranch.Name,
URL: *cloneUrl,
URL: *cloneURL,
Labels: []string{},
RepositoryId: bitBucketRepo.Uuid,
})
@@ -116,7 +117,7 @@ func (g *BitBucketCloudProvider) ListRepos(ctx context.Context, cloneProtocol st
return repos, nil
}
func (g *BitBucketCloudProvider) RepoHasPath(ctx context.Context, repo *Repository, path string) (bool, error) {
func (g *BitBucketCloudProvider) RepoHasPath(_ context.Context, repo *Repository, path string) (bool, error) {
contents, err := g.client.GetContents(repo, path)
if err != nil {
return false, err
@@ -153,19 +154,19 @@ func (g *BitBucketCloudProvider) listBranches(repo *Repository) ([]bitbucket.Rep
}
func findCloneURL(cloneProtocol string, repo *bitbucket.Repository) (*string, error) {
cloneLinks, ok := repo.Links["clone"].([]interface{})
cloneLinks, ok := repo.Links["clone"].([]any)
if !ok {
return nil, fmt.Errorf("unknown type returned from repo links")
return nil, errors.New("unknown type returned from repo links")
}
for _, link := range cloneLinks {
linkEntry, ok := link.(map[string]interface{})
linkEntry, ok := link.(map[string]any)
if !ok {
return nil, fmt.Errorf("unknown type returned from clone link")
return nil, errors.New("unknown type returned from clone link")
}
if linkEntry["name"] == cloneProtocol {
url, ok := linkEntry["href"].(string)
if !ok {
return nil, fmt.Errorf("could not find href for clone link")
return nil, errors.New("could not find href for clone link")
}
return &url, nil
}

View File

@@ -1,7 +1,6 @@
package scm_provider
import (
"context"
"fmt"
"net/http"
"net/http/httptest"
@@ -10,7 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func TestBitbucketHasRepo(t *testing.T) {
@@ -87,14 +86,14 @@ func TestBitbucketHasRepo(t *testing.T) {
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
provider, _ := NewBitBucketCloudProvider(context.Background(), c.owner, "user", "password", false)
provider, _ := NewBitBucketCloudProvider(c.owner, "user", "password", false)
repo := &Repository{
Organization: c.owner,
Repository: c.repo,
SHA: c.sha,
Branch: "main",
}
hasPath, err := provider.RepoHasPath(context.Background(), repo, c.path)
hasPath, err := provider.RepoHasPath(t.Context(), repo, c.path)
if err != nil {
require.Error(t, fmt.Errorf("Error in test %w", err))
}
@@ -487,8 +486,8 @@ func TestBitbucketListRepos(t *testing.T) {
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
provider, _ := NewBitBucketCloudProvider(context.Background(), c.owner, "user", "password", c.allBranches)
rawRepos, err := ListRepos(context.Background(), provider, c.filters, c.proto)
provider, _ := NewBitBucketCloudProvider(c.owner, "user", "password", c.allBranches)
rawRepos, err := ListRepos(t.Context(), provider, c.filters, c.proto)
if c.hasError {
require.Error(t, err)
} else {

View File

@@ -10,7 +10,7 @@ import (
bitbucketv1 "github.com/gfleury/go-bitbucket-v1"
log "github.com/sirupsen/logrus"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
"github.com/argoproj/argo-cd/v3/applicationset/services"
)
type BitbucketServerProvider struct {
@@ -49,22 +49,17 @@ func NewBitbucketServerProviderNoAuth(ctx context.Context, url, projectKey strin
}
func newBitbucketServerProvider(ctx context.Context, bitbucketConfig *bitbucketv1.Configuration, projectKey string, allBranches bool, scmRootCAPath string, insecure bool, caCerts []byte) (*BitbucketServerProvider, error) {
bitbucketConfig.BasePath = utils.NormalizeBitbucketBasePath(bitbucketConfig.BasePath)
tlsConfig := utils.GetTlsConfig(scmRootCAPath, insecure, caCerts)
bitbucketConfig.HTTPClient = &http.Client{Transport: &http.Transport{
TLSClientConfig: tlsConfig,
}}
bitbucketClient := bitbucketv1.NewAPIClient(ctx, bitbucketConfig)
bbClient := services.SetupBitbucketClient(ctx, bitbucketConfig, scmRootCAPath, insecure, caCerts)
return &BitbucketServerProvider{
client: bitbucketClient,
client: bbClient,
projectKey: projectKey,
allBranches: allBranches,
}, nil
}
func (b *BitbucketServerProvider) ListRepos(_ context.Context, cloneProtocol string) ([]*Repository, error) {
paged := map[string]interface{}{
paged := map[string]any{
"limit": 100,
}
repos := []*Repository{}
@@ -122,7 +117,7 @@ func (b *BitbucketServerProvider) ListRepos(_ context.Context, cloneProtocol str
}
func (b *BitbucketServerProvider) RepoHasPath(_ context.Context, repo *Repository, path string) (bool, error) {
opts := map[string]interface{}{
opts := map[string]any{
"limit": 100,
"at": repo.Branch,
"type_": true,
@@ -174,7 +169,7 @@ func (b *BitbucketServerProvider) listBranches(repo *Repository) ([]bitbucketv1.
}
// Otherwise, scrape the GetBranches API.
branches := []bitbucketv1.Branch{}
paged := map[string]interface{}{
paged := map[string]any{
"limit": 100,
}
for {

View File

@@ -1,7 +1,6 @@
package scm_provider
import (
"context"
"crypto/x509"
"encoding/pem"
"io"
@@ -103,9 +102,9 @@ func TestListReposNoAuth(t *testing.T) {
defaultHandler(t)(w, r)
}))
defer ts.Close()
provider, err := NewBitbucketServerProviderNoAuth(context.Background(), ts.URL, "PROJECT", true, "", false, nil)
provider, err := NewBitbucketServerProviderNoAuth(t.Context(), ts.URL, "PROJECT", true, "", false, nil)
require.NoError(t, err)
repos, err := provider.ListRepos(context.Background(), "ssh")
repos, err := provider.ListRepos(t.Context(), "ssh")
verifyDefaultRepo(t, err, repos)
}
@@ -195,9 +194,9 @@ func TestListReposPagination(t *testing.T) {
}
}))
defer ts.Close()
provider, err := NewBitbucketServerProviderNoAuth(context.Background(), ts.URL, "PROJECT", true, "", false, nil)
provider, err := NewBitbucketServerProviderNoAuth(t.Context(), ts.URL, "PROJECT", true, "", false, nil)
require.NoError(t, err)
repos, err := provider.ListRepos(context.Background(), "ssh")
repos, err := provider.ListRepos(t.Context(), "ssh")
require.NoError(t, err)
assert.Len(t, repos, 2)
assert.Equal(t, Repository{
@@ -272,9 +271,9 @@ func TestGetBranchesBranchPagination(t *testing.T) {
defaultHandler(t)(w, r)
}))
defer ts.Close()
provider, err := NewBitbucketServerProviderNoAuth(context.Background(), ts.URL, "PROJECT", true, "", false, nil)
provider, err := NewBitbucketServerProviderNoAuth(t.Context(), ts.URL, "PROJECT", true, "", false, nil)
require.NoError(t, err)
repos, err := provider.GetBranches(context.Background(), &Repository{
repos, err := provider.GetBranches(t.Context(), &Repository{
Organization: "PROJECT",
Repository: "REPO",
URL: "ssh://git@mycompany.bitbucket.org/PROJECT/REPO.git",
@@ -307,8 +306,7 @@ func TestGetBranchesBranchPagination(t *testing.T) {
func TestGetBranchesDefaultOnly(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
assert.Empty(t, r.Header.Get("Authorization"))
switch r.RequestURI {
case "/rest/api/1.0/projects/PROJECT/repos/REPO/branches/default":
if r.RequestURI == "/rest/api/1.0/projects/PROJECT/repos/REPO/branches/default" {
_, err := io.WriteString(w, `{
"id": "refs/heads/default",
"displayId": "default",
@@ -325,9 +323,9 @@ func TestGetBranchesDefaultOnly(t *testing.T) {
defaultHandler(t)(w, r)
}))
defer ts.Close()
provider, err := NewBitbucketServerProviderNoAuth(context.Background(), ts.URL, "PROJECT", false, "", false, nil)
provider, err := NewBitbucketServerProviderNoAuth(t.Context(), ts.URL, "PROJECT", false, "", false, nil)
require.NoError(t, err)
repos, err := provider.GetBranches(context.Background(), &Repository{
repos, err := provider.GetBranches(t.Context(), &Repository{
Organization: "PROJECT",
Repository: "REPO",
URL: "ssh://git@mycompany.bitbucket.org/PROJECT/REPO.git",
@@ -350,16 +348,15 @@ func TestGetBranchesDefaultOnly(t *testing.T) {
func TestGetBranchesMissingDefault(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
assert.Empty(t, r.Header.Get("Authorization"))
switch r.RequestURI {
case "/rest/api/1.0/projects/PROJECT/repos/REPO/branches/default":
if r.RequestURI == "/rest/api/1.0/projects/PROJECT/repos/REPO/branches/default" {
http.Error(w, "Not found", http.StatusNotFound)
}
defaultHandler(t)(w, r)
}))
defer ts.Close()
provider, err := NewBitbucketServerProviderNoAuth(context.Background(), ts.URL, "PROJECT", false, "", false, nil)
provider, err := NewBitbucketServerProviderNoAuth(t.Context(), ts.URL, "PROJECT", false, "", false, nil)
require.NoError(t, err)
repos, err := provider.GetBranches(context.Background(), &Repository{
repos, err := provider.GetBranches(t.Context(), &Repository{
Organization: "PROJECT",
Repository: "REPO",
URL: "ssh://git@mycompany.bitbucket.org/PROJECT/REPO.git",
@@ -371,17 +368,16 @@ func TestGetBranchesMissingDefault(t *testing.T) {
}
func TestGetBranchesEmptyRepo(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ts := httptest.NewServer(http.HandlerFunc(func(_ http.ResponseWriter, r *http.Request) {
assert.Empty(t, r.Header.Get("Authorization"))
switch r.RequestURI {
case "/rest/api/1.0/projects/PROJECT/repos/REPO/branches/default":
if r.RequestURI == "/rest/api/1.0/projects/PROJECT/repos/REPO/branches/default" {
return
}
}))
defer ts.Close()
provider, err := NewBitbucketServerProviderNoAuth(context.Background(), ts.URL, "PROJECT", false, "", false, nil)
provider, err := NewBitbucketServerProviderNoAuth(t.Context(), ts.URL, "PROJECT", false, "", false, nil)
require.NoError(t, err)
repos, err := provider.GetBranches(context.Background(), &Repository{
repos, err := provider.GetBranches(t.Context(), &Repository{
Organization: "PROJECT",
Repository: "REPO",
URL: "ssh://git@mycompany.bitbucket.org/PROJECT/REPO.git",
@@ -395,16 +391,15 @@ func TestGetBranchesEmptyRepo(t *testing.T) {
func TestGetBranchesErrorDefaultBranch(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
assert.Empty(t, r.Header.Get("Authorization"))
switch r.RequestURI {
case "/rest/api/1.0/projects/PROJECT/repos/REPO/branches/default":
if r.RequestURI == "/rest/api/1.0/projects/PROJECT/repos/REPO/branches/default" {
http.Error(w, "Internal server error", http.StatusInternalServerError)
}
defaultHandler(t)(w, r)
}))
defer ts.Close()
provider, err := NewBitbucketServerProviderNoAuth(context.Background(), ts.URL, "PROJECT", false, "", false, nil)
provider, err := NewBitbucketServerProviderNoAuth(t.Context(), ts.URL, "PROJECT", false, "", false, nil)
require.NoError(t, err)
_, err = provider.GetBranches(context.Background(), &Repository{
_, err = provider.GetBranches(t.Context(), &Repository{
Organization: "PROJECT",
Repository: "REPO",
URL: "ssh://git@mycompany.bitbucket.org/PROJECT/REPO.git",
@@ -456,7 +451,7 @@ func TestListReposTLS(t *testing.T) {
defer ts.Close()
var certs []byte
if test.passCerts == true {
if test.passCerts {
for _, cert := range ts.TLS.Certificates {
for _, c := range cert.Certificate {
parsedCert, err := x509.ParseCertificate(c)
@@ -469,9 +464,9 @@ func TestListReposTLS(t *testing.T) {
}
}
provider, err := NewBitbucketServerProviderBasicAuth(context.Background(), "user", "password", ts.URL, "PROJECT", true, "", test.tlsInsecure, certs)
provider, err := NewBitbucketServerProviderBasicAuth(t.Context(), "user", "password", ts.URL, "PROJECT", true, "", test.tlsInsecure, certs)
require.NoError(t, err)
_, err = provider.ListRepos(context.Background(), "ssh")
_, err = provider.ListRepos(t.Context(), "ssh")
if test.requireErr {
require.Error(t, err)
} else {
@@ -488,9 +483,9 @@ func TestListReposBasicAuth(t *testing.T) {
defaultHandler(t)(w, r)
}))
defer ts.Close()
provider, err := NewBitbucketServerProviderBasicAuth(context.Background(), "user", "password", ts.URL, "PROJECT", true, "", false, nil)
provider, err := NewBitbucketServerProviderBasicAuth(t.Context(), "user", "password", ts.URL, "PROJECT", true, "", false, nil)
require.NoError(t, err)
repos, err := provider.ListRepos(context.Background(), "ssh")
repos, err := provider.ListRepos(t.Context(), "ssh")
verifyDefaultRepo(t, err, repos)
}
@@ -501,17 +496,16 @@ func TestListReposBearerAuth(t *testing.T) {
defaultHandler(t)(w, r)
}))
defer ts.Close()
provider, err := NewBitbucketServerProviderBearerToken(context.Background(), "tolkien", ts.URL, "PROJECT", true, "", false, nil)
provider, err := NewBitbucketServerProviderBearerToken(t.Context(), "tolkien", ts.URL, "PROJECT", true, "", false, nil)
require.NoError(t, err)
repos, err := provider.ListRepos(context.Background(), "ssh")
repos, err := provider.ListRepos(t.Context(), "ssh")
verifyDefaultRepo(t, err, repos)
}
func TestListReposDefaultBranch(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
assert.Empty(t, r.Header.Get("Authorization"))
switch r.RequestURI {
case "/rest/api/1.0/projects/PROJECT/repos/REPO/branches/default":
if r.RequestURI == "/rest/api/1.0/projects/PROJECT/repos/REPO/branches/default" {
_, err := io.WriteString(w, `{
"id": "refs/heads/default",
"displayId": "default",
@@ -528,9 +522,9 @@ func TestListReposDefaultBranch(t *testing.T) {
defaultHandler(t)(w, r)
}))
defer ts.Close()
provider, err := NewBitbucketServerProviderNoAuth(context.Background(), ts.URL, "PROJECT", false, "", false, nil)
provider, err := NewBitbucketServerProviderNoAuth(t.Context(), ts.URL, "PROJECT", false, "", false, nil)
require.NoError(t, err)
repos, err := provider.ListRepos(context.Background(), "ssh")
repos, err := provider.ListRepos(t.Context(), "ssh")
require.NoError(t, err)
assert.Len(t, repos, 1)
assert.Equal(t, Repository{
@@ -547,16 +541,15 @@ func TestListReposDefaultBranch(t *testing.T) {
func TestListReposMissingDefaultBranch(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
assert.Empty(t, r.Header.Get("Authorization"))
switch r.RequestURI {
case "/rest/api/1.0/projects/PROJECT/repos/REPO/branches/default":
if r.RequestURI == "/rest/api/1.0/projects/PROJECT/repos/REPO/branches/default" {
http.Error(w, "Not found", http.StatusNotFound)
}
defaultHandler(t)(w, r)
}))
defer ts.Close()
provider, err := NewBitbucketServerProviderNoAuth(context.Background(), ts.URL, "PROJECT", false, "", false, nil)
provider, err := NewBitbucketServerProviderNoAuth(t.Context(), ts.URL, "PROJECT", false, "", false, nil)
require.NoError(t, err)
repos, err := provider.ListRepos(context.Background(), "ssh")
repos, err := provider.ListRepos(t.Context(), "ssh")
require.NoError(t, err)
assert.Empty(t, repos)
}
@@ -564,16 +557,15 @@ func TestListReposMissingDefaultBranch(t *testing.T) {
func TestListReposErrorDefaultBranch(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
assert.Empty(t, r.Header.Get("Authorization"))
switch r.RequestURI {
case "/rest/api/1.0/projects/PROJECT/repos/REPO/branches/default":
if r.RequestURI == "/rest/api/1.0/projects/PROJECT/repos/REPO/branches/default" {
http.Error(w, "Internal server error", http.StatusInternalServerError)
}
defaultHandler(t)(w, r)
}))
defer ts.Close()
provider, err := NewBitbucketServerProviderNoAuth(context.Background(), ts.URL, "PROJECT", false, "", false, nil)
provider, err := NewBitbucketServerProviderNoAuth(t.Context(), ts.URL, "PROJECT", false, "", false, nil)
require.NoError(t, err)
_, err = provider.ListRepos(context.Background(), "ssh")
_, err = provider.ListRepos(t.Context(), "ssh")
require.Error(t, err)
}
@@ -583,9 +575,9 @@ func TestListReposCloneProtocol(t *testing.T) {
defaultHandler(t)(w, r)
}))
defer ts.Close()
provider, err := NewBitbucketServerProviderNoAuth(context.Background(), ts.URL, "PROJECT", true, "", false, nil)
provider, err := NewBitbucketServerProviderNoAuth(t.Context(), ts.URL, "PROJECT", true, "", false, nil)
require.NoError(t, err)
repos, err := provider.ListRepos(context.Background(), "https")
repos, err := provider.ListRepos(t.Context(), "https")
require.NoError(t, err)
assert.Len(t, repos, 1)
assert.Equal(t, Repository{
@@ -605,9 +597,9 @@ func TestListReposUnknownProtocol(t *testing.T) {
defaultHandler(t)(w, r)
}))
defer ts.Close()
provider, err := NewBitbucketServerProviderNoAuth(context.Background(), ts.URL, "PROJECT", true, "", false, nil)
provider, err := NewBitbucketServerProviderNoAuth(t.Context(), ts.URL, "PROJECT", true, "", false, nil)
require.NoError(t, err)
_, errProtocol := provider.ListRepos(context.Background(), "http")
_, errProtocol := provider.ListRepos(t.Context(), "http")
require.Error(t, errProtocol)
}
@@ -643,37 +635,37 @@ func TestBitbucketServerHasPath(t *testing.T) {
}
}))
defer ts.Close()
provider, err := NewBitbucketServerProviderNoAuth(context.Background(), ts.URL, "PROJECT", true, "", false, nil)
provider, err := NewBitbucketServerProviderNoAuth(t.Context(), ts.URL, "PROJECT", true, "", false, nil)
require.NoError(t, err)
repo := &Repository{
Organization: "PROJECT",
Repository: "REPO",
Branch: "main",
}
ok, err := provider.RepoHasPath(context.Background(), repo, "pkg")
ok, err := provider.RepoHasPath(t.Context(), repo, "pkg")
require.NoError(t, err)
assert.True(t, ok)
ok, err = provider.RepoHasPath(context.Background(), repo, "pkg/")
ok, err = provider.RepoHasPath(t.Context(), repo, "pkg/")
require.NoError(t, err)
assert.True(t, ok)
ok, err = provider.RepoHasPath(context.Background(), repo, "anotherpkg/file.txt")
ok, err = provider.RepoHasPath(t.Context(), repo, "anotherpkg/file.txt")
require.NoError(t, err)
assert.True(t, ok)
ok, err = provider.RepoHasPath(context.Background(), repo, "anotherpkg/missing.txt")
ok, err = provider.RepoHasPath(t.Context(), repo, "anotherpkg/missing.txt")
require.NoError(t, err)
assert.False(t, ok)
ok, err = provider.RepoHasPath(context.Background(), repo, "notathing")
ok, err = provider.RepoHasPath(t.Context(), repo, "notathing")
require.NoError(t, err)
assert.False(t, ok)
ok, err = provider.RepoHasPath(context.Background(), repo, "return-redirect")
ok, err = provider.RepoHasPath(t.Context(), repo, "return-redirect")
require.NoError(t, err)
assert.True(t, ok)
_, err = provider.RepoHasPath(context.Background(), repo, "unauthorized-response")
_, err = provider.RepoHasPath(t.Context(), repo, "unauthorized-response")
require.Error(t, err)
}

View File

@@ -19,7 +19,7 @@ type GiteaProvider struct {
var _ SCMProviderService = &GiteaProvider{}
func NewGiteaProvider(ctx context.Context, owner, token, url string, allBranches, insecure bool) (*GiteaProvider, error) {
func NewGiteaProvider(owner, token, url string, allBranches, insecure bool) (*GiteaProvider, error) {
if token == "" {
token = os.Getenv("GITEA_TOKEN")
}
@@ -46,7 +46,7 @@ func NewGiteaProvider(ctx context.Context, owner, token, url string, allBranches
}, nil
}
func (g *GiteaProvider) GetBranches(ctx context.Context, repo *Repository) ([]*Repository, error) {
func (g *GiteaProvider) GetBranches(_ context.Context, repo *Repository) ([]*Repository, error) {
if !g.allBranches {
branch, status, err := g.client.GetRepoBranch(g.owner, repo.Repository, repo.Branch)
if status.StatusCode == http.StatusNotFound {
@@ -87,7 +87,7 @@ func (g *GiteaProvider) GetBranches(ctx context.Context, repo *Repository) ([]*R
return repos, nil
}
func (g *GiteaProvider) ListRepos(ctx context.Context, cloneProtocol string) ([]*Repository, error) {
func (g *GiteaProvider) ListRepos(_ context.Context, cloneProtocol string) ([]*Repository, error) {
repos := []*Repository{}
repoOpts := gitea.ListOrgReposOptions{}
giteaRepos, _, err := g.client.ListOrgRepos(g.owner, repoOpts)
@@ -126,15 +126,15 @@ func (g *GiteaProvider) ListRepos(ctx context.Context, cloneProtocol string) ([]
return repos, nil
}
func (g *GiteaProvider) RepoHasPath(ctx context.Context, repo *Repository, path string) (bool, error) {
func (g *GiteaProvider) RepoHasPath(_ context.Context, repo *Repository, path string) (bool, error) {
_, resp, err := g.client.GetContents(repo.Organization, repo.Repository, repo.Branch, path)
if resp != nil && resp.StatusCode == http.StatusNotFound {
return false, nil
}
if fmt.Sprint(err) == "expect file, got directory" {
return true, nil
}
if err != nil {
if err.Error() == "expect file, got directory" {
return true, nil
}
return false, err
}
return true, nil

Some files were not shown because too many files have changed in this diff Show More