From c7e8612b11b10b66c6dc7948820088da036673ab Mon Sep 17 00:00:00 2001 From: Pravin Pushkar Date: Tue, 19 Dec 2023 13:06:54 +0530 Subject: [PATCH 1/4] Upgrade go to 1.21 (#1331) Signed-off-by: Pravin Pushkar --- Makefile | 2 +- docs/development/development.md | 2 +- go.mod | 2 +- go.sum | 20 ++++++++++++++++++++ tests/apps/emit-metrics/go.mod | 2 +- tests/apps/processor/go.mod | 2 +- 6 files changed, 25 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 5407357a5..592cbc3c3 100644 --- a/Makefile +++ b/Makefile @@ -207,7 +207,7 @@ e2e-build-run-sh: build test-e2e-sh ################################################################################ .PHONY: modtidy modtidy: - go mod tidy -compat=1.20 + go mod tidy -compat=1.21 ################################################################################ # Target: check-diff # diff --git a/docs/development/development.md b/docs/development/development.md index c4e0b1872..2c6b27651 100644 --- a/docs/development/development.md +++ b/docs/development/development.md @@ -7,7 +7,7 @@ This document helps you get started developing Dapr CLI. If you find any problem ### Linux and MacOS -1. The Go language environment `1.20` [(instructions)](https://golang.org/doc/install#tarball). +1. The Go language environment `1.21` [(instructions)](https://golang.org/doc/install#tarball). * Make sure that your GOPATH and PATH are configured correctly ```bash export GOPATH=~/go diff --git a/go.mod b/go.mod index 8d30e5784..333d1b20a 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/dapr/cli -go 1.20 +go 1.21 require ( github.com/Azure/go-autorest/autorest v0.11.28 // indirect diff --git a/go.sum b/go.sum index 42f42601b..8702492e7 100644 --- a/go.sum +++ b/go.sum @@ -81,6 +81,7 @@ github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= +github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE= github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= @@ -167,6 +168,7 @@ github.com/briandowns/spinner v1.19.0 h1:s8aq38H+Qju89yhp89b4iIiMzMm8YN3p6vGpwyh github.com/briandowns/spinner v1.19.0/go.mod h1:mQak9GHqbspjC/5iUx3qMlIho8xBS/ppAL/hX5SmPJU= github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= github.com/bshuster-repo/logrus-logstash-hook v1.0.0 h1:e+C0SB5R1pu//O4MQ3f9cFuPGoOVeF2fE4Og9otCc70= +github.com/bshuster-repo/logrus-logstash-hook v1.0.0/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= @@ -231,6 +233,7 @@ github.com/containerd/cgroups v0.0.0-20200824123100-0b889c03f102/go.mod h1:s5q4S github.com/containerd/cgroups v0.0.0-20210114181951-8a68de567b68/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= github.com/containerd/cgroups v1.0.1/go.mod h1:0SJrPIenamHDcZhEcJMNBB85rHcUsw4f25ZfBiPYRkU= github.com/containerd/cgroups v1.0.4 h1:jN/mbWBEaz+T1pi5OFtnkQ+8qnmEbAr1Oo1FRm5B0dA= +github.com/containerd/cgroups v1.0.4/go.mod h1:nLNQtsF7Sl2HxNebu77i1R0oDlhiTG+kO4JTrUzo6IA= github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= github.com/containerd/console v0.0.0-20181022165439-0650fd9eeb50/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= github.com/containerd/console v0.0.0-20191206165004-02ecf6a7291e/go.mod h1:8Pf4gM6VEbTNRIT26AyyU7hxdQU3MvAvxVI0sc00XBE= @@ -327,6 +330,7 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= +github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= @@ -356,6 +360,7 @@ github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11 github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2 h1:aBfCb7iqHmDEIp6fBvC/hQUddQfg+3qdYjwzaiP9Hnc= +github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2/go.mod h1:WHNsWjnIn2V1LYOrME7e8KxSeKunYHsxEm4am0BUtcI= github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/cli v20.10.21+incompatible h1:qVkgyYUnOLQ98LtXBrwd/duVqPT2X4SHndOuGsfwyhU= @@ -413,9 +418,11 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= +github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= +github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= @@ -461,6 +468,7 @@ github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v1.2.3 h1:a9vnzlIBPQBBkeaR9IuMUfmVOrQlkoC4YfPoFkX3T7A= +github.com/go-logr/zapr v1.2.3/go.mod h1:eIauM6P8qSvTw5o2ez6UEAfGjQKrxQTl5EoK+Qa2oG4= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= @@ -486,6 +494,7 @@ github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= +github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gobuffalo/logger v1.0.6 h1:nnZNpxYo0zx+Aj9RfMPBm+x9zAU2OayFh/xrAWi34HU= @@ -563,6 +572,7 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gomodule/redigo v1.8.2 h1:H5XSIre1MB5NbPYFp+i1NBbb5qN1W8Y8YAQoAYbkm8k= +github.com/gomodule/redigo v1.8.2/go.mod h1:P9dn9mFrCBvWhGE1wpxx6fgq7BAeLBk+UUUzlpkBYO0= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= @@ -630,6 +640,7 @@ github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8 github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= +github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= @@ -662,6 +673,7 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= @@ -679,6 +691,7 @@ github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru/v2 v2.0.6 h1:3xi/Cafd1NaoEnS/yDssIiuVeDVywU0QdFGl3aQaQHM= github.com/hashicorp/golang-lru/v2 v2.0.6/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= @@ -751,6 +764,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -911,6 +925,7 @@ github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3 github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= github.com/onsi/ginkgo/v2 v2.6.0 h1:9t9b9vRUbFq3C4qKFCGkVuq/fIHji802N1nrtkh1mNc= +github.com/onsi/ginkgo/v2 v2.6.0/go.mod h1:63DOGlLAH8+REH8jUGdL3YpCpu7JODesutUjdENfUAc= github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= @@ -923,6 +938,7 @@ github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.24.1 h1:KORJXNNTzJXzu4ScJWssJfJMnJ+2QJqhoQSRwNlze9E= +github.com/onsi/gomega v1.24.1/go.mod h1:3AOiACssS3/MajrniINInwbfOOtfZvplPzuRSmvt1jM= github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -1055,6 +1071,7 @@ github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= @@ -1247,8 +1264,10 @@ go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= +go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= +go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= @@ -1257,6 +1276,7 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= +go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/tests/apps/emit-metrics/go.mod b/tests/apps/emit-metrics/go.mod index 1d7104a25..2f23bda24 100644 --- a/tests/apps/emit-metrics/go.mod +++ b/tests/apps/emit-metrics/go.mod @@ -1,3 +1,3 @@ module emit-metrics -go 1.20 +go 1.21 diff --git a/tests/apps/processor/go.mod b/tests/apps/processor/go.mod index b0d715645..74d99856f 100644 --- a/tests/apps/processor/go.mod +++ b/tests/apps/processor/go.mod @@ -1,3 +1,3 @@ module processor -go 1.20 +go 1.21 From f5eb4fda6cc07c637df69fbc321fe2c3661cf871 Mon Sep 17 00:00:00 2001 From: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com> Date: Thu, 18 Jan 2024 02:07:09 -0800 Subject: [PATCH 2/4] fix upload artifact name conflict (#1373) * fix upload test report name Signed-off-by: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com> * fix linter errors Signed-off-by: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com> * fix upload artifacts version and name conflicts Signed-off-by: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com> * fix typo Signed-off-by: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com> * fix typo Signed-off-by: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com> --------- Signed-off-by: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com> --- .github/workflows/dapr_cli.yaml | 15 ++++++------ .github/workflows/kind_e2e.yaml | 2 +- .github/workflows/self_hosted_e2e.yaml | 8 +++---- .github/workflows/upgrade_e2e.yaml | 2 +- .golangci.yml | 21 +++++++++------- cmd/dashboard.go | 2 +- pkg/kubernetes/annotator.go | 2 +- pkg/kubernetes/annotator_test.go | 33 +++++++++++++------------- pkg/standalone/invoke.go | 2 +- pkg/standalone/publish.go | 2 +- pkg/standalone/stop.go | 6 ++--- tests/e2e/upgrade/upgrade_test.go | 26 ++++++++++---------- 12 files changed, 64 insertions(+), 57 deletions(-) diff --git a/.github/workflows/dapr_cli.yaml b/.github/workflows/dapr_cli.yaml index 4233f7675..1983bdfea 100644 --- a/.github/workflows/dapr_cli.yaml +++ b/.github/workflows/dapr_cli.yaml @@ -29,7 +29,7 @@ jobs: name: Build ${{ matrix.target_os }}_${{ matrix.target_arch }} binaries runs-on: ${{ matrix.os }} env: - GOLANG_CI_LINT_VER: v1.51.2 + GOLANG_CI_LINT_VER: v1.55.2 GOOS: ${{ matrix.target_os }} GOARCH: ${{ matrix.target_arch }} GOPROXY: https://proxy.golang.org @@ -132,14 +132,14 @@ jobs: if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' run: | [ ! -z "${{ env.REL_VERSION }}" ] && echo "${{ env.REL_VERSION }}" > "${{ env.ARCHIVE_OUTDIR }}/release_version.txt" - - name: upload artifacts - uses: actions/upload-artifact@master + - name: upload artifacts ## Following migration guide in https://github.com/actions/upload-artifact/blob/main/docs/MIGRATION.md + uses: actions/upload-artifact@v4 with: - name: cli_drop + name: cli_drop-${{ matrix.target_os }}_${{ matrix.target_arch }} path: ${{ env.ARCHIVE_OUTDIR }} - name: Upload test results if: always() - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: name: ${{ matrix.target_os }}_${{ matrix.target_arch }}_test_unit.json path: ${{ env.TEST_OUTPUT_FILE }} @@ -152,9 +152,10 @@ jobs: runs-on: ubuntu-latest steps: - name: download artifacts - uses: actions/download-artifact@master + uses: actions/download-artifact@v4 with: - name: cli_drop + pattern: cli_drop-* + merge-multiple: true path: ${{ env.ARTIFACT_DIR }} - name: Set Release Version run: | diff --git a/.github/workflows/kind_e2e.yaml b/.github/workflows/kind_e2e.yaml index 529b0138a..1e5c79826 100644 --- a/.github/workflows/kind_e2e.yaml +++ b/.github/workflows/kind_e2e.yaml @@ -195,7 +195,7 @@ jobs: shell: bash - name: Upload test results if: always() - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: name: ${{ matrix.k8s-version }}_${{ matrix.mode }}_e2e_k8s.json path: ${{ env.TEST_OUTPUT_FILE }} diff --git a/.github/workflows/self_hosted_e2e.yaml b/.github/workflows/self_hosted_e2e.yaml index f9abdfcb0..a814ad281 100644 --- a/.github/workflows/self_hosted_e2e.yaml +++ b/.github/workflows/self_hosted_e2e.yaml @@ -40,8 +40,8 @@ jobs: ARCHIVE_OUTDIR: dist/archives DAPR_RUNTIME_PINNED_VERSION: "1.12.0" DAPR_DASHBOARD_PINNED_VERSION: 0.14.0 - DAPR_RUNTIME_LATEST_STABLE_VERSION: - DAPR_DASHBOARD_LATEST_STABLE_VERSION: + DAPR_RUNTIME_LATEST_STABLE_VERSION: "" + DAPR_DASHBOARD_LATEST_STABLE_VERSION: "" GOLANG_PROTOBUF_REGISTRATION_CONFLICT: warn PODMAN_VERSION: 4.4.4 strategy: @@ -179,7 +179,7 @@ jobs: shell: bash - name: Upload test results if: always() - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: - name: ${{ matrix.target_os }}_${{ matrix.target_arch }}_e2e_standalone.json + name: ${{ matrix.target_os }}_${{ matrix.target_arch }}_${{ matrix.dapr_install_mode }}_e2e_standalone.json path: ${{ env.TEST_OUTPUT_FILE }} diff --git a/.github/workflows/upgrade_e2e.yaml b/.github/workflows/upgrade_e2e.yaml index fefc9570d..b6eb580d2 100644 --- a/.github/workflows/upgrade_e2e.yaml +++ b/.github/workflows/upgrade_e2e.yaml @@ -158,7 +158,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: name: ${{ matrix.k8s-version }}_${{ matrix.mode }}_e2e_upgrade_k8s.json path: ${{ env.TEST_OUTPUT_FILE }} diff --git a/.golangci.yml b/.golangci.yml index 6e989ca69..d26599d7f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -118,13 +118,11 @@ linters-settings: # minimal occurrences count to trigger, 3 by default min-occurrences: 5 depguard: - list-type: blacklist - include-go-root: false - packages: - - github.com/Sirupsen/logrus - packages-with-error-messages: - # specify an error message to output when a blacklisted package is used - github.com/Sirupsen/logrus: "must use github.com/sirupsen/logrus" + rules: + main: + deny: + - pkg: "github.com/Sirupsen/logrus" + desc: "must use github.com/sirupsen/logrus" misspell: # Correct spellings using locale preferences for US or UK. # Default is to use a neutral variety of English. @@ -216,7 +214,6 @@ linters-settings: # Allow multiline assignments to be cuddled. Default is true. allow-multiline-assign: true # Allow case blocks to end with a whitespace. - allow-case-traling-whitespace: true # Allow declarations (var) to be cuddled. allow-cuddle-declarations: false @@ -262,4 +259,10 @@ linters: - forcetypeassert - ireturn - golint - - nosnakecase \ No newline at end of file + - nosnakecase + - tagalign + - varcheck + - deadcode + - structcheck + - ifshort + - testifylint \ No newline at end of file diff --git a/cmd/dashboard.go b/cmd/dashboard.go index 7bf936898..d75be1b42 100644 --- a/cmd/dashboard.go +++ b/cmd/dashboard.go @@ -180,7 +180,7 @@ dapr dashboard -k -p 0 }() // url for dashboard after port forwarding. - webURL := fmt.Sprintf("http://%s", net.JoinHostPort(dashboardHost, fmt.Sprint(portForward.LocalPort))) + webURL := fmt.Sprintf("http://%s", net.JoinHostPort(dashboardHost, fmt.Sprint(portForward.LocalPort))) //nolint: perfsprint print.InfoStatusEvent(os.Stdout, fmt.Sprintf("Dapr dashboard found in namespace:\t%s", foundNamespace)) print.InfoStatusEvent(os.Stdout, fmt.Sprintf("Dapr dashboard available at:\t%s\n", webURL)) diff --git a/pkg/kubernetes/annotator.go b/pkg/kubernetes/annotator.go index 83c3955a4..251a9c646 100644 --- a/pkg/kubernetes/annotator.go +++ b/pkg/kubernetes/annotator.go @@ -82,7 +82,7 @@ const ( ) type Annotator interface { - Annotate(io.Reader, io.Writer) error + Annotate(io.Reader, io.Writer) error //nolint: inamedparam } type K8sAnnotator struct { diff --git a/pkg/kubernetes/annotator_test.go b/pkg/kubernetes/annotator_test.go index 97ecb6487..e038fc79a 100644 --- a/pkg/kubernetes/annotator_test.go +++ b/pkg/kubernetes/annotator_test.go @@ -2,11 +2,11 @@ package kubernetes import ( "bytes" - "fmt" "io" "os" "path" "sort" + "strconv" "strings" "testing" @@ -292,6 +292,7 @@ func TestAnnotate(t *testing.T) { var out bytes.Buffer in := []io.Reader{inputFile} for i, annotation := range tt.annotations { + annotation := annotation annotator := NewK8sAnnotator(K8sAnnotatorConfig{ TargetResource: &annotation.targetResource, TargetNamespace: &annotation.targetNamespace, @@ -423,7 +424,7 @@ func TestGetDaprAnnotations(t *testing.T) { assert.Equal(t, "true", annotations[daprEnabledKey]) assert.Equal(t, appID, annotations[daprAppIDKey]) - assert.Equal(t, fmt.Sprintf("%d", appPort), annotations[daprAppPortKey]) + assert.Equal(t, strconv.Itoa(appPort), annotations[daprAppPortKey]) assert.Equal(t, config, annotations[daprConfigKey]) assert.Equal(t, appProtocol, annotations[daprAppProtocolKey]) assert.Equal(t, "true", annotations[daprEnableProfilingKey]) @@ -431,31 +432,31 @@ func TestGetDaprAnnotations(t *testing.T) { assert.Equal(t, apiTokenSecret, annotations[daprAPITokenSecretKey]) assert.Equal(t, appTokenSecret, annotations[daprAppTokenSecretKey]) assert.Equal(t, "true", annotations[daprLogAsJSONKey]) - assert.Equal(t, fmt.Sprintf("%d", appMaxConcurrency), annotations[daprAppMaxConcurrencyKey]) + assert.Equal(t, strconv.Itoa(appMaxConcurrency), annotations[daprAppMaxConcurrencyKey]) assert.Equal(t, "true", annotations[daprEnableMetricsKey]) - assert.Equal(t, fmt.Sprintf("%d", metricsPort), annotations[daprMetricsPortKey]) + assert.Equal(t, strconv.Itoa(metricsPort), annotations[daprMetricsPortKey]) assert.Equal(t, "true", annotations[daprEnableDebugKey]) - assert.Equal(t, fmt.Sprintf("%d", debugPort), annotations[daprDebugPortKey]) + assert.Equal(t, strconv.Itoa(debugPort), annotations[daprDebugPortKey]) assert.Equal(t, env, annotations[daprEnvKey]) assert.Equal(t, cpuLimit, annotations[daprCPULimitKey]) assert.Equal(t, memoryLimit, annotations[daprMemoryLimitKey]) assert.Equal(t, cpuRequest, annotations[daprCPURequestKey]) assert.Equal(t, memoryRequest, annotations[daprMemoryRequestKey]) assert.Equal(t, listenAddresses, annotations[daprListenAddressesKey]) - assert.Equal(t, fmt.Sprintf("%d", livenessProbeDelay), annotations[daprLivenessProbeDelayKey]) - assert.Equal(t, fmt.Sprintf("%d", livenessProbeTimeout), annotations[daprLivenessProbeTimeoutKey]) - assert.Equal(t, fmt.Sprintf("%d", livenessProbePeriod), annotations[daprLivenessProbePeriodKey]) - assert.Equal(t, fmt.Sprintf("%d", livenessProbeThreshold), annotations[daprLivenessProbeThresholdKey]) - assert.Equal(t, fmt.Sprintf("%d", readinessProbeDelay), annotations[daprReadinessProbeDelayKey]) - assert.Equal(t, fmt.Sprintf("%d", readinessProbeTimeout), annotations[daprReadinessProbeTimeoutKey]) - assert.Equal(t, fmt.Sprintf("%d", readinessProbePeriod), annotations[daprReadinessProbePeriodKey]) - assert.Equal(t, fmt.Sprintf("%d", readinessProbeThreshold), annotations[daprReadinessProbeThresholdKey]) + assert.Equal(t, strconv.Itoa(livenessProbeDelay), annotations[daprLivenessProbeDelayKey]) + assert.Equal(t, strconv.Itoa(livenessProbeTimeout), annotations[daprLivenessProbeTimeoutKey]) + assert.Equal(t, strconv.Itoa(livenessProbePeriod), annotations[daprLivenessProbePeriodKey]) + assert.Equal(t, strconv.Itoa(livenessProbeThreshold), annotations[daprLivenessProbeThresholdKey]) + assert.Equal(t, strconv.Itoa(readinessProbeDelay), annotations[daprReadinessProbeDelayKey]) + assert.Equal(t, strconv.Itoa(readinessProbeTimeout), annotations[daprReadinessProbeTimeoutKey]) + assert.Equal(t, strconv.Itoa(readinessProbePeriod), annotations[daprReadinessProbePeriodKey]) + assert.Equal(t, strconv.Itoa(readinessProbeThreshold), annotations[daprReadinessProbeThresholdKey]) assert.Equal(t, daprImage, annotations[daprImageKey]) assert.Equal(t, "true", annotations[daprAppSSLKey]) - assert.Equal(t, fmt.Sprintf("%d", maxRequestBodySize), annotations[daprMaxRequestBodySizeKey]) - assert.Equal(t, fmt.Sprintf("%d", readBufferSize), annotations[daprReadBufferSizeKey]) + assert.Equal(t, strconv.Itoa(maxRequestBodySize), annotations[daprMaxRequestBodySizeKey]) + assert.Equal(t, strconv.Itoa(readBufferSize), annotations[daprReadBufferSizeKey]) assert.Equal(t, "true", annotations[daprHTTPStreamRequestBodyKey]) - assert.Equal(t, fmt.Sprintf("%d", gracefulShutdownSeconds), annotations[daprGracefulShutdownSecondsKey]) + assert.Equal(t, strconv.Itoa(gracefulShutdownSeconds), annotations[daprGracefulShutdownSecondsKey]) assert.Equal(t, "true", annotations[daprEnableAPILoggingKey]) assert.Equal(t, unixDomainSocketPath, annotations[daprUnixDomainSocketPathKey]) assert.Equal(t, volumeMountsReadOnly, annotations[daprVolumeMountsReadOnlyKey]) diff --git a/pkg/standalone/invoke.go b/pkg/standalone/invoke.go index df059912f..597b2730b 100644 --- a/pkg/standalone/invoke.go +++ b/pkg/standalone/invoke.go @@ -64,7 +64,7 @@ func (s *Standalone) Invoke(appID, method string, data []byte, verb string, path } func makeEndpoint(lo ListOutput, method string) string { - return fmt.Sprintf("http://127.0.0.1:%s/v%s/invoke/%s/method/%s", fmt.Sprintf("%v", lo.HTTPPort), api.RuntimeAPIVersion, lo.AppID, method) + return fmt.Sprintf("http://127.0.0.1:%s/v%s/invoke/%s/method/%s", fmt.Sprintf("%v", lo.HTTPPort), api.RuntimeAPIVersion, lo.AppID, method) //nolint: perfsprint } func handleResponse(response *http.Response) (string, error) { diff --git a/pkg/standalone/publish.go b/pkg/standalone/publish.go index b80c91841..30ae646fe 100644 --- a/pkg/standalone/publish.go +++ b/pkg/standalone/publish.go @@ -62,7 +62,7 @@ func (s *Standalone) Publish(publishAppID, pubsubName, topic string, payload []b }, } } else { - url = fmt.Sprintf("http://localhost:%s/v%s/publish/%s/%s%s", fmt.Sprintf("%v", instance.HTTPPort), api.RuntimeAPIVersion, pubsubName, topic, queryParams) + url = fmt.Sprintf("http://localhost:%s/v%s/publish/%s/%s%s", fmt.Sprintf("%v", instance.HTTPPort), api.RuntimeAPIVersion, pubsubName, topic, queryParams) //nolint: perfsprint } contentType := "application/json" diff --git a/pkg/standalone/stop.go b/pkg/standalone/stop.go index f70e80856..78a75a968 100644 --- a/pkg/standalone/stop.go +++ b/pkg/standalone/stop.go @@ -31,10 +31,10 @@ func Stop(appID string, cliPIDToNoOfApps map[int]int, apps []ListOutput) error { // Kill the Daprd process if Daprd was started without CLI, otherwise // kill the CLI process which also kills the associated Daprd process. if a.CliPID == 0 || cliPIDToNoOfApps[a.CliPID] > 1 { - pid = fmt.Sprintf("%v", a.DaprdPID) + pid = fmt.Sprintf("%v", a.DaprdPID) //nolint: perfsprint cliPIDToNoOfApps[a.CliPID]-- } else { - pid = fmt.Sprintf("%v", a.CliPID) + pid = fmt.Sprintf("%v", a.CliPID) //nolint: perfsprint } _, err := utils.RunCmdAndWait("kill", pid) @@ -57,7 +57,7 @@ func StopAppsWithRunFile(runTemplatePath string) error { pgid, err := syscall.Getpgid(a.CliPID) if err != nil { // Fall back to cliPID if pgid is not available. - _, err = utils.RunCmdAndWait("kill", fmt.Sprintf("%v", a.CliPID)) + _, err = utils.RunCmdAndWait("kill", fmt.Sprintf("%v", a.CliPID)) //nolint:perfsprint return err } // Kill the whole process group. diff --git a/tests/e2e/upgrade/upgrade_test.go b/tests/e2e/upgrade/upgrade_test.go index 865383b57..48c8f6a26 100644 --- a/tests/e2e/upgrade/upgrade_test.go +++ b/tests/e2e/upgrade/upgrade_test.go @@ -22,6 +22,8 @@ import ( "github.com/dapr/cli/tests/e2e/common" ) +const deleteCRDs = "delete CRDs " + type upgradePath struct { previous common.VersionDetails next common.VersionDetails @@ -129,8 +131,8 @@ func getTestsOnUpgrade(p upgradePath, installOpts, upgradeOpts common.TestOption // delete CRDs if exist. tests = append(tests, - common.TestCase{Name: "delete CRDs " + p.previous.RuntimeVersion, Callable: common.DeleteCRD(p.previous.CustomResourceDefs)}, - common.TestCase{Name: "delete CRDs " + p.next.RuntimeVersion, Callable: common.DeleteCRD(p.next.CustomResourceDefs)}) + common.TestCase{Name: deleteCRDs + p.previous.RuntimeVersion, Callable: common.DeleteCRD(p.previous.CustomResourceDefs)}, + common.TestCase{Name: deleteCRDs + p.next.RuntimeVersion, Callable: common.DeleteCRD(p.next.CustomResourceDefs)}) return tests } @@ -142,8 +144,8 @@ func TestUpgradePathNonHAModeMTLSDisabled(t *testing.T) { common.EnsureUninstall(false, false) // does not wait for pod deletion. for _, p := range supportedUpgradePaths { t.Run(fmt.Sprintf("setup v%s to v%s", p.previous.RuntimeVersion, p.next.RuntimeVersion), func(t *testing.T) { - t.Run("delete CRDs "+p.previous.RuntimeVersion, common.DeleteCRD(p.previous.CustomResourceDefs)) - t.Run("delete CRDs "+p.next.RuntimeVersion, common.DeleteCRD(p.next.CustomResourceDefs)) + t.Run(deleteCRDs+p.previous.RuntimeVersion, common.DeleteCRD(p.previous.CustomResourceDefs)) + t.Run(deleteCRDs+p.next.RuntimeVersion, common.DeleteCRD(p.next.CustomResourceDefs)) }) } @@ -187,8 +189,8 @@ func TestUpgradePathNonHAModeMTLSEnabled(t *testing.T) { common.EnsureUninstall(false, false) // does not wait for pod deletion. for _, p := range supportedUpgradePaths { t.Run(fmt.Sprintf("setup v%s to v%s", p.previous.RuntimeVersion, p.next.RuntimeVersion), func(t *testing.T) { - t.Run("delete CRDs "+p.previous.RuntimeVersion, common.DeleteCRD(p.previous.CustomResourceDefs)) - t.Run("delete CRDs "+p.next.RuntimeVersion, common.DeleteCRD(p.next.CustomResourceDefs)) + t.Run(deleteCRDs+p.previous.RuntimeVersion, common.DeleteCRD(p.previous.CustomResourceDefs)) + t.Run(deleteCRDs+p.next.RuntimeVersion, common.DeleteCRD(p.next.CustomResourceDefs)) }) } @@ -232,8 +234,8 @@ func TestUpgradePathHAModeMTLSDisabled(t *testing.T) { common.EnsureUninstall(false, false) // does not wait for pod deletion. for _, p := range supportedUpgradePaths { t.Run(fmt.Sprintf("setup v%s to v%s", p.previous.RuntimeVersion, p.next.RuntimeVersion), func(t *testing.T) { - t.Run("delete CRDs "+p.previous.RuntimeVersion, common.DeleteCRD(p.previous.CustomResourceDefs)) - t.Run("delete CRDs "+p.next.RuntimeVersion, common.DeleteCRD(p.next.CustomResourceDefs)) + t.Run(deleteCRDs+p.previous.RuntimeVersion, common.DeleteCRD(p.previous.CustomResourceDefs)) + t.Run(deleteCRDs+p.next.RuntimeVersion, common.DeleteCRD(p.next.CustomResourceDefs)) }) } @@ -277,8 +279,8 @@ func TestUpgradePathHAModeMTLSEnabled(t *testing.T) { common.EnsureUninstall(false, false) // does not wait for pod deletion. for _, p := range supportedUpgradePaths { t.Run(fmt.Sprintf("setup v%s to v%s", p.previous.RuntimeVersion, p.next.RuntimeVersion), func(t *testing.T) { - t.Run("delete CRDs "+p.previous.RuntimeVersion, common.DeleteCRD(p.previous.CustomResourceDefs)) - t.Run("delete CRDs "+p.next.RuntimeVersion, common.DeleteCRD(p.next.CustomResourceDefs)) + t.Run(deleteCRDs+p.previous.RuntimeVersion, common.DeleteCRD(p.previous.CustomResourceDefs)) + t.Run(deleteCRDs+p.next.RuntimeVersion, common.DeleteCRD(p.next.CustomResourceDefs)) }) } @@ -324,8 +326,8 @@ func TestUpgradeWithHTTPEndpoint(t *testing.T) { common.EnsureUninstall(false, false) // does not wait for pod deletion. for _, p := range supportedUpgradePaths { t.Run(fmt.Sprintf("setup v%s to v%s", p.previous.RuntimeVersion, p.next.RuntimeVersion), func(t *testing.T) { - t.Run("delete CRDs "+p.previous.RuntimeVersion, common.DeleteCRD(p.previous.CustomResourceDefs)) - t.Run("delete CRDs "+p.next.RuntimeVersion, common.DeleteCRD(p.next.CustomResourceDefs)) + t.Run(deleteCRDs+p.previous.RuntimeVersion, common.DeleteCRD(p.previous.CustomResourceDefs)) + t.Run(deleteCRDs+p.next.RuntimeVersion, common.DeleteCRD(p.next.CustomResourceDefs)) }) } From 50e1dffec036525a36e72cc4cb4d8c4d3f563387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Rasc=C3=A3o?= Date: Tue, 23 Jan 2024 09:55:30 +0000 Subject: [PATCH 3/4] Fix flaky upgrade test (#1368) * Fix flaky upgrade test Signed-off-by: Luis Rascao * fixup! Fix flaky upgrade test Signed-off-by: Luis Rascao --------- Signed-off-by: Luis Rascao Co-authored-by: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com> --- README.md | 2 + pkg/kubernetes/upgrade.go | 100 +++++++++++++++++++++++++++++++++----- 2 files changed, 89 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index cbe310e2b..dc8aca585 100644 --- a/README.md +++ b/README.md @@ -351,6 +351,8 @@ dapr upgrade -k --runtime-version=1.0.0 The example above shows how to upgrade from your current version to version `1.0.0`. +*Note: `dapr upgrade` will retry up to 5 times upon failure* + #### Supplying Helm values All available [Helm Chart values](https://github.com/dapr/dapr/tree/master/charts/dapr#configuration) can be set by using the `--set` flag: diff --git a/pkg/kubernetes/upgrade.go b/pkg/kubernetes/upgrade.go index f2c944ce7..c9ad41a2c 100644 --- a/pkg/kubernetes/upgrade.go +++ b/pkg/kubernetes/upgrade.go @@ -21,6 +21,7 @@ import ( helm "helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/chart" + "helm.sh/helm/v3/pkg/release" "k8s.io/helm/pkg/strvals" "github.com/hashicorp/go-version" @@ -56,6 +57,16 @@ type UpgradeConfig struct { ImageVariant string } +// UpgradeOptions represents options for the upgrade function. +type UpgradeOptions struct { + WithRetry bool + MaxRetries int + RetryInterval time.Duration +} + +// UpgradeOption is a functional option type for configuring upgrade. +type UpgradeOption func(*UpgradeOptions) + func Upgrade(conf UpgradeConfig) error { helmRepo := utils.GetEnv("DAPR_HELM_REPO_URL", daprHelmRepo) status, err := GetDaprResourcesStatus() @@ -71,14 +82,14 @@ func Upgrade(conf UpgradeConfig) error { return err } - helmConf, err := helmConfig(status[0].Namespace) + upgradeClient, helmConf, err := newUpgradeClient(status[0].Namespace, conf) if err != nil { - return err + return fmt.Errorf("unable to create helm client: %w", err) } controlPlaneChart, err := getHelmChart(conf.RuntimeVersion, "dapr", helmRepo, helmConf) if err != nil { - return err + return fmt.Errorf("unable to get helm chart: %w", err) } willHaveDashboardInDaprChart, err := IsDashboardIncluded(conf.RuntimeVersion) @@ -116,13 +127,6 @@ func Upgrade(conf UpgradeConfig) error { } } - upgradeClient := helm.NewUpgrade(helmConf) - upgradeClient.ResetValues = true - upgradeClient.Namespace = status[0].Namespace - upgradeClient.CleanupOnFail = true - upgradeClient.Wait = true - upgradeClient.Timeout = time.Duration(conf.Timeout) * time.Second - print.InfoStatusEvent(os.Stdout, "Starting upgrade...") mtls, err := IsMTLSEnabled() @@ -155,7 +159,7 @@ func Upgrade(conf UpgradeConfig) error { if !isDowngrade(conf.RuntimeVersion, daprVersion) { err = applyCRDs(fmt.Sprintf("v%s", conf.RuntimeVersion)) if err != nil { - return err + return fmt.Errorf("unable to apply CRDs: %w", err) } } else { print.InfoStatusEvent(os.Stdout, "Downgrade detected, skipping CRDs.") @@ -166,8 +170,13 @@ func Upgrade(conf UpgradeConfig) error { return err } - if _, err = upgradeClient.Run(chart, controlPlaneChart, vals); err != nil { - return err + // Deal with known race condition when applying both CRD and CR close together. The Helm upgrade fails + // when a CR is applied tries to be applied before the CRD is fully registered. On each retry we need a + // fresh client since the kube client locally caches the last OpenAPI schema it received from the server. + // See https://github.com/kubernetes/kubectl/issues/1179 + _, err = helmUpgrade(upgradeClient, chart, controlPlaneChart, vals, WithRetry(5, 100*time.Millisecond)) + if err != nil { + return fmt.Errorf("failure while running upgrade: %w", err) } if dashboardChart != nil { @@ -192,6 +201,55 @@ func Upgrade(conf UpgradeConfig) error { return nil } +// WithRetry enables retry with the specified max retries and retry interval. +func WithRetry(maxRetries int, retryInterval time.Duration) UpgradeOption { + return func(o *UpgradeOptions) { + o.WithRetry = true + o.MaxRetries = maxRetries + o.RetryInterval = retryInterval + } +} + +func helmUpgrade(client *helm.Upgrade, name string, chart *chart.Chart, vals map[string]interface{}, options ...UpgradeOption) (*release.Release, error) { + upgradeOptions := &UpgradeOptions{ + WithRetry: false, + MaxRetries: 0, + RetryInterval: 0, + } + + // Apply functional options. + for _, option := range options { + option(upgradeOptions) + } + + var release *release.Release + for attempt := 1; ; attempt++ { + _, err := client.Run(name, chart, vals) + if err == nil { + // operation succeeded, no need to retry. + break + } + + if !upgradeOptions.WithRetry || attempt >= upgradeOptions.MaxRetries { + // If not retrying or reached max retries, return the error. + return nil, fmt.Errorf("max retries reached, unable to run command: %w", err) + } + + print.PendingStatusEvent(os.Stdout, "Retrying after %s...", upgradeOptions.RetryInterval) + time.Sleep(upgradeOptions.RetryInterval) + + // create a totally new helm client, this ensures that we fetch a fresh openapi schema from the server on each attempt. + client, _, err = newUpgradeClient(client.Namespace, UpgradeConfig{ + Timeout: uint(client.Timeout), + }) + if err != nil { + return nil, fmt.Errorf("unable to create helm client: %w", err) + } + } + + return release, nil +} + func highAvailabilityEnabled(status []StatusOutput) bool { for _, s := range status { if s.Name == "dapr-dashboard" { @@ -264,3 +322,19 @@ func isDowngrade(targetVersion, existingVersion string) bool { } return target.LessThan(existing) } + +func newUpgradeClient(namespace string, cfg UpgradeConfig) (*helm.Upgrade, *helm.Configuration, error) { + helmCfg, err := helmConfig(namespace) + if err != nil { + return nil, nil, err + } + + client := helm.NewUpgrade(helmCfg) + client.ResetValues = true + client.Namespace = namespace + client.CleanupOnFail = true + client.Wait = true + client.Timeout = time.Duration(cfg.Timeout) * time.Second + + return client, helmCfg, nil +} From 2380446870e4a3f7022923a2765313877a3a15e2 Mon Sep 17 00:00:00 2001 From: twinguy Date: Tue, 23 Jan 2024 04:30:06 -0600 Subject: [PATCH 4/4] fix default installation directory permissions (#1375) Signed-off-by: Kenny Meador Signed-off-by: Kenny Meador Co-authored-by: Kenny Meador Co-authored-by: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com> --- pkg/standalone/standalone.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/standalone/standalone.go b/pkg/standalone/standalone.go index bd2761f82..64e7e2905 100644 --- a/pkg/standalone/standalone.go +++ b/pkg/standalone/standalone.go @@ -724,7 +724,7 @@ func makeDefaultComponentsDir(installDir string) error { } } - os.Chmod(componentsDir, 0o777) + os.Chmod(componentsDir, 0o755) return nil } @@ -1030,12 +1030,12 @@ func checkAndOverWriteFile(filePath string, b []byte) error { } func prepareDaprInstallDir(daprBinDir string) error { - err := os.MkdirAll(daprBinDir, 0o777) + err := os.MkdirAll(daprBinDir, 0o755) if err != nil { return err } - err = os.Chmod(daprBinDir, 0o777) + err = os.Chmod(daprBinDir, 0o755) if err != nil { return err }